Eclipse SUMO - Simulation of Urban MObility
GNERerouter.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
14 //
15 /****************************************************************************/
16 #ifndef GNERerouter_h
17 #define GNERerouter_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 
24 #include "GNEAdditional.h"
25 
26 // ===========================================================================
27 // class declarations
28 // ===========================================================================
29 
30 class GNEEdge;
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
39 class GNERerouter : public GNEAdditional {
40 
41 public:
53  GNERerouter(const std::string& id, GNEViewNet* viewNet, const Position& pos, const std::vector<GNEEdge*>& edges, const std::string& name,
54  const std::string& filename, double probability, bool off, SUMOTime timeThreshold, const std::string& vTypes, bool blockMovement);
55 
57  ~GNERerouter();
58 
60  void openAdditionalDialog();
61 
64 
67  void moveGeometry(const Position& offset);
68 
72  void commitGeometryMoving(GNEUndoList* undoList);
73 
75  void updateGeometry();
76 
79 
82 
84  void splitEdgeGeometry(const double splitPosition, const GNENetElement* originalElement, const GNENetElement* newElement, GNEUndoList* undoList);
86 
91  std::string getParentName() const;
92 
97  void drawGL(const GUIVisualizationSettings& s) const;
99 
102  /* @brief method for getting the Attribute of an XML key
103  * @param[in] key The attribute key
104  * @return string with the value associated to key
105  */
106  std::string getAttribute(SumoXMLAttr key) const;
107 
108  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
109  * @param[in] key The attribute key
110  * @return double with the value associated to key
111  */
112  double getAttributeDouble(SumoXMLAttr key) const;
113 
114  /* @brief method for setting the attribute and letting the object perform additional changes
115  * @param[in] key The attribute key
116  * @param[in] value The new value
117  * @param[in] undoList The undoList on which to register changes
118  */
119  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
120 
121  /* @brief method for checking if the key and their correspond attribute are valids
122  * @param[in] key The attribute key
123  * @param[in] value The value asociated to key key
124  * @return true if the value is valid, false in other case
125  */
126  bool isValid(SumoXMLAttr key, const std::string& value);
127 
128  /* @brief method for check if the value for certain attribute is set
129  * @param[in] key The attribute key
130  */
131  bool isAttributeEnabled(SumoXMLAttr key) const;
132 
134  std::string getPopUpID() const;
135 
137  std::string getHierarchyName() const;
139 
140 protected:
143 
145  std::string myFilename;
146 
149 
151  bool myOff;
152 
155 
157  std::string myVTypes;
158 
159 private:
161  void setAttribute(SumoXMLAttr key, const std::string& value);
162 
164  GNERerouter(const GNERerouter&) = delete;
165 
167  GNERerouter& operator=(const GNERerouter&) = delete;
168 };
169 
170 #endif
171 
172 /****************************************************************************/
GNERerouter::myFilename
std::string myFilename
filename of rerouter
Definition: GNERerouter.h:145
GNERerouter::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNERerouter.cpp:128
GNERerouter::GNERerouter
GNERerouter(const std::string &id, GNEViewNet *viewNet, const Position &pos, const std::vector< GNEEdge * > &edges, const std::string &name, const std::string &filename, double probability, bool off, SUMOTime timeThreshold, const std::string &vTypes, bool blockMovement)
Constructor.
Definition: GNERerouter.cpp:37
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
GNEAdditional.h
GNERerouter::myVTypes
std::string myVTypes
optional vehicle types for restricting the rerouter
Definition: GNERerouter.h:157
GNERerouter::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNERerouter.cpp:75
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
GNEViewNet
Definition: GNEViewNet.h:42
GNERerouter::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNERerouter.cpp:306
GNERerouter::operator=
GNERerouter & operator=(const GNERerouter &)=delete
Invalidated assignment operator.
GNERerouter
Definition: GNERerouter.h:39
GNERerouter::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNERerouter.cpp:253
GNERerouter::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNERerouter.cpp:294
GNERerouter::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNERerouter.cpp:69
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:51
GNERerouter::myTimeThreshold
SUMOTime myTimeThreshold
attribute to configure activation time threshold
Definition: GNERerouter.h:154
GNERerouter::myPosition
Position myPosition
position of rerouter in view
Definition: GNERerouter.h:142
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GNERerouter::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNERerouter.cpp:180
GNERerouter::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNERerouter.cpp:102
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNERerouter::~GNERerouter
~GNERerouter()
Destructor.
Definition: GNERerouter.cpp:48
GNERerouter::myProbability
double myProbability
probability of rerouter
Definition: GNERerouter.h:148
GNERerouter::getParentName
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNERerouter.cpp:122
GNENetElement
Definition: GNENetElement.h:43
GNERerouter::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNERerouter.cpp:213
GNERerouter::setAttribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
Definition: GNERerouter.cpp:219
GNERerouter::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNERerouter.cpp:113
GNERerouter::GNERerouter
GNERerouter(const GNERerouter &)=delete
Invalidated copy constructor.
GNERerouter::openAdditionalDialog
void openAdditionalDialog()
open GNERerouterDialog
Definition: GNERerouter.cpp:95
GNEUndoList
Definition: GNEUndoList.h:48
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
GNERerouter::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNERerouter.cpp:53
GNERerouter::splitEdgeGeometry
void splitEdgeGeometry(const double splitPosition, const GNENetElement *originalElement, const GNENetElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNERerouter.cpp:89
GNERerouter::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNERerouter.cpp:300
GNERerouter::myOff
bool myOff
attribute to enable or disable inactive initially
Definition: GNERerouter.h:151