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-2017 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, double maxSpeed,
86  double length, MSEdge* const edge, int numericalID,
87  const PositionVector& shape, double width,
88  SVCPermissions permissions, int index, bool isRampAccel);
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  double 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<double>& getShapeRotations() const;
214  const std::vector<double>& getShapeLengths() const;
215 
216  double firstWaitingTime() const;
217 
219  void drawMarkings(const GUIVisualizationSettings& s, double scale) const;
220 
222  void drawBikeMarkings() const;
223 
225  void drawCrossties(double length, double spacing, double halfWidth) const;
226 
228  void drawDirectionIndicators() const;
229 
230  double getEdgeLaneNumber() const;
231 
234  double getStoredEdgeTravelTime() const;
235 
238  double 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, double pos, double speed, double 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 drawLinkRules(const GUIVisualizationSettings& s, const GUINet& net) const;
281  void drawLinkRule(const GUIVisualizationSettings& s, const GUINet& net, MSLink* link, const PositionVector& shape, double x1, double x2) const;
282  void drawArrows() const;
283  void drawLane2LaneConnections() const;
284 
285 
287  PositionVector splitAtSegments(const PositionVector& shape);
288 
289 private:
291  double getColorValue(int activeScheme) const;
292 
294  double getScaleValue(int activeScheme) const;
295 
297  bool setFunctionalColor(int activeScheme) const;
298 
300  bool setMultiColor(const GUIColorer& c) const;
301 
303  void setColor(const GUIVisualizationSettings& s) const;
304 
306  bool drawAsRailway(const GUIVisualizationSettings& s) const;
307 
309  bool drawAsWaterway(const GUIVisualizationSettings& s) const;
310 
312  std::vector<double> myShapeRotations;
313 
315  std::vector<double> myShapeLengths;
316 
318  mutable std::vector<RGBColor> myShapeColors;
319 
321  std::vector<int> myShapeSegments;
322 
325 
328 
329 #ifdef HAVE_OSG
330  osg::Geometry* myGeom;
331 #endif
332 
335 
336 private:
338  mutable MFXMutex myLock;
339 
340 
341 };
342 
343 
344 #endif
345 
346 /****************************************************************************/
347 
std::vector< int > myShapeSegments
the meso segment index for each geometry segment
Definition: GUILane.h:321
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition: GUILane.h:318
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:83
Stores the information about how to visualize structures.
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
bool isClosed() const
Definition: GUILane.h:252
Notification
Definition of a vehicle state.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
std::vector< double > myShapeLengths
The lengths of the shape parts.
Definition: GUILane.h:315
The simulated network and simulation perfomer.
Definition: MSNet.h:94
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:70
A road/street connecting two junctions.
Definition: MSEdge.h:80
const std::string & getParentName() const
Returns the name of the parent object (if any)
Definition: GUILane.h:98
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUILane.h:338
A list of positions.
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.
std::vector< double > myShapeRotations
The rotations of the shape parts.
Definition: GUILane.h:312
bool myAmClosed
state for dynamic lane closings
Definition: GUILane.h:334
long long int SUMOTime
Definition: TraCIDefs.h:52
double myHalfLaneWidth
Half of lane width, for speed-up.
Definition: GUILane.h:324
double myQuarterLaneWidth
Quarter of lane width, for speed-up.
Definition: GUILane.h:327
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
A window containing a gl-object&#39;s parameter.