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 EdgeBasicFunction 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  static void fill(std::vector<GUIEdge*>& netsWrappers);
102 
103 
104 
106 
107 
116  GUISUMOAbstractView& parent);
117 
118 
127  GUISUMOAbstractView& parent);
128 
129 
136 
137 
142  void drawGL(const GUIVisualizationSettings& s) const;
144 
145 
146  void addPerson(MSTransportable* p) const {
149  }
150 
151  void removePerson(MSTransportable* p) const {
154  }
155 
156 
157  void addContainer(MSTransportable* c) const {
160  }
161 
165  }
166 
167  int getVehicleNo() const;
168  std::string getVehicleIDs() const;
169  double getBruttoOccupancy() const;
170  double getAllowedSpeed() const;
172  double getFlow() const;
174  double getRelativeSpeed() const;
175 
177  void setColor(const GUIVisualizationSettings& s) const;
178 
180  bool setFunctionalColor(int activeScheme) const;
181 
183  bool setMultiColor(const GUIColorer& c) const;
184 
186  double getColorValue(int activeScheme) const;
187 
189  double getScaleValue(int activeScheme) const;
190 
193 
194  void drawMesoVehicles(const GUIVisualizationSettings& s) const;
195 
197  void lock() const {
198  myLock.lock();
199  }
200 
202  void unlock() const {
203  myLock.unlock();
204  }
205 
207  void closeTraffic(const GUILane* lane);
208 
210  void addRerouter();
211 
213  const std::vector<RGBColor>& getSegmentColors() const {
214  return mySegmentColors;
215  }
216 
218  return myMesoColor;
219  }
220 
222  mutable std::vector<RGBColor> mySegmentColors;
223 
224 
225 
226 private:
228  GUIEdge(const GUIEdge& s);
229 
231  GUIEdge& operator=(const GUIEdge& s);
232 
233 
234 private:
236  mutable MFXMutex myLock;
237 
239 
240 };
241 
242 
243 #endif
244 
245 /****************************************************************************/
246 
int getVehicleNo() const
Definition: GUIEdge.cpp:350
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:197
RGBColor myMesoColor
Definition: GUIEdge.h:238
RGBColor getMesoColor() const
Definition: GUIEdge.h:217
double getBruttoOccupancy() const
Definition: GUIEdge.cpp:385
double getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUIEdge.cpp:506
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIEdge.cpp:167
void addPerson(MSTransportable *p) const
Definition: GUIEdge.h:146
std::vector< RGBColor > mySegmentColors
The color of the segments (cached)
Definition: GUIEdge.h:222
Stores the information about how to visualize structures.
Boundary getBoundary() const
Returns the street&#39;s geometry.
Definition: GUIEdge.cpp:126
void removePerson(MSTransportable *p) const
Definition: GUIEdge.h:151
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:56
EdgeBasicFunction
Defines possible edge types.
Definition: MSEdge.h:89
void drawMesoVehicles(const GUIVisualizationSettings &s) const
Definition: GUIEdge.cpp:301
std::string getVehicleIDs() const
Definition: GUIEdge.cpp:360
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIEdge.cpp:218
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
const std::vector< RGBColor > & getSegmentColors() const
return segment colors (meso)
Definition: GUIEdge.h:213
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:70
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some edge function
Definition: GUIEdge.cpp:417
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:80
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIEdge.cpp:407
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIEdge.cpp:480
~GUIEdge()
Destructor.
Definition: GUIEdge.cpp:81
double getAllowedSpeed() const
Definition: GUIEdge.cpp:395
GUIEdge & operator=(const GUIEdge &s)
invalidated assignment operator
void unlock() const
release exclusive access to the mesoscopic state
Definition: GUIEdge.h:202
void closeTraffic(const GUILane *lane)
close this edge for traffic
Definition: GUIEdge.cpp:537
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIEdge.cpp:228
virtual void addPerson(MSTransportable *p) const
Definition: MSEdge.h:612
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIEdge.cpp:184
virtual void removePerson(MSTransportable *p) const
Definition: MSEdge.h:616
void addRerouter()
add a rerouter
Definition: GUIEdge.cpp:551
virtual void removeContainer(MSTransportable *container) const
Remove container from myContainers.
Definition: MSEdge.h:629
double getRelativeSpeed() const
return meanSpead divided by allowedSpeed
Definition: GUIEdge.cpp:401
void removeContainer(MSTransportable *c) const
Remove container from myContainers.
Definition: GUIEdge.h:162
void unlock()
release mutex lock
Definition: MFXMutex.cpp:92
GUIEdge(const std::string &id, int numericalID, const EdgeBasicFunction function, const std::string &streetName, const std::string &edgeType, int priority)
Constructor.
Definition: GUIEdge.cpp:74
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:528
void addContainer(MSTransportable *c) const
Add a container to myContainers.
Definition: GUIEdge.h:157
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and edge function
Definition: GUIEdge.cpp:432
virtual void addContainer(MSTransportable *container) const
Add a container to myContainers.
Definition: MSEdge.h:624
MFXMutex myLock
The mutex used to avoid concurrent updates of myPersons/ myContainers.
Definition: GUIEdge.h:236
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
The popup menu of a globject.
void lock()
lock mutex
Definition: MFXMutex.cpp:82
static void fill(std::vector< GUIEdge *> &netsWrappers)
Definition: GUIEdge.cpp:154
static double getTotalLength(bool includeInternal, bool eachLane)
Definition: GUIEdge.cpp:112
double getFlow() const
return flow based on meanSpead
Definition: GUIEdge.cpp:375
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
A window containing a gl-object&#39;s parameter.