SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GUILane.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Representation of a lane in the micro simulation (gui-version)
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef GUILane_h
23 #define GUILane_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <fx.h>
36 #include <string>
37 #include <utility>
38 #include <microsim/MSLane.h>
39 #include <microsim/MSEdge.h>
41 #include <utils/geom/Position.h>
45 
46 
47 // ===========================================================================
48 // class declarations
49 // ===========================================================================
50 class GUINet;
51 class MSVehicle;
52 class MSNet;
53 #ifdef HAVE_OSG
54 namespace osg {
55 class Geometry;
56 }
57 #endif
58 
59 // ===========================================================================
60 // class definitions
61 // ===========================================================================
70 class GUILane : public MSLane, public GUIGlObject {
71 public:
85  GUILane(const std::string& id, SUMOReal maxSpeed,
86  SUMOReal length, MSEdge* const edge, unsigned int numericalID,
87  const PositionVector& shape, SUMOReal width,
88  SVCPermissions permissions, unsigned int index);
89 
90 
92  ~GUILane();
93 
94 
95 
98 
108  const VehCont& getVehiclesSecure() const;
109 
110 
116  void releaseVehicles() const;
118 
119 
120 
123 
126  void planMovements(const SUMOTime t);
127 
130  bool executeMovements(SUMOTime t, std::vector<MSLane*>& into);
131 
136 
137 
140  void detectCollisions(SUMOTime timestep, const std::string& stage);
141 
142 
145  MSVehicle* removeVehicle(MSVehicle* remVehicle, MSMoveReminder::Notification notification, bool notify);
146 
147 
148 
150 
151 
160  GUISUMOAbstractView& parent);
161 
162 
171  GUISUMOAbstractView& parent);
172 
173 
180 
181 
186  void drawGL(const GUIVisualizationSettings& s) const;
188 
189 
190 
191  const PositionVector& getShape() const;
192  const std::vector<SUMOReal>& getShapeRotations() const;
193  const std::vector<SUMOReal>& getShapeLengths() const;
194 
195  SUMOReal firstWaitingTime() const;
196 
198  void drawMarkings(const GUIVisualizationSettings& s, SUMOReal scale) const;
199 
201  void drawBikeMarkings() const;
202 
204  void drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const;
205 
207  return myHalfLaneWidth;
208  }
209 
210 
211  SUMOReal getEdgeLaneNumber() const;
212 
216 
220 
221 #ifdef HAVE_OSG
222  void setGeometry(osg::Geometry* geom) {
223  myGeom = geom;
224  }
225 
226  void updateColor(const GUIVisualizationSettings& s);
227 #endif
228 protected:
231 
243  virtual void incorporateVehicle(MSVehicle* veh, SUMOReal pos, SUMOReal speed,
244  const MSLane::VehCont::iterator& at,
246 
247 private:
249  void drawLinkNo() const;
250  void drawTLSLinkNo(const GUINet& net) const;
251  void drawTextAtEnd(const std::string& text, const PositionVector& shape, SUMOReal x) const;
252  void drawLinkRules(const GUIVisualizationSettings& s, const GUINet& net) const;
253  void drawLinkRule(const GUIVisualizationSettings& s, const GUINet& net, MSLink* link, const PositionVector& shape, SUMOReal x1, SUMOReal x2) const;
254  void drawArrows() const;
255  void drawLane2LaneConnections() const;
256 
257 
258 
259 private:
261  SUMOReal getColorValue(size_t activeScheme) const;
262 
264  SUMOReal getScaleValue(size_t activeScheme) const;
265 
267  bool setFunctionalColor(size_t activeScheme) const;
268 
270  bool setMultiColor(const GUIColorer& c) const;
271 
273  void setColor(const GUIVisualizationSettings& s) const;
274 
276  bool drawAsRailway(const GUIVisualizationSettings& s) const;
277 
279  bool drawAsWaterway(const GUIVisualizationSettings& s) const;
280 
282  std::vector<SUMOReal> myShapeRotations;
283 
285  std::vector<SUMOReal> myShapeLengths;
286 
288  mutable std::vector<RGBColor> myShapeColors;
289 
292 
295 
297  unsigned int myIndex;
298 
299 #ifdef HAVE_OSG
300  osg::Geometry* myGeom;
301 #endif
302 
303 
304 private:
306  mutable MFXMutex myLock;
307 
308 
309 };
310 
311 
312 #endif
313 
314 /****************************************************************************/
315 
void drawLane2LaneConnections() const
Definition: GUILane.cpp:387
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition: GUILane.h:288
const std::vector< SUMOReal > & getShapeRotations() const
Definition: GUILane.cpp:705
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
SUMOReal getScaleValue(size_t activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUILane.cpp:888
SUMOReal getLoadedEdgeWeight() const
Returns the loaded weight (effort) for the edge of this lane.
Definition: GUILane.cpp:742
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUILane.cpp:755
void drawLinkRules(const GUIVisualizationSettings &s, const GUINet &net) const
Definition: GUILane.cpp:243
~GUILane()
Destructor.
Definition: GUILane.cpp:94
unsigned int myIndex
The lane index.
Definition: GUILane.h:297
Stores the information about how to visualize structures.
int SVCPermissions
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:88
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUILane.cpp:406
Notification
Definition of a vehicle state.
void drawTextAtEnd(const std::string &text, const PositionVector &shape, SUMOReal x) const
Definition: GUILane.cpp:230
void drawMarkings(const GUIVisualizationSettings &s, SUMOReal scale) const
draw lane borders and white markings
Definition: GUILane.cpp:553
const std::vector< SUMOReal > & getShapeLengths() const
Definition: GUILane.cpp:711
void drawArrows() const
Definition: GUILane.cpp:326
void drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const
draw crossties for railroads or pedestrian crossings
Definition: GUILane.cpp:617
bool integrateNewVehicle(SUMOTime t)
Definition: GUILane.cpp:155
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and some lane function ...
Definition: GUILane.cpp:778
The simulated network and simulation perfomer.
Definition: MSNet.h:94
void drawBikeMarkings() const
bike lane markings on top of an intersection
Definition: GUILane.cpp:592
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:70
std::vector< SUMOReal > myShapeRotations
The rotations of the shape parts.
Definition: GUILane.h:282
A road/street connecting two junctions.
Definition: MSEdge.h:81
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUILane.cpp:661
bool executeMovements(SUMOTime t, std::vector< MSLane * > &into)
Definition: GUILane.cpp:134
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUILane.h:306
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUILane.cpp:684
A list of positions.
void drawTLSLinkNo(const GUINet &net) const
Definition: GUILane.cpp:197
void planMovements(const SUMOTime t)
Definition: GUILane.cpp:127
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterway
Definition: GUILane.cpp:961
std::vector< SUMOReal > myShapeLengths
The lengths of the shape parts.
Definition: GUILane.h:285
SUMOReal firstWaitingTime() const
Definition: GUILane.cpp:717
void drawLinkNo() const
helper methods
Definition: GUILane.cpp:170
GUILane(const std::string &id, SUMOReal maxSpeed, SUMOReal length, MSEdge *const edge, unsigned int numericalID, const PositionVector &shape, SUMOReal width, SVCPermissions permissions, unsigned int index)
Constructor.
Definition: GUILane.cpp:71
MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify)
Definition: GUILane.cpp:141
virtual void incorporateVehicle(MSVehicle *veh, SUMOReal pos, SUMOReal speed, const MSLane::VehCont::iterator &at, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Inserts the vehicle into this lane, and informs it about entering the network.
Definition: GUILane.cpp:104
bool setFunctionalColor(size_t activeScheme) const
sets the color according to the current scheme index and some lane function
Definition: GUILane.cpp:764
SUMOReal getEdgeLaneNumber() const
Definition: GUILane.cpp:723
void drawLinkRule(const GUIVisualizationSettings &s, const GUINet &net, MSLink *link, const PositionVector &shape, SUMOReal x1, SUMOReal x2) const
Definition: GUILane.cpp:270
void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
Definition: GUILane.cpp:148
The vehicle has departed (was inserted into the network)
SUMOReal getColorValue(size_t activeScheme) const
gets the color value according to the current scheme index
Definition: GUILane.cpp:800
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:90
SUMOReal getStoredEdgeTravelTime() const
Returns the stored traveltime for the edge of this lane.
Definition: GUILane.cpp:729
void detectCollisions(SUMOTime timestep, const std::string &stage)
Definition: GUILane.cpp:162
SUMOReal getHalfWidth() const
Definition: GUILane.h:206
The popup menu of a globject.
SUMOReal myHalfLaneWidth
Half of lane width, for speed-up.
Definition: GUILane.h:291
int SUMOTime
Definition: SUMOTime.h:43
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
Definition: GUILane.cpp:955
SUMOReal myQuarterLaneWidth
Quarter of lane width, for speed-up.
Definition: GUILane.h:294
const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
Definition: GUILane.cpp:114
#define SUMOReal
Definition: config.h:218
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUILane.cpp:641
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
A window containing a gl-object's parameter.
void releaseVehicles() const
Allows to use the container for microsimulation again.
Definition: GUILane.cpp:121
const PositionVector & getShape() const
Definition: GUILane.cpp:699