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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 //
19 /****************************************************************************/
20 #pragma once
21 #include "GNEAdditional.h"
22 
23 // ===========================================================================
24 // class declarations
25 // ===========================================================================
26 
27 class GNEEdge;
28 
29 // ===========================================================================
30 // class definitions
31 // ===========================================================================
36 class GNERerouter : public GNEAdditional {
37 
38 public:
49  GNERerouter(const std::string& id, GNENet* net, const Position& pos, const std::string& name,
50  const std::string& filename, double probability, bool off, SUMOTime timeThreshold, const std::string& vTypes, bool blockMovement);
51 
53  ~GNERerouter();
54 
58  GNEMoveOperation* getMoveOperation(const double shapeOffset);
59 
61  void openAdditionalDialog();
62 
66  void updateGeometry();
67 
69  void updateCenteringBoundary(const bool updateGrid);
70 
72  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
74 
79  std::string getParentName() const;
80 
85  void drawGL(const GUIVisualizationSettings& s) const;
87 
90  /* @brief method for getting the Attribute of an XML key
91  * @param[in] key The attribute key
92  * @return string with the value associated to key
93  */
94  std::string getAttribute(SumoXMLAttr key) const;
95 
96  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
97  * @param[in] key The attribute key
98  * @return double with the value associated to key
99  */
100  double getAttributeDouble(SumoXMLAttr key) const;
101 
102  /* @brief method for setting the attribute and letting the object perform additional changes
103  * @param[in] key The attribute key
104  * @param[in] value The new value
105  * @param[in] undoList The undoList on which to register changes
106  */
107  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
108 
109  /* @brief method for checking if the key and their correspond attribute are valids
110  * @param[in] key The attribute key
111  * @param[in] value The value asociated to key key
112  * @return true if the value is valid, false in other case
113  */
114  bool isValid(SumoXMLAttr key, const std::string& value);
115 
116  /* @brief method for check if the value for certain attribute is set
117  * @param[in] key The attribute key
118  */
119  bool isAttributeEnabled(SumoXMLAttr key) const;
120 
122  std::string getPopUpID() const;
123 
125  std::string getHierarchyName() const;
127 
128 protected:
131 
133  std::string myFilename;
134 
137 
139  bool myOff;
140 
143 
145  std::string myVTypes;
146 
147 private:
149  void setAttribute(SumoXMLAttr key, const std::string& value);
150 
152  void setMoveShape(const GNEMoveResult& moveResult);
153 
155  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
156 
158  void rebuildRerouterSymbols(const std::string& value, GNEUndoList* undoList);
159 
161  GNERerouter(const GNERerouter&) = delete;
162 
164  GNERerouter& operator=(const GNERerouter&) = delete;
165 };
long long int SUMOTime
Definition: SUMOTime.h:31
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
SUMOTime myTimeThreshold
attribute to configure activation time threshold
Definition: GNERerouter.h:142
GNEMoveOperation * getMoveOperation(const double shapeOffset)
get move operation for the given shapeOffset
Definition: GNERerouter.cpp:59
GNERerouter(const std::string &id, GNENet *net, const Position &pos, const std::string &name, const std::string &filename, double probability, bool off, SUMOTime timeThreshold, const std::string &vTypes, bool blockMovement)
Constructor.
Definition: GNERerouter.cpp:38
std::string myVTypes
optional vehicle types for restricting the rerouter
Definition: GNERerouter.h:145
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
double getAttributeDouble(SumoXMLAttr key) const
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void rebuildRerouterSymbols(const std::string &value, GNEUndoList *undoList)
rebuild Rerouter Symbols
Position myPosition
position of rerouter in view
Definition: GNERerouter.h:130
bool myOff
attribute to enable or disable inactive initially
Definition: GNERerouter.h:139
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
GNERerouter & operator=(const GNERerouter &)=delete
Invalidated assignment operator.
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
double myProbability
probability of rerouter
Definition: GNERerouter.h:136
std::string getParentName() const
Returns the name of the parent object (if any)
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
void openAdditionalDialog()
open GNERerouterDialog
~GNERerouter()
Destructor.
Definition: GNERerouter.cpp:54
std::string getAttribute(SumoXMLAttr key) const
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition: GNERerouter.cpp:80
bool isAttributeEnabled(SumoXMLAttr key) const
std::string myFilename
filename of rerouter
Definition: GNERerouter.h:133
void updateGeometry()
update pre-computed geometry information
Definition: GNERerouter.cpp:71
GNERerouter(const GNERerouter &)=delete
Invalidated copy constructor.
Stores the information about how to visualize structures.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36