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-2022 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 <config.h>
22 #include "GNEAdditional.h"
23 
24 // ===========================================================================
25 // class declarations
26 // ===========================================================================
27 
28 class GNEEdge;
29 
30 // ===========================================================================
31 // class definitions
32 // ===========================================================================
37 class GNERerouter : public GNEAdditional {
38 
39 public:
41  GNERerouter(GNENet* net);
42 
53  GNERerouter(const std::string& id, GNENet* net, const Position& pos, const std::string& name, const std::string& filename,
54  double probability, bool off, SUMOTime timeThreshold, const std::vector<std::string>& vTypes,
55  const std::map<std::string, std::string>& parameters);
56 
58  ~GNERerouter();
59 
63  void writeAdditional(OutputDevice& device) const;
64 
69 
71  void openAdditionalDialog();
72 
76  void updateGeometry();
77 
80 
82  void updateCenteringBoundary(const bool updateGrid);
83 
85  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
87 
92  std::string getParentName() const;
93 
98  void drawGL(const GUIVisualizationSettings& s) const;
100 
103  /* @brief method for getting the Attribute of an XML key
104  * @param[in] key The attribute key
105  * @return string with the value associated to key
106  */
107  std::string getAttribute(SumoXMLAttr key) const;
108 
109  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
110  * @param[in] key The attribute key
111  * @return double with the value associated to key
112  */
113  double getAttributeDouble(SumoXMLAttr key) const;
114 
115  /* @brief method for setting the attribute and letting the object perform additional changes
116  * @param[in] key The attribute key
117  * @param[in] value The new value
118  * @param[in] undoList The undoList on which to register changes
119  */
120  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
121 
122  /* @brief method for checking if the key and their correspond attribute are valids
123  * @param[in] key The attribute key
124  * @param[in] value The value asociated to key key
125  * @return true if the value is valid, false in other case
126  */
127  bool isValid(SumoXMLAttr key, const std::string& value);
128 
129  /* @brief method for check if the value for certain attribute is set
130  * @param[in] key The attribute key
131  */
132  bool isAttributeEnabled(SumoXMLAttr key) const;
133 
135  std::string getPopUpID() const;
136 
138  std::string getHierarchyName() const;
140 
141 protected:
144 
146  std::string myFilename;
147 
150 
152  bool myOff;
153 
156 
158  std::vector<std::string> myVTypes;
159 
160 private:
162  void setAttribute(SumoXMLAttr key, const std::string& value);
163 
165  void setMoveShape(const GNEMoveResult& moveResult);
166 
168  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
169 
171  void rebuildRerouterSymbols(const std::string& value, GNEUndoList* undoList);
172 
174  GNERerouter(const GNERerouter&) = delete;
175 
177  GNERerouter& operator=(const GNERerouter&) = delete;
178 };
long long int SUMOTime
Definition: SUMOTime.h:32
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
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:155
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
std::vector< std::string > myVTypes
optional vehicle types for restricting the rerouter
Definition: GNERerouter.h:158
Position myPosition
position of rerouter in view
Definition: GNERerouter.h:143
bool myOff
attribute to enable or disable inactive initially
Definition: GNERerouter.h:152
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Position getPositionInView() const
Returns position of additional in view.
GNERerouter(GNENet *net)
default Constructor
Definition: GNERerouter.cpp:35
void writeAdditional(OutputDevice &device) const
writte additional element into a xml file
Definition: GNERerouter.cpp:69
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:149
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:64
std::string getAttribute(SumoXMLAttr key) const
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
bool isAttributeEnabled(SumoXMLAttr key) const
GNEMoveOperation * getMoveOperation()
get move operation
std::string myFilename
filename of rerouter
Definition: GNERerouter.h:146
void updateGeometry()
update pre-computed geometry information
GNERerouter(const GNERerouter &)=delete
Invalidated copy constructor.
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37