Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // A road/street connecting two junctions (gui-version)
18 /****************************************************************************/
19 #ifndef GUIEdge_h
20 #define GUIEdge_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <vector>
29 #include <string>
30 #include <fx.h>
31 #include <microsim/MSEdge.h>
34 
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
39 class MESegment;
40 class MSBaseVehicle;
41 class GUILane;
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
52 class GUIEdge : public MSEdge, public GUIGlObject {
53 public:
59  GUIEdge(const std::string& id, int numericalID,
60  const SumoXMLEdgeFunc function,
61  const std::string& streetName, const std::string& edgeType, int priority,
62  double distance);
63 
64 
66  ~GUIEdge();
67 
68 
69  /* @brief Returns the gl-ids of all known edges
70  * @param[in] includeInternal Whether to include ids of internal edges
71  */
72  static std::vector<GUIGlID> getIDs(bool includeInternal);
73 
74  /* @brief Returns the combined length of all edges
75  * @param[in] includeInternal Whether to include lengths of internal edges
76  * @param[in] eachLane Whether to count each lane separately
77  */
78  static double getTotalLength(bool includeInternal, bool eachLane);
79 
81  Boundary getBoundary() const;
82 
84  MSLane& getLane(int laneNo);
85 
86 
87 
91  static std::pair<double, double> getLaneOffsets(double x1, double y1,
92  double x2, double y2, double prev, double wanted);
93 
94 
96 
97 
106  GUISUMOAbstractView& parent);
107 
108 
117  GUISUMOAbstractView& parent);
118 
119 
126 
128  const std::string getOptionalName() const;
129 
134  void drawGL(const GUIVisualizationSettings& s) const;
136 
137 
138  void addPerson(MSTransportable* p) const {
139  FXMutexLock locker(myLock);
141  }
142 
143  void removePerson(MSTransportable* p) const {
144  FXMutexLock locker(myLock);
146  }
147 
148 
149  void addContainer(MSTransportable* c) const {
150  FXMutexLock locker(myLock);
152  }
153 
155  FXMutexLock locker(myLock);
157  }
158 
159  int getVehicleNo() const;
160  std::string getVehicleIDs() const;
161  double getBruttoOccupancy() const;
162  double getAllowedSpeed() const;
164  double getFlow() const;
166  double getRelativeSpeed() const;
167 
169  void setColor(const GUIVisualizationSettings& s) const;
170 
172  bool setFunctionalColor(const GUIColorer& c) const;
173 
175  bool setMultiColor(const GUIColorer& c) const;
176 
178  double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const;
179 
181  double getScaleValue(int activeScheme) const;
182 
185 
186  void drawMesoVehicles(const GUIVisualizationSettings& s) const;
187 
189  void lock() const {
190  myLock.lock();
191  }
192 
194  void unlock() const {
195  myLock.unlock();
196  }
197 
199  void closeTraffic(const GUILane* lane);
200 
202  void addRerouter();
203 
205  const std::vector<RGBColor>& getSegmentColors() const {
206  return mySegmentColors;
207  }
208 
210  return myMesoColor;
211  }
212 
214  bool isSelected() const;
215 
217  mutable std::vector<RGBColor> mySegmentColors;
218 
219 
220 
221 private:
223  GUIEdge(const GUIEdge& s);
224 
226  GUIEdge& operator=(const GUIEdge& s);
227 
228 
229 private:
231  mutable FXMutex myLock;
232 
234 
235 };
236 
237 
238 #endif
239 
240 /****************************************************************************/
241 
GUIGlObject.h
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:62
GUIEdge::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIEdge.cpp:198
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
MESegment
A single mesoscopic segment (cell)
Definition: MESegment.h:49
GUIEdge::removePerson
void removePerson(MSTransportable *p) const
Definition: GUIEdge.h:143
GUIEdge::setColor
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIEdge.cpp:413
GUIEdge::drawMesoVehicles
void drawMesoVehicles(const GUIVisualizationSettings &s) const
Definition: GUIEdge.cpp:307
GUIEdge::myMesoColor
RGBColor myMesoColor
Definition: GUIEdge.h:233
GUIEdge::getFlow
double getFlow() const
return flow based on meanSpead
Definition: GUIEdge.cpp:381
GUIEdge::getSegmentColors
const std::vector< RGBColor > & getSegmentColors() const
return segment colors (meso)
Definition: GUIEdge.h:205
SumoXMLEdgeFunc
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
Definition: SUMOXMLDefinitions.h:1079
GUIEdge::getLane
MSLane & getLane(int laneNo)
returns the enumerated lane (!!! why not private with a friend?)
Definition: GUIEdge.cpp:82
GUIEdge::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIEdge.cpp:212
MSEdge::addPerson
virtual void addPerson(MSTransportable *p) const
Definition: MSEdge.h:616
MSEdge.h
GUIEdge::getColorValue
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIEdge.cpp:493
GUIEdge::getVehicleNo
int getVehicleNo() const
Definition: GUIEdge.cpp:356
GUIEdge::getScaleValue
double getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUIEdge.cpp:519
MSTransportable
Definition: MSTransportable.h:58
GUIEdge::lock
void lock() const
grant exclusive access to the mesoscopic state
Definition: GUIEdge.h:189
GUIEdge::~GUIEdge
~GUIEdge()
Destructor.
Definition: GUIEdge.cpp:73
GUIEdge::getAllowedSpeed
double getAllowedSpeed() const
Definition: GUIEdge.cpp:401
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
GUIEdge::operator=
GUIEdge & operator=(const GUIEdge &s)
invalidated assignment operator
GUIEdge::closeTraffic
void closeTraffic(const GUILane *lane)
close this edge for traffic
Definition: GUIEdge.cpp:550
GUIEdge::addRerouter
void addRerouter()
add a rerouter
Definition: GUIEdge.cpp:567
RGBColor
Definition: RGBColor.h:39
GUIEdge::getSegmentAtPosition
MESegment * getSegmentAtPosition(const Position &pos)
returns the segment closest to the given position
Definition: GUIEdge.cpp:541
GUIEdge::GUIEdge
GUIEdge(const std::string &id, int numericalID, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, int priority, double distance)
Constructor.
Definition: GUIEdge.cpp:65
GUIEdge::setMultiColor
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and edge function
Definition: GUIEdge.cpp:445
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GUIEdge::getRelativeSpeed
double getRelativeSpeed() const
return meanSpead divided by allowedSpeed
Definition: GUIEdge.cpp:407
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
GUIEdge::getVehicleIDs
std::string getVehicleIDs() const
Definition: GUIEdge.cpp:366
GUIGlObject
Definition: GUIGlObject.h:65
GUIEdge::getOptionalName
const std::string getOptionalName() const
Returns the street name.
Definition: GUIEdge.cpp:207
MSEdge::removeContainer
virtual void removeContainer(MSTransportable *container) const
Remove container from myContainers.
Definition: MSEdge.h:633
GUIEdge::unlock
void unlock() const
release exclusive access to the mesoscopic state
Definition: GUIEdge.h:194
MSEdge::removePerson
virtual void removePerson(MSTransportable *p) const
Definition: MSEdge.h:620
GUIEdge::myLock
FXMutex myLock
The mutex used to avoid concurrent updates of myPersons/ myContainers.
Definition: GUIEdge.h:231
GUIEdge::setFunctionalColor
bool setFunctionalColor(const GUIColorer &c) const
sets the color according to the current scheme index and some edge function
Definition: GUIEdge.cpp:423
GUILane
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:61
GUIEdge::getParameterWindow
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIEdge.cpp:163
GUIMainWindow
Definition: GUIMainWindow.h:46
GUIEdge
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:52
GUIPropertySchemeStorage.h
MSEdge::addContainer
virtual void addContainer(MSTransportable *container) const
Add a container to myContainers.
Definition: MSEdge.h:628
GUIEdge::getTotalLength
static double getTotalLength(bool includeInternal, bool eachLane)
Definition: GUIEdge.cpp:104
MSBaseVehicle
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:51
GUIEdge::getBruttoOccupancy
double getBruttoOccupancy() const
Definition: GUIEdge.cpp:391
GUIEdge::removeContainer
void removeContainer(MSTransportable *c) const
Remove container from myContainers.
Definition: GUIEdge.h:154
config.h
GUIEdge::getIDs
static std::vector< GUIGlID > getIDs(bool includeInternal)
Definition: GUIEdge.cpp:89
GUIEdge::getLaneOffsets
static std::pair< double, double > getLaneOffsets(double x1, double y1, double x2, double y2, double prev, double wanted)
GUIEdge::addPerson
void addPerson(MSTransportable *p) const
Definition: GUIEdge.h:138
GUIEdge::getMesoColor
RGBColor getMesoColor() const
Definition: GUIEdge.h:209
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
GUIEdge::mySegmentColors
std::vector< RGBColor > mySegmentColors
The color of the segments (cached)
Definition: GUIEdge.h:217
GUIEdge::isSelected
bool isSelected() const
whether this lane is selected in the GUI
Definition: GUIEdge.cpp:594
GUIEdge::addContainer
void addContainer(MSTransportable *c) const
Add a container to myContainers.
Definition: GUIEdge.h:149
GUIEdge::getPopUpMenu
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIEdge.cpp:146
GUIEdge::getBoundary
Boundary getBoundary() const
Returns the street's geometry.
Definition: GUIEdge.cpp:118
GUIPropertySchemeStorage< GUIColorScheme >