SUMO - Simulation of Urban MObility
GNERerouter.h
Go to the documentation of this file.
1 /****************************************************************************/
7 //
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 #ifndef GNERerouter_h
21 #define GNERerouter_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include "GNEAdditional.h"
34 
35 // ===========================================================================
36 // class declarations
37 // ===========================================================================
38 
39 class GNEEdge;
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
49 class GNERerouter : public GNEAdditional {
50 public:
60  GNERerouter(const std::string& id, GNEViewNet* viewNet, Position pos, std::vector<GNEEdge*> edges, const std::string& filename, double probability, bool off);
61 
63  ~GNERerouter();
64 
69  void writeAdditional(OutputDevice& device, bool volatileOptionsEnabled) const;
70 
72  void openAdditionalDialog();
73 
75  void addEdgeChild(GNEEdge* edge);
76 
78  void removeEdgeChild(GNEEdge* edge);
79 
81  const std::vector<GNEEdge*>& getEdgeChilds() const;
82 
86  bool addRerouterInterval(const GNERerouterInterval& rerouterInterval);
87 
89  const std::vector<GNERerouterInterval>& getRerouterIntervals() const;
90 
94  bool setRerouterIntervals(const std::vector<GNERerouterInterval>& rerouterIntervals);
95 
98 
102  void moveGeometry(const Position& newPosition);
103 
108  void commitGeometryMoving(const Position& oldPos, GNEUndoList* undoList);
109 
111  void updateGeometry();
112 
114  Position getPositionInView() const;
116 
121  const std::string& getParentName() const;
122 
127  void drawGL(const GUIVisualizationSettings& s) const;
129 
132  /* @brief method for getting the Attribute of an XML key
133  * @param[in] key The attribute key
134  * @return string with the value associated to key
135  */
136  std::string getAttribute(SumoXMLAttr key) const;
137 
138  /* @brief method for setting the attribute and letting the object perform additional changes
139  * @param[in] key The attribute key
140  * @param[in] value The new value
141  * @param[in] undoList The undoList on which to register changes
142  */
143  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
144 
145  /* @brief method for checking if the key and their correspond attribute are valids
146  * @param[in] key The attribute key
147  * @param[in] value The value asociated to key key
148  * @return true if the value is valid, false in other case
149  */
150  bool isValid(SumoXMLAttr key, const std::string& value);
152 
154  bool checkOverlapping(std::vector<GNERerouterInterval> rerouterIntervals);
155 
156 protected:
159 
161  std::vector<GNEEdge*> myEdges;
162 
164  std::string myFilename;
165 
168 
170  bool myOff;
171 
173  std::vector<GNERerouterInterval> myRerouterIntervals;
174 
175 private:
177  void setAttribute(SumoXMLAttr key, const std::string& value);
178 
180  GNERerouter(const GNERerouter&);
181 
184 };
185 
186 #endif
187 
188 /****************************************************************************/
GNERerouter & operator=(const GNERerouter &)
Invalidated assignment operator.
~GNERerouter()
Destructor.
Definition: GNERerouter.cpp:79
Stores the information about how to visualize structures.
Position myPosition
position of rerouter in view
Definition: GNERerouter.h:158
const std::string & getParentName() const
Returns the name of the parent object (if any)
void removeEdgeChild(GNEEdge *edge)
remove edge child
bool myOff
attribute to enable or disable inactive initially
Definition: GNERerouter.h:170
std::string getAttribute(SumoXMLAttr key) const
This functions has to be implemented in allGNEAttributeCarrier.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
double myProbability
probability of rerouter
Definition: GNERerouter.h:167
void moveGeometry(const Position &newPosition)
change the position of the element geometry without saving in undoList
void commitGeometryMoving(const Position &oldPos, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void writeAdditional(OutputDevice &device, bool volatileOptionsEnabled) const
writte additional element into a xml file
bool addRerouterInterval(const GNERerouterInterval &rerouterInterval)
add rerouter interval
std::string myFilename
filename of rerouter
Definition: GNERerouter.h:164
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
bool checkOverlapping(std::vector< GNERerouterInterval > rerouterIntervals)
check overlapping of a vector of rerouter intervals
const std::vector< GNERerouterInterval > & getRerouterIntervals() const
get rerouter intervals
bool setRerouterIntervals(const std::vector< GNERerouterInterval > &rerouterIntervals)
set rerouter intervals
const std::vector< GNEEdge * > & getEdgeChilds() const
get edge chidls
GNERerouter(const std::string &id, GNEViewNet *viewNet, Position pos, std::vector< GNEEdge * > edges, const std::string &filename, double probability, bool off)
Constructor.
Definition: GNERerouter.cpp:67
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:58
std::vector< GNEEdge * > myEdges
edges of Rerouter
Definition: GNERerouter.h:161
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:62
void addEdgeChild(GNEEdge *edge)
add edge child
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void updateGeometry()
update pre-computed geometry information
Definition: GNERerouter.cpp:84
Position getPositionInView() const
Returns position of additional in view.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
std::vector< GNERerouterInterval > myRerouterIntervals
set with the GNERerouterInterval
Definition: GNERerouter.h:173
void openAdditionalDialog()
open GNERerouterDialog