SUMO - Simulation of Urban MObility
GNERerouter.h
Go to the documentation of this file.
1 /****************************************************************************/
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software; you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation; either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 #ifndef GNERerouter_h
21 #define GNERerouter_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include "GNEAdditional.h"
34 
35 // ===========================================================================
36 // class declarations
37 // ===========================================================================
38 
39 class GNEEdge;
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
49 class GNERerouter : public GNEAdditional {
50 public:
60  GNERerouter(const std::string& id, GNEViewNet* viewNet, Position pos, std::vector<GNEEdge*> edges, const std::string& filename, SUMOReal probability, bool off);
61 
63  ~GNERerouter();
64 
67  void updateGeometry();
68 
71 
73  void openAdditionalDialog();
74 
76  void moveAdditionalGeometry(SUMOReal offsetx, SUMOReal offsety);
77 
79  void commmitAdditionalGeometryMoved(SUMOReal oldPosx, SUMOReal oldPosy, GNEUndoList* undoList);
80 
84  void writeAdditional(OutputDevice& device) const;
85 
87  void addEdgeChild(GNEEdge* edge);
88 
90  void removeEdgeChild(GNEEdge* edge);
91 
93  const std::vector<GNERerouterInterval>& getRerouterIntervals() const;
94 
98  void setRerouterIntervals(const std::vector<GNERerouterInterval>& rerouterIntervals);
99 
104  const std::string& getParentName() const;
105 
110  void drawGL(const GUIVisualizationSettings& s) const;
112 
115  /* @brief method for getting the Attribute of an XML key
116  * @param[in] key The attribute key
117  * @return string with the value associated to key
118  */
119  std::string getAttribute(SumoXMLAttr key) const;
120 
121  /* @brief method for setting the attribute and letting the object perform additional changes
122  * @param[in] key The attribute key
123  * @param[in] value The new value
124  * @param[in] undoList The undoList on which to register changes
125  */
126  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
127 
128  /* @brief method for checking if the key and their correspond attribute are valids
129  * @param[in] key The attribute key
130  * @param[in] value The value asociated to key key
131  * @return true if the value is valid, false in other case
132  */
133  bool isValid(SumoXMLAttr key, const std::string& value);
135 
136 protected:
138  std::vector<GNEEdge*> myEdges;
139 
141  std::string myFilename;
142 
145 
147  bool myOff;
148 
150  std::vector<GNERerouterInterval> myRerouterIntervals;
151 
152 private:
154  void setAttribute(SumoXMLAttr key, const std::string& value);
155 
157  GNERerouter(const GNERerouter&);
158 
161 };
162 
163 #endif
164 
165 /****************************************************************************/
GNERerouter & operator=(const GNERerouter &)
Invalidated assignment operator.
~GNERerouter()
Destructor.
Definition: GNERerouter.cpp:84
Stores the information about how to visualize structures.
const std::string & getParentName() const
Returns the name of the parent object (if any)
void removeEdgeChild(GNEEdge *edge)
remove edge child
bool myOff
attribute to enable or disable inactive initially
Definition: GNERerouter.h:147
std::string getAttribute(SumoXMLAttr key) const
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void moveAdditionalGeometry(SUMOReal offsetx, SUMOReal offsety)
change the position of the rerouter geometry
GNERerouter(const std::string &id, GNEViewNet *viewNet, Position pos, std::vector< GNEEdge * > edges, const std::string &filename, SUMOReal probability, bool off)
Constructor.
Definition: GNERerouter.cpp:70
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void setRerouterIntervals(const std::vector< GNERerouterInterval > &rerouterIntervals)
set rerouter intervals
std::string myFilename
filename of rerouter
Definition: GNERerouter.h:141
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
const std::vector< GNERerouterInterval > & getRerouterIntervals() const
get rerouter intervals
void writeAdditional(OutputDevice &device) const
writte additional element into a xml file
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:54
std::vector< GNEEdge * > myEdges
edges of Rerouter
Definition: GNERerouter.h:138
void commmitAdditionalGeometryMoved(SUMOReal oldPosx, SUMOReal oldPosy, GNEUndoList *undoList)
updated geometry changes in the attributes of additional
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:62
void addEdgeChild(GNEEdge *edge)
add edge child
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void updateGeometry()
update pre-computed geometry information
Definition: GNERerouter.cpp:89
Position getPositionInView() const
Returns position of Rerouter in view.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
#define SUMOReal
Definition: config.h:208
SUMOReal myProbability
probability of rerouter
Definition: GNERerouter.h:144
std::vector< GNERerouterInterval > myRerouterIntervals
set with the GNERerouterInterval
Definition: GNERerouter.h:150
void openAdditionalDialog()
open GNERerouterDialog