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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 //
18 /****************************************************************************/
19 #ifndef GNERerouter_h
20 #define GNERerouter_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include "GNEAdditional.h"
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
37 
38 class GNEEdge;
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
48 class GNERerouter : public GNEAdditional {
49 
50 public:
60  GNERerouter(const std::string& id, GNEViewNet* viewNet, Position pos, std::vector<GNEEdge*> edges, const std::string& filename,
61  double probability, bool off, double timeThreshold);
62 
64  ~GNERerouter();
65 
69  void writeAdditional(OutputDevice& device) const;
70 
72  void openAdditionalDialog();
73 
76 
78  void addRerouterInterval(GNERerouterInterval* rerouterInterval);
79 
81  void removeRerouterInterval(GNERerouterInterval* rerouterInterval);
82 
84  const std::vector<GNERerouterInterval*>& getRerouterIntervals() const;
85 
88 
90  void sortIntervals();
91 
93 
96 
100  void moveGeometry(const Position& oldPos, const Position& offset);
101 
106  void commitGeometryMoving(const Position& oldPos, GNEUndoList* undoList);
107 
109  void updateGeometry();
110 
112  Position getPositionInView() const;
114 
119  const std::string& getParentName() const;
120 
125  void drawGL(const GUIVisualizationSettings& s) const;
127 
130  /* @brief method for getting the Attribute of an XML key
131  * @param[in] key The attribute key
132  * @return string with the value associated to key
133  */
134  std::string getAttribute(SumoXMLAttr key) const;
135 
136  /* @brief method for setting the attribute and letting the object perform additional changes
137  * @param[in] key The attribute key
138  * @param[in] value The new value
139  * @param[in] undoList The undoList on which to register changes
140  */
141  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
142 
143  /* @brief method for checking if the key and their correspond attribute are valids
144  * @param[in] key The attribute key
145  * @param[in] value The value asociated to key key
146  * @return true if the value is valid, false in other case
147  */
148  bool isValid(SumoXMLAttr key, const std::string& value);
150 
151 protected:
154 
156  std::string myFilename;
157 
160 
162  bool myOff;
163 
166 
168  std::vector<GNERerouterInterval*> myRerouterIntervals;
169 
170 private:
172  void setAttribute(SumoXMLAttr key, const std::string& value);
173 
175  GNERerouter(const GNERerouter&) = delete;
176 
178  GNERerouter& operator=(const GNERerouter&) = delete;
179 };
180 
181 #endif
182 
183 /****************************************************************************/
void moveGeometry(const Position &oldPos, const Position &offset)
change the position of the element geometry without saving in undoList
void removeRerouterInterval(GNERerouterInterval *rerouterInterval)
add rerouter interval
~GNERerouter()
Destructor.
Definition: GNERerouter.cpp:74
Stores the information about how to visualize structures.
std::string getAttribute(SumoXMLAttr key) const
This functions has to be implemented in all GNEAttributeCarriers.
Position getPositionInView() const
Returns position of additional in view.
int getNumberOfOverlappedIntervals() const
get number of overlapped intervals
Position myPosition
position of rerouter in view
Definition: GNERerouter.h:153
bool myOff
attribute to enable or disable inactive initially
Definition: GNERerouter.h:162
const std::string & getParentName() const
Returns the name of the parent object (if any)
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
double myProbability
probability of rerouter
Definition: GNERerouter.h:159
void writeAdditional(OutputDevice &device) const
writte additional element into a xml file
void commitGeometryMoving(const Position &oldPos, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
void addRerouterInterval(GNERerouterInterval *rerouterInterval)
add rerouter interval
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
std::vector< GNERerouterInterval * > myRerouterIntervals
set with the GNERerouterInterval
Definition: GNERerouter.h:168
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
std::string myFilename
filename of rerouter
Definition: GNERerouter.h:156
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
GNERerouter(const std::string &id, GNEViewNet *viewNet, Position pos, std::vector< GNEEdge *> edges, const std::string &filename, double probability, bool off, double timeThreshold)
Constructor.
Definition: GNERerouter.cpp:64
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:56
void sortIntervals()
sort intervals
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:59
const std::vector< GNERerouterInterval * > & getRerouterIntervals() const
get rerouter intervals
GNERerouter & operator=(const GNERerouter &)=delete
Invalidated assignment operator.
void updateGeometry()
update pre-computed geometry information
Definition: GNERerouter.cpp:79
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
double myTimeThreshold
attribute to configure activation time threshold
Definition: GNERerouter.h:165
void openAdditionalDialog()
open GNERerouterDialog