SUMO - Simulation of Urban MObility
GUIEdge.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // A road/street connecting two junctions (gui-version)
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef GUIEdge_h
24 #define GUIEdge_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <vector>
37 #include <string>
38 #include <microsim/MSEdge.h>
42 
43 
44 // ===========================================================================
45 // class declarations
46 // ===========================================================================
47 class MESegment;
48 class MSBaseVehicle;
49 class GUILane;
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
60 class GUIEdge : public MSEdge, public GUIGlObject {
61 public:
67  GUIEdge(const std::string& id, int numericalID,
68  const SumoXMLEdgeFunc function,
69  const std::string& streetName, const std::string& edgeType, int priority);
70 
71 
73  ~GUIEdge();
74 
75 
76  /* @brief Returns the gl-ids of all known edges
77  * @param[in] includeInternal Whether to include ids of internal edges
78  */
79  static std::vector<GUIGlID> getIDs(bool includeInternal);
80 
81  /* @brief Returns the combined length of all edges
82  * @param[in] includeInternal Whether to include lengths of internal edges
83  * @param[in] eachLane Whether to count each lane separately
84  */
85  static double getTotalLength(bool includeInternal, bool eachLane);
86 
88  Boundary getBoundary() const;
89 
91  MSLane& getLane(int laneNo);
92 
93 
94 
98  static std::pair<double, double> getLaneOffsets(double x1, double y1,
99  double x2, double y2, double prev, double wanted);
100 
101 
103 
104 
113  GUISUMOAbstractView& parent);
114 
115 
124  GUISUMOAbstractView& parent);
125 
126 
133 
134 
139  void drawGL(const GUIVisualizationSettings& s) const;
141 
142 
143  void addPerson(MSTransportable* p) const {
146  }
147 
148  void removePerson(MSTransportable* p) const {
151  }
152 
153 
154  void addContainer(MSTransportable* c) const {
157  }
158 
162  }
163 
164  int getVehicleNo() const;
165  std::string getVehicleIDs() const;
166  double getBruttoOccupancy() const;
167  double getAllowedSpeed() const;
169  double getFlow() const;
171  double getRelativeSpeed() const;
172 
174  void setColor(const GUIVisualizationSettings& s) const;
175 
177  bool setFunctionalColor(int activeScheme) const;
178 
180  bool setMultiColor(const GUIColorer& c) const;
181 
183  double getColorValue(int activeScheme) const;
184 
186  double getScaleValue(int activeScheme) const;
187 
190 
191  void drawMesoVehicles(const GUIVisualizationSettings& s) const;
192 
194  void lock() const {
195  myLock.lock();
196  }
197 
199  void unlock() const {
200  myLock.unlock();
201  }
202 
204  void closeTraffic(const GUILane* lane);
205 
207  void addRerouter();
208 
210  const std::vector<RGBColor>& getSegmentColors() const {
211  return mySegmentColors;
212  }
213 
215  return myMesoColor;
216  }
217 
219  mutable std::vector<RGBColor> mySegmentColors;
220 
221 
222 
223 private:
225  GUIEdge(const GUIEdge& s);
226 
228  GUIEdge& operator=(const GUIEdge& s);
229 
230 
231 private:
233  mutable MFXMutex myLock;
234 
236 
237 };
238 
239 
240 #endif
241 
242 /****************************************************************************/
243 
static std::pair< double, double > getLaneOffsets(double x1, double y1, double x2, double y2, double prev, double wanted)
RGBColor myMesoColor
Definition: GUIEdge.h:235
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIEdge.cpp:205
double getRelativeSpeed() const
return meanSpead divided by allowedSpeed
Definition: GUIEdge.cpp:388
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIEdge.cpp:154
double getAllowedSpeed() const
Definition: GUIEdge.cpp:382
std::vector< RGBColor > mySegmentColors
The color of the segments (cached)
Definition: GUIEdge.h:219
Stores the information about how to visualize structures.
virtual void addContainer(MSTransportable *container) const
Add a container to myContainers.
Definition: MSEdge.h:608
double getBruttoOccupancy() const
Definition: GUIEdge.cpp:372
void addPerson(MSTransportable *p) const
Definition: GUIEdge.h:143
void lock() const
grant exclusive access to the mesoscopic state
Definition: GUIEdge.h:194
void removeContainer(MSTransportable *c) const
Remove container from myContainers.
Definition: GUIEdge.h:159
double getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUIEdge.cpp:493
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:56
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
virtual void removeContainer(MSTransportable *container) const
Remove container from myContainers.
Definition: MSEdge.h:613
void addContainer(MSTransportable *c) const
Add a container to myContainers.
Definition: GUIEdge.h:154
RGBColor getMesoColor() const
Definition: GUIEdge.h:214
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:70
MSLane & getLane(int laneNo)
returns the enumerated lane (!!! why not private with a friend?)
Definition: GUIEdge.cpp:90
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:60
A road/street connecting two junctions.
Definition: MSEdge.h:81
void removePerson(MSTransportable *p) const
Definition: GUIEdge.h:148
~GUIEdge()
Destructor.
Definition: GUIEdge.cpp:81
virtual void removePerson(MSTransportable *p) const
Definition: MSEdge.h:600
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and edge function
Definition: GUIEdge.cpp:419
GUIEdge & operator=(const GUIEdge &s)
invalidated assignment operator
virtual void addPerson(MSTransportable *p) const
Definition: MSEdge.h:596
void closeTraffic(const GUILane *lane)
close this edge for traffic
Definition: GUIEdge.cpp:524
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIEdge.cpp:171
int getVehicleNo() const
Definition: GUIEdge.cpp:337
void addRerouter()
add a rerouter
Definition: GUIEdge.cpp:538
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some edge function
Definition: GUIEdge.cpp:404
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIEdge.cpp:394
void drawMesoVehicles(const GUIVisualizationSettings &s) const
Definition: GUIEdge.cpp:288
void unlock()
release mutex lock
Definition: MFXMutex.cpp:94
static std::vector< GUIGlID > getIDs(bool includeInternal)
Definition: GUIEdge.cpp:97
MESegment * getSegmentAtPosition(const Position &pos)
returns the segment closest to the given position
Definition: GUIEdge.cpp:515
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIEdge.cpp:467
MFXMutex myLock
The mutex used to avoid concurrent updates of myPersons/ myContainers.
Definition: GUIEdge.h:233
A mutex encapsulator which locks/unlocks the given mutex on construction/destruction, respectively.
Definition: AbstractMutex.h:71
A single mesoscopic segment (cell)
Definition: MESegment.h:57
double getFlow() const
return flow based on meanSpead
Definition: GUIEdge.cpp:362
The popup menu of a globject.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIEdge.cpp:215
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
void lock()
lock mutex
Definition: MFXMutex.cpp:84
const std::vector< RGBColor > & getSegmentColors() const
return segment colors (meso)
Definition: GUIEdge.h:210
std::string getVehicleIDs() const
Definition: GUIEdge.cpp:347
GUIEdge(const std::string &id, int numericalID, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, int priority)
Constructor.
Definition: GUIEdge.cpp:74
Boundary getBoundary() const
Returns the street&#39;s geometry.
Definition: GUIEdge.cpp:126
static double getTotalLength(bool includeInternal, bool eachLane)
Definition: GUIEdge.cpp:112
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
A window containing a gl-object&#39;s parameter.
void unlock() const
release exclusive access to the mesoscopic state
Definition: GUIEdge.h:199