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-2015 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>
41 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 #ifdef HAVE_INTERNAL
47 class MESegment;
48 #endif
49 class MSBaseVehicle;
50 class GUILane;
51 
52 
53 // ===========================================================================
54 // class definitions
55 // ===========================================================================
62 class GUIEdge : public MSEdge, public GUIGlObject {
63 public:
69  GUIEdge(const std::string& id, int numericalID,
70  const EdgeBasicFunction function,
71  const std::string& streetName, const std::string& edgeType, int priority);
72 
73 
75  ~GUIEdge();
76 
77 
78  /* @brief Returns the gl-ids of all known edges
79  * @param[in] includeInternal Whether to include ids of internal edges
80  */
81  static std::vector<GUIGlID> getIDs(bool includeInternal);
82 
83  /* @brief Returns the combined length of all edges
84  * @param[in] includeInternal Whether to include lengths of internal edges
85  * @param[in] eachLane Whether to count each lane separately
86  */
87  static SUMOReal getTotalLength(bool includeInternal, bool eachLane);
88 
90  Boundary getBoundary() const;
91 
93  MSLane& getLane(size_t laneNo);
94 
95 
96 
100  static std::pair<SUMOReal, SUMOReal> getLaneOffsets(SUMOReal x1, SUMOReal y1,
101  SUMOReal x2, SUMOReal y2, SUMOReal prev, SUMOReal wanted);
102 
103  static void fill(std::vector<GUIEdge*>& netsWrappers);
104 
105 
106 
108 
109 
118  GUISUMOAbstractView& parent);
119 
120 
129  GUISUMOAbstractView& parent);
130 
131 
138 
139 
144  void drawGL(const GUIVisualizationSettings& s) const;
146 
147 
148  void addPerson(MSTransportable* p) const {
151  }
152 
153  void removePerson(MSTransportable* p) const {
156  }
157 
158 
159  void addContainer(MSTransportable* c) const {
162  }
163 
167  }
168 
169 #ifdef HAVE_INTERNAL
170  unsigned int getVehicleNo() const;
171  std::string getVehicleIDs() const;
172  SUMOReal getBruttoOccupancy() const;
173  SUMOReal getMeanSpeed() const;
174  SUMOReal getAllowedSpeed() const;
176  SUMOReal getFlow() const;
178  SUMOReal getRelativeSpeed() const;
179 
181  void setColor(const GUIVisualizationSettings& s) const;
182 
184  SUMOReal getColorValue(size_t activeScheme) const;
185 
187  SUMOReal getScaleValue(size_t activeScheme) const;
188 
190  MESegment* getSegmentAtPosition(const Position& pos);
191 
192  void drawMesoVehicles(const GUIVisualizationSettings& s) const;
193 
194 #endif
195 
197  void closeTraffic(const GUILane* lane);
198 
200  void addRerouter();
201 
202 private:
204  GUIEdge(const GUIEdge& s);
205 
207  GUIEdge& operator=(const GUIEdge& s);
208 
209 
210 private:
212  mutable MFXMutex myLock;
213 
214 };
215 
216 
217 #endif
218 
219 /****************************************************************************/
220 
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIEdge.cpp:208
static std::pair< SUMOReal, SUMOReal > getLaneOffsets(SUMOReal x1, SUMOReal y1, SUMOReal x2, SUMOReal y2, SUMOReal prev, SUMOReal wanted)
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIEdge.cpp:155
Stores the information about how to visualize structures.
virtual void addContainer(MSTransportable *container) const
Add a container to myContainers.
Definition: MSEdge.h:566
void addPerson(MSTransportable *p) const
Definition: GUIEdge.h:148
void removeContainer(MSTransportable *c) const
Remove container from myContainers.
Definition: GUIEdge.h:164
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:52
EdgeBasicFunction
Defines possible edge types.
Definition: MSEdge.h:90
static SUMOReal getTotalLength(bool includeInternal, bool eachLane)
Definition: GUIEdge.cpp:117
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:571
void addContainer(MSTransportable *c) const
Add a container to myContainers.
Definition: GUIEdge.h:159
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:70
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:62
A road/street connecting two junctions.
Definition: MSEdge.h:81
void removePerson(MSTransportable *p) const
Definition: GUIEdge.h:153
~GUIEdge()
Destructor.
Definition: GUIEdge.cpp:86
virtual void removePerson(MSTransportable *p) const
Definition: MSEdge.h:558
GUIEdge & operator=(const GUIEdge &s)
invalidated assignment operator
virtual void addPerson(MSTransportable *p) const
Definition: MSEdge.h:554
void closeTraffic(const GUILane *lane)
close this edge for traffic
Definition: GUIEdge.cpp:478
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:172
MSLane & getLane(size_t laneNo)
returns the enumerated lane (!!! why not private with a friend?)
Definition: GUIEdge.cpp:95
void addRerouter()
add a rerouter
Definition: GUIEdge.cpp:492
GUIEdge(const std::string &id, int numericalID, const EdgeBasicFunction function, const std::string &streetName, const std::string &edgeType, int priority)
Constructor.
Definition: GUIEdge.cpp:79
static std::vector< GUIGlID > getIDs(bool includeInternal)
Definition: GUIEdge.cpp:102
MFXMutex myLock
The mutex used to avoid concurrent updates of myPersons/ myContainers.
Definition: GUIEdge.h:212
A mutex encapsulator which locks/unlocks the given mutex on construction/destruction, respectively.
Definition: AbstractMutex.h:71
The popup menu of a globject.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIEdge.cpp:216
#define SUMOReal
Definition: config.h:214
Boundary getBoundary() const
Returns the street&#39;s geometry.
Definition: GUIEdge.cpp:131
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
A window containing a gl-object&#39;s parameter.
static void fill(std::vector< GUIEdge * > &netsWrappers)
Definition: GUIEdge.cpp:142