SUMO - Simulation of Urban MObility
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 
98  const std::string& getParentName() const {
99  return getEdge().getID();
100  }
101 
102 
105 
115  const VehCont& getVehiclesSecure() const;
116 
117 
123  void releaseVehicles() const;
125 
126 
127 
130 
133  void planMovements(const SUMOTime t);
134 
137  bool executeMovements(SUMOTime t, std::vector<MSLane*>& into);
138 
141  bool integrateNewVehicle(SUMOTime t);
143 
144 
147  void detectCollisions(SUMOTime timestep, const std::string& stage);
148 
149 
152  MSVehicle* removeVehicle(MSVehicle* remVehicle, MSMoveReminder::Notification notification, bool notify);
153 
154 
155 
157 
158 
166  GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app,
167  GUISUMOAbstractView& parent);
168 
169 
177  GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app,
178  GUISUMOAbstractView& parent);
179 
180 
186  Boundary getCenteringBoundary() const;
187 
188 
193  void drawGL(const GUIVisualizationSettings& s) const;
195 
196 
197 
198  const PositionVector& getShape() const;
199  const std::vector<SUMOReal>& getShapeRotations() const;
200  const std::vector<SUMOReal>& getShapeLengths() const;
201 
202  SUMOReal firstWaitingTime() const;
203 
205  void drawMarkings(const GUIVisualizationSettings& s, SUMOReal scale) const;
206 
208  void drawBikeMarkings() const;
209 
211  void drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const;
212 
213  SUMOReal getEdgeLaneNumber() const;
214 
217  SUMOReal getStoredEdgeTravelTime() const;
218 
221  SUMOReal getLoadedEdgeWeight() const;
222 
223 #ifdef HAVE_OSG
224  void setGeometry(osg::Geometry* geom) {
225  myGeom = geom;
226  }
227 
228  void updateColor(const GUIVisualizationSettings& s);
229 
230 #endif
231 
233  void closeTraffic(bool rebuildAllowed = true);
234 
235  bool isClosed() const {
236  return myAmClosed;
237  }
238 
239 protected:
241  void swapAfterLaneChange(SUMOTime t);
242 
254  virtual void incorporateVehicle(MSVehicle* veh, SUMOReal pos, SUMOReal speed,
255  const MSLane::VehCont::iterator& at,
257 
258 private:
260  void drawLinkNo(const GUIVisualizationSettings& s) const;
261  void drawTLSLinkNo(const GUIVisualizationSettings& s, const GUINet& net) const;
262  void drawTextAtEnd(const std::string& text, const PositionVector& shape, SUMOReal x, const GUIVisualizationTextSettings& settings) const;
263  void drawLinkRules(const GUIVisualizationSettings& s, const GUINet& net) const;
264  void drawLinkRule(const GUIVisualizationSettings& s, const GUINet& net, MSLink* link, const PositionVector& shape, SUMOReal x1, SUMOReal x2) const;
265  void drawArrows() const;
266  void drawLane2LaneConnections() const;
267 
268 
269 
270 private:
272  SUMOReal getColorValue(size_t activeScheme) const;
273 
275  SUMOReal getScaleValue(size_t activeScheme) const;
276 
278  bool setFunctionalColor(size_t activeScheme) const;
279 
281  bool setMultiColor(const GUIColorer& c) const;
282 
284  void setColor(const GUIVisualizationSettings& s) const;
285 
287  bool drawAsRailway(const GUIVisualizationSettings& s) const;
288 
290  bool drawAsWaterway(const GUIVisualizationSettings& s) const;
291 
293  std::vector<SUMOReal> myShapeRotations;
294 
296  std::vector<SUMOReal> myShapeLengths;
297 
299  mutable std::vector<RGBColor> myShapeColors;
300 
303 
306 
308  unsigned int myIndex;
309 
310 #ifdef HAVE_OSG
311  osg::Geometry* myGeom;
312 #endif
313 
317 
318 private:
320  mutable MFXMutex myLock;
321 
322 
323 };
324 
325 
326 #endif
327 
328 /****************************************************************************/
329 
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition: GUILane.h:299
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
long long int SUMOTime
Definition: SUMOTime.h:43
unsigned int myIndex
The lane index.
Definition: GUILane.h:308
bool isClosed() const
Definition: GUILane.h:235
Stores the information about how to visualize structures.
int SVCPermissions
const std::string & getParentName() const
Returns the name of the parent object (if any)
Definition: GUILane.h:98
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:88
Notification
Definition of a vehicle state.
SVCPermissions myOriginalPermissions
Definition: GUILane.h:316
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
The simulated network and simulation perfomer.
Definition: MSNet.h:94
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:293
A road/street connecting two junctions.
Definition: MSEdge.h:81
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUILane.h:320
A list of positions.
std::vector< SUMOReal > myShapeLengths
The lengths of the shape parts.
Definition: GUILane.h:296
The vehicle has departed (was inserted into the network)
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:91
The popup menu of a globject.
SUMOReal myHalfLaneWidth
Half of lane width, for speed-up.
Definition: GUILane.h:302
bool myAmClosed
state for dynamic lane closings
Definition: GUILane.h:315
SUMOReal myQuarterLaneWidth
Quarter of lane width, for speed-up.
Definition: GUILane.h:305
#define SUMOReal
Definition: config.h:214
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
A window containing a gl-object&#39;s parameter.