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-2016 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, int numericalID,
87  const PositionVector& shape, SUMOReal width,
88  SVCPermissions permissions, 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 
162  SUMOReal setPartialOccupation(MSVehicle* v);
163 
167  void resetPartialOccupation(MSVehicle* v);
168 
169 
171 
172 
180  GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app,
181  GUISUMOAbstractView& parent);
182 
183 
191  GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app,
192  GUISUMOAbstractView& parent);
193 
194 
200  Boundary getCenteringBoundary() const;
201 
202 
207  void drawGL(const GUIVisualizationSettings& s) const;
209 
210 
211 
212  const PositionVector& getShape() const;
213  const std::vector<SUMOReal>& getShapeRotations() const;
214  const std::vector<SUMOReal>& getShapeLengths() const;
215 
216  SUMOReal firstWaitingTime() const;
217 
219  void drawMarkings(const GUIVisualizationSettings& s, SUMOReal scale) const;
220 
222  void drawBikeMarkings() const;
223 
225  void drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const;
226 
228  void drawDirectionIndicators() const;
229 
230  SUMOReal getEdgeLaneNumber() const;
231 
234  SUMOReal getStoredEdgeTravelTime() const;
235 
238  SUMOReal getLoadedEdgeWeight() const;
239 
240 #ifdef HAVE_OSG
241  void setGeometry(osg::Geometry* geom) {
242  myGeom = geom;
243  }
244 
245  void updateColor(const GUIVisualizationSettings& s);
246 
247 #endif
248 
250  void closeTraffic(bool rebuildAllowed = true);
251 
252  bool isClosed() const {
253  return myAmClosed;
254  }
255 
256 protected:
258  void swapAfterLaneChange(SUMOTime t);
259 
272  virtual void incorporateVehicle(MSVehicle* veh, SUMOReal pos, SUMOReal speed, SUMOReal posLat,
273  const MSLane::VehCont::iterator& at,
275 
276 private:
278  void drawLinkNo(const GUIVisualizationSettings& s) const;
279  void drawTLSLinkNo(const GUIVisualizationSettings& s, const GUINet& net) const;
280  void drawTextAtEnd(const std::string& text, const PositionVector& shape, SUMOReal x, const GUIVisualizationTextSettings& settings) const;
281  void drawLinkRules(const GUIVisualizationSettings& s, const GUINet& net) const;
282  void drawLinkRule(const GUIVisualizationSettings& s, const GUINet& net, MSLink* link, const PositionVector& shape, SUMOReal x1, SUMOReal x2) const;
283  void drawArrows() const;
284  void drawLane2LaneConnections() const;
285 
286 
288  PositionVector splitAtSegments(const PositionVector& shape);
289 
290 private:
292  SUMOReal getColorValue(int activeScheme) const;
293 
295  SUMOReal getScaleValue(int activeScheme) const;
296 
298  bool setFunctionalColor(int activeScheme) const;
299 
301  bool setMultiColor(const GUIColorer& c) const;
302 
304  void setColor(const GUIVisualizationSettings& s) const;
305 
307  bool drawAsRailway(const GUIVisualizationSettings& s) const;
308 
310  bool drawAsWaterway(const GUIVisualizationSettings& s) const;
311 
313  std::vector<SUMOReal> myShapeRotations;
314 
316  std::vector<SUMOReal> myShapeLengths;
317 
319  mutable std::vector<RGBColor> myShapeColors;
320 
322  std::vector<int> myShapeSegments;
323 
326 
329 
330 #ifdef HAVE_OSG
331  osg::Geometry* myGeom;
332 #endif
333 
337 
338 private:
340  mutable MFXMutex myLock;
341 
342 
343 };
344 
345 
346 #endif
347 
348 /****************************************************************************/
349 
std::vector< int > myShapeSegments
the meso segment index for each geometry segment
Definition: GUILane.h:322
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition: GUILane.h:319
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:81
long long int SUMOTime
Definition: SUMOTime.h:43
bool isClosed() const
Definition: GUILane.h:252
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
Notification
Definition of a vehicle state.
SVCPermissions myOriginalPermissions
Definition: GUILane.h:336
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
The simulated network and simulation perfomer.
Definition: MSNet.h:93
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:313
A road/street connecting two junctions.
Definition: MSEdge.h:80
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUILane.h:340
A list of positions.
std::vector< SUMOReal > myShapeLengths
The lengths of the shape parts.
Definition: GUILane.h:316
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:91
The vehicle has departed (was inserted into the network)
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:89
The popup menu of a globject.
SUMOReal myHalfLaneWidth
Half of lane width, for speed-up.
Definition: GUILane.h:325
bool myAmClosed
state for dynamic lane closings
Definition: GUILane.h:335
SUMOReal myQuarterLaneWidth
Quarter of lane width, for speed-up.
Definition: GUILane.h:328
#define SUMOReal
Definition: config.h:213
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
A window containing a gl-object&#39;s parameter.