SUMO - Simulation of Urban MObility
GNERerouter.h
Go to the documentation of this file.
1 /****************************************************************************/
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 
67  void updateGeometry();
68 
71 
73  void openAdditionalDialog();
74 
76  void moveAdditionalGeometry(double offsetx, double offsety);
77 
79  void commmitAdditionalGeometryMoved(double oldPosx, double oldPosy, GNEUndoList* undoList);
80 
84  void writeAdditional(OutputDevice& device) const;
85 
87  void addEdgeChild(GNEEdge* edge);
88 
90  void removeEdgeChild(GNEEdge* edge);
91 
93  const std::vector<GNEEdge*>& getEdgeChilds() const;
94 
98  bool addRerouterInterval(const GNERerouterInterval& rerouterInterval);
99 
101  const std::vector<GNERerouterInterval>& getRerouterIntervals() const;
102 
106  bool setRerouterIntervals(const std::vector<GNERerouterInterval>& rerouterIntervals);
107 
112  const std::string& getParentName() const;
113 
118  void drawGL(const GUIVisualizationSettings& s) const;
120 
123  /* @brief method for getting the Attribute of an XML key
124  * @param[in] key The attribute key
125  * @return string with the value associated to key
126  */
127  std::string getAttribute(SumoXMLAttr key) const;
128 
129  /* @brief method for setting the attribute and letting the object perform additional changes
130  * @param[in] key The attribute key
131  * @param[in] value The new value
132  * @param[in] undoList The undoList on which to register changes
133  */
134  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
135 
136  /* @brief method for checking if the key and their correspond attribute are valids
137  * @param[in] key The attribute key
138  * @param[in] value The value asociated to key key
139  * @return true if the value is valid, false in other case
140  */
141  bool isValid(SumoXMLAttr key, const std::string& value);
143 
145  bool checkOverlapping(std::vector<GNERerouterInterval> rerouterIntervals);
146 
147 protected:
149  std::vector<GNEEdge*> myEdges;
150 
152  std::string myFilename;
153 
156 
158  bool myOff;
159 
161  std::vector<GNERerouterInterval> myRerouterIntervals;
162 
163 private:
165  void setAttribute(SumoXMLAttr key, const std::string& value);
166 
168  GNERerouter(const GNERerouter&);
169 
172 };
173 
174 #endif
175 
176 /****************************************************************************/
GNERerouter & operator=(const GNERerouter &)
Invalidated assignment operator.
~GNERerouter()
Destructor.
Definition: GNERerouter.cpp:81
Stores the information about how to visualize structures.
std::string getAttribute(SumoXMLAttr key) const
const std::vector< GNERerouterInterval > & getRerouterIntervals() const
get rerouter intervals
Position getPositionInView() const
Returns position of Rerouter in view.
void removeEdgeChild(GNEEdge *edge)
remove edge child
bool myOff
attribute to enable or disable inactive initially
Definition: GNERerouter.h:158
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:155
void writeAdditional(OutputDevice &device) const
writte additional element into a xml file
const std::vector< GNEEdge * > & getEdgeChilds() const
get edge chidls
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
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
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void commmitAdditionalGeometryMoved(double oldPosx, double oldPosy, GNEUndoList *undoList)
updated geometry changes in the attributes of additional
bool addRerouterInterval(const GNERerouterInterval &rerouterInterval)
add rerouter interval
std::string myFilename
filename of rerouter
Definition: GNERerouter.h:152
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
bool setRerouterIntervals(const std::vector< GNERerouterInterval > &rerouterIntervals)
set rerouter intervals
void moveAdditionalGeometry(double offsetx, double offsety)
change the position of the rerouter geometry
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:57
std::vector< GNEEdge * > myEdges
edges of Rerouter
Definition: GNERerouter.h:149
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:62
void addEdgeChild(GNEEdge *edge)
add edge child
void updateGeometry()
update pre-computed geometry information
Definition: GNERerouter.cpp:86
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:161
void openAdditionalDialog()
open GNERerouterDialog