SUMO - Simulation of Urban MObility
GUIEdge.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 /****************************************************************************/
20 // A road/street connecting two junctions (gui-version)
21 /****************************************************************************/
22 #ifndef GUIEdge_h
23 #define GUIEdge_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <vector>
36 #include <string>
37 #include <microsim/MSEdge.h>
41 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 class MESegment;
47 class MSBaseVehicle;
48 class GUILane;
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
59 class GUIEdge : public MSEdge, public GUIGlObject {
60 public:
66  GUIEdge(const std::string& id, int numericalID,
67  const SumoXMLEdgeFunc function,
68  const std::string& streetName, const std::string& edgeType, int priority);
69 
70 
72  ~GUIEdge();
73 
74 
75  /* @brief Returns the gl-ids of all known edges
76  * @param[in] includeInternal Whether to include ids of internal edges
77  */
78  static std::vector<GUIGlID> getIDs(bool includeInternal);
79 
80  /* @brief Returns the combined length of all edges
81  * @param[in] includeInternal Whether to include lengths of internal edges
82  * @param[in] eachLane Whether to count each lane separately
83  */
84  static double getTotalLength(bool includeInternal, bool eachLane);
85 
87  Boundary getBoundary() const;
88 
90  MSLane& getLane(int laneNo);
91 
92 
93 
97  static std::pair<double, double> getLaneOffsets(double x1, double y1,
98  double x2, double y2, double prev, double wanted);
99 
100 
102 
103 
112  GUISUMOAbstractView& parent);
113 
114 
123  GUISUMOAbstractView& parent);
124 
125 
132 
133 
138  void drawGL(const GUIVisualizationSettings& s) const;
140 
141 
142  void addPerson(MSTransportable* p) const {
145  }
146 
147  void removePerson(MSTransportable* p) const {
150  }
151 
152 
153  void addContainer(MSTransportable* c) const {
156  }
157 
161  }
162 
163  int getVehicleNo() const;
164  std::string getVehicleIDs() const;
165  double getBruttoOccupancy() const;
166  double getAllowedSpeed() const;
168  double getFlow() const;
170  double getRelativeSpeed() const;
171 
173  void setColor(const GUIVisualizationSettings& s) const;
174 
176  bool setFunctionalColor(int activeScheme) const;
177 
179  bool setMultiColor(const GUIColorer& c) const;
180 
182  double getColorValue(int activeScheme) const;
183 
185  double getScaleValue(int activeScheme) const;
186 
189 
190  void drawMesoVehicles(const GUIVisualizationSettings& s) const;
191 
193  void lock() const {
194  myLock.lock();
195  }
196 
198  void unlock() const {
199  myLock.unlock();
200  }
201 
203  void closeTraffic(const GUILane* lane);
204 
206  void addRerouter();
207 
209  const std::vector<RGBColor>& getSegmentColors() const {
210  return mySegmentColors;
211  }
212 
214  return myMesoColor;
215  }
216 
218  mutable std::vector<RGBColor> mySegmentColors;
219 
220 
221 
222 private:
224  GUIEdge(const GUIEdge& s);
225 
227  GUIEdge& operator=(const GUIEdge& s);
228 
229 
230 private:
232  mutable MFXMutex myLock;
233 
235 
236 };
237 
238 
239 #endif
240 
241 /****************************************************************************/
242 
int getVehicleNo() const
Definition: GUIEdge.cpp:335
static std::pair< double, double > getLaneOffsets(double x1, double y1, double x2, double y2, double prev, double wanted)
void lock() const
grant exclusive access to the mesoscopic state
Definition: GUIEdge.h:193
RGBColor myMesoColor
Definition: GUIEdge.h:234
RGBColor getMesoColor() const
Definition: GUIEdge.h:213
double getBruttoOccupancy() const
Definition: GUIEdge.cpp:370
double getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUIEdge.cpp:491
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIEdge.cpp:152
void addPerson(MSTransportable *p) const
Definition: GUIEdge.h:142
std::vector< RGBColor > mySegmentColors
The color of the segments (cached)
Definition: GUIEdge.h:218
Stores the information about how to visualize structures.
Boundary getBoundary() const
Returns the street&#39;s geometry.
Definition: GUIEdge.cpp:124
void removePerson(MSTransportable *p) const
Definition: GUIEdge.h:147
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:55
void drawMesoVehicles(const GUIVisualizationSettings &s) const
Definition: GUIEdge.cpp:286
std::string getVehicleIDs() const
Definition: GUIEdge.cpp:345
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIEdge.cpp:203
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:47
const std::vector< RGBColor > & getSegmentColors() const
return segment colors (meso)
Definition: GUIEdge.h:209
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:69
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some edge function
Definition: GUIEdge.cpp:402
MSLane & getLane(int laneNo)
returns the enumerated lane (!!! why not private with a friend?)
Definition: GUIEdge.cpp:88
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:59
A road/street connecting two junctions.
Definition: MSEdge.h:80
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIEdge.cpp:392
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIEdge.cpp:465
~GUIEdge()
Destructor.
Definition: GUIEdge.cpp:79
double getAllowedSpeed() const
Definition: GUIEdge.cpp:380
GUIEdge & operator=(const GUIEdge &s)
invalidated assignment operator
void unlock() const
release exclusive access to the mesoscopic state
Definition: GUIEdge.h:198
void closeTraffic(const GUILane *lane)
close this edge for traffic
Definition: GUIEdge.cpp:522
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIEdge.cpp:213
virtual void addPerson(MSTransportable *p) const
Definition: MSEdge.h:595
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIEdge.cpp:169
virtual void removePerson(MSTransportable *p) const
Definition: MSEdge.h:599
void addRerouter()
add a rerouter
Definition: GUIEdge.cpp:536
virtual void removeContainer(MSTransportable *container) const
Remove container from myContainers.
Definition: MSEdge.h:612
double getRelativeSpeed() const
return meanSpead divided by allowedSpeed
Definition: GUIEdge.cpp:386
void removeContainer(MSTransportable *c) const
Remove container from myContainers.
Definition: GUIEdge.h:158
void unlock()
release mutex lock
Definition: MFXMutex.cpp:93
static std::vector< GUIGlID > getIDs(bool includeInternal)
Definition: GUIEdge.cpp:95
MESegment * getSegmentAtPosition(const Position &pos)
returns the segment closest to the given position
Definition: GUIEdge.cpp:513
void addContainer(MSTransportable *c) const
Add a container to myContainers.
Definition: GUIEdge.h:153
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and edge function
Definition: GUIEdge.cpp:417
virtual void addContainer(MSTransportable *container) const
Add a container to myContainers.
Definition: MSEdge.h:607
MFXMutex myLock
The mutex used to avoid concurrent updates of myPersons/ myContainers.
Definition: GUIEdge.h:232
A mutex encapsulator which locks/unlocks the given mutex on construction/destruction, respectively.
Definition: AbstractMutex.h:70
A single mesoscopic segment (cell)
Definition: MESegment.h:56
The popup menu of a globject.
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
void lock()
lock mutex
Definition: MFXMutex.cpp:83
GUIEdge(const std::string &id, int numericalID, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, int priority)
Constructor.
Definition: GUIEdge.cpp:72
static double getTotalLength(bool includeInternal, bool eachLane)
Definition: GUIEdge.cpp:110
double getFlow() const
return flow based on meanSpead
Definition: GUIEdge.cpp:360
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
A window containing a gl-object&#39;s parameter.