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 
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
61 class GUIEdge : public MSEdge, public GUIGlObject {
62 public:
68  GUIEdge(const std::string& id, int numericalID,
69  const EdgeBasicFunction function,
70  const std::string& streetName, const std::string& edgeType, int priority);
71 
72 
74  ~GUIEdge();
75 
76 
77  /* @brief Returns the gl-ids of all known edges
78  * @param[in] includeInternal Whether to include ids of internal edges
79  */
80  static std::vector<GUIGlID> getIDs(bool includeInternal);
81 
82  /* @brief Returns the combined length of all edges
83  * @param[in] includeInternal Whether to include lengths of internal edges
84  * @param[in] eachLane Whether to count each lane separately
85  */
86  static SUMOReal getTotalLength(bool includeInternal, bool eachLane);
87 
89  Boundary getBoundary() const;
90 
92  MSLane& getLane(size_t laneNo);
93 
94 
95 
99  static std::pair<SUMOReal, SUMOReal> getLaneOffsets(SUMOReal x1, SUMOReal y1,
100  SUMOReal x2, SUMOReal y2, SUMOReal prev, SUMOReal wanted);
101 
102  static void fill(std::vector<GUIEdge*>& netsWrappers);
103 
104 
105 
107 
108 
117  GUISUMOAbstractView& parent);
118 
119 
128  GUISUMOAbstractView& parent);
129 
130 
137 
138 
143  void drawGL(const GUIVisualizationSettings& s) const;
145 
146 
147  void addPerson(MSPerson* p) const {
150  }
151 
152  void removePerson(MSPerson* p) const {
155  }
156 
157 
158  void addContainer(MSContainer* c) const {
161  }
162 
163  void removeContainer(MSContainer* c) const {
166  }
167 
168 #ifdef HAVE_INTERNAL
169  unsigned int getVehicleNo() const;
170  std::string getVehicleIDs() const;
171  SUMOReal getBruttoOccupancy() const;
172  SUMOReal getMeanSpeed() const;
173  SUMOReal getAllowedSpeed() const;
175  SUMOReal getFlow() const;
177  SUMOReal getRelativeSpeed() const;
178 
180  void setColor(const GUIVisualizationSettings& s) const;
181 
183  SUMOReal getColorValue(size_t activeScheme) const;
184 
186  SUMOReal getScaleValue(size_t activeScheme) const;
187 
189  MESegment* getSegmentAtPosition(const Position& pos);
190 
192  void setVehicleColor(const GUIVisualizationSettings& s, MSBaseVehicle* veh) const;
193 
195  SUMOReal getVehicleColorValue(size_t activeScheme, MSBaseVehicle* veh) const;
196 
197  void drawMesoVehicles(const GUIVisualizationSettings& s) const;
198 
199 #endif
200 
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:206
virtual void addContainer(MSContainer *container) const
Add a container to myContainers.
Definition: MSEdge.h:568
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:153
void addContainer(MSContainer *c) const
Add a container to myContainers.
Definition: GUIEdge.h:158
Stores the information about how to visualize structures.
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:115
void removePerson(MSPerson *p) const
Definition: GUIEdge.h:152
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
virtual void removeContainer(MSContainer *container) const
Remove container from myContainers.
Definition: MSEdge.h:573
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:61
A road/street connecting two junctions.
Definition: MSEdge.h:81
~GUIEdge()
Destructor.
Definition: GUIEdge.cpp:84
GUIEdge & operator=(const GUIEdge &s)
invalidated assignment operator
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:170
virtual void removePerson(MSPerson *p) const
Definition: MSEdge.h:560
MSLane & getLane(size_t laneNo)
returns the enumerated lane (!!! why not private with a friend?)
Definition: GUIEdge.cpp:93
virtual void addPerson(MSPerson *p) const
Definition: MSEdge.h:556
GUIEdge(const std::string &id, int numericalID, const EdgeBasicFunction function, const std::string &streetName, const std::string &edgeType, int priority)
Constructor.
Definition: GUIEdge.cpp:77
static std::vector< GUIGlID > getIDs(bool includeInternal)
Definition: GUIEdge.cpp:100
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:214
void removeContainer(MSContainer *c) const
Remove container from myContainers.
Definition: GUIEdge.h:163
#define SUMOReal
Definition: config.h:218
Boundary getBoundary() const
Returns the street's geometry.
Definition: GUIEdge.cpp:129
void addPerson(MSPerson *p) const
Definition: GUIEdge.h:147
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
A window containing a gl-object's parameter.
static void fill(std::vector< GUIEdge * > &netsWrappers)
Definition: GUIEdge.cpp:140