Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNERerouter.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 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
23#include "GNEAdditional.h"
25
26// ===========================================================================
27// class declarations
28// ===========================================================================
29
30class GNEEdge;
31
32// ===========================================================================
33// class definitions
34// ===========================================================================
35
37
38public:
40 GNERerouter(GNENet* net);
41
52 GNERerouter(const std::string& id, GNENet* net, const std::string& filename, const Position& pos, const std::string& name,
53 double probability, bool off, bool optional, SUMOTime timeThreshold, const std::vector<std::string>& vTypes,
54 const Parameterised::Map& parameters);
55
58
61
63 GNEMoveElement* getMoveElement() const override;
64
66 Parameterised* getParameters() override;
67
69 const Parameterised* getParameters() const override;
70
72
75
78
82 void writeAdditional(OutputDevice& device) const;
83
85 bool isAdditionalValid() const;
86
88 std::string getAdditionalProblem() const;
89
92
94
97
99 bool checkDrawMoveContour() const override;
100
102
105
107 void updateGeometry() override;
108
111
113 void updateCenteringBoundary(const bool updateGrid);
114
116 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
117
119
122
125 std::string getParentName() const;
126
131 void drawGL(const GUIVisualizationSettings& s) const;
132
134
137
138 /* @brief method for getting the Attribute of an XML key
139 * @param[in] key The attribute key
140 * @return string with the value associated to key
141 */
142 std::string getAttribute(SumoXMLAttr key) const override;
143
144 /* @brief method for getting the Attribute of an XML key in double format
145 * @param[in] key The attribute key
146 * @return double with the value associated to key
147 */
148 double getAttributeDouble(SumoXMLAttr key) const override;
149
150 /* @brief method for getting the Attribute of an XML key in position format
151 * @param[in] key The attribute key
152 * @return position with the value associated to key
153 */
154 Position getAttributePosition(SumoXMLAttr key) const override;
155
156 /* @brief method for getting the Attribute of an XML key in positionVector format
157 * @param[in] key The attribute key
158 * @return positionVector with the value associated to key
159 */
161
162 /* @brief method for setting the attribute and letting the object perform additional changes
163 * @param[in] key The attribute key
164 * @param[in] value The new value
165 * @param[in] undoList The undoList on which to register changes
166 */
167 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
168
169 /* @brief method for checking if the key and their correspond attribute are valids
170 * @param[in] key The attribute key
171 * @param[in] value The value associated to key key
172 * @return true if the value is valid, false in other case
173 */
174 bool isValid(SumoXMLAttr key, const std::string& value) override;
175
177 std::string getPopUpID() const override;
178
180 std::string getHierarchyName() const override;
181
183
184protected:
186 double myProbability = 0;
187
189 bool myOff = false;
190
192 bool myOptional = false;
193
196
198 std::vector<std::string> myVTypes;
199
200private:
202 void setAttribute(SumoXMLAttr key, const std::string& value) override;
203
205 void rebuildRerouterSymbols(const std::string& value, GNEUndoList* undoList);
206
208 GNERerouter(const GNERerouter&) = delete;
209
212};
long long int SUMOTime
Definition GUI.h:36
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
SUMOTime myTimeThreshold
attribute to configure activation time threshold
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Position getAttributePosition(SumoXMLAttr key) const override
void rebuildRerouterSymbols(const std::string &value, GNEUndoList *undoList)
rebuild Rerouter Symbols
double getAttributeDouble(SumoXMLAttr key) const override
std::vector< std::string > myVTypes
optional vehicle types for restricting the rerouter
std::string getAttribute(SumoXMLAttr key) const override
bool isAdditionalValid() const
check if current additional is valid to be written into XML (must be reimplemented in all detector ch...
bool myOff
attribute to enable or disable inactive initially
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Position getPositionInView() const
Returns position of additional in view.
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
bool checkDrawMoveContour() const override
check if draw move contour (red)
void writeAdditional(OutputDevice &device) const
write additional element into a xml file
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
double myProbability
probability of rerouter
std::string getParentName() const
Returns the name of the parent object.
void fixAdditionalProblem()
fix additional problem (must be reimplemented in all detector children)
void openAdditionalDialog()
open GNERerouterDialog
~GNERerouter()
Destructor.
Parameterised * getParameters() override
get parameters associated with this rerouter
void updateGeometry() override
update pre-computed geometry information
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
bool myOptional
attribute to enable or disable request trigger
bool isValid(SumoXMLAttr key, const std::string &value) override
std::string getAdditionalProblem() const
return a string with the current additional problem (must be reimplemented in all detector children)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
GNERerouter(const GNERerouter &)=delete
Invalidated copy constructor.
GNERerouter & operator=(const GNERerouter &)=delete
Invalidated assignment operator.
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this rerouter
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
An upper class for objects with additional parameters.
std::map< std::string, std::string > Map
parameters map
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.