SUMO - Simulation of Urban MObility
GUILane.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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // Representation of a lane in the micro simulation (gui-version)
20 /****************************************************************************/
21 #ifndef GUILane_h
22 #define GUILane_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <fx.h>
35 #include <string>
36 #include <utility>
37 #include <microsim/MSLane.h>
38 #include <microsim/MSEdge.h>
40 #include <utils/geom/Position.h>
44 
45 
46 // ===========================================================================
47 // class declarations
48 // ===========================================================================
49 class GUINet;
50 class MSVehicle;
51 class MSNet;
52 #ifdef HAVE_OSG
53 namespace osg {
54 class Geometry;
55 }
56 #endif
57 
58 // ===========================================================================
59 // class definitions
60 // ===========================================================================
69 class GUILane : public MSLane, public GUIGlObject {
70 public:
84  GUILane(const std::string& id, double maxSpeed,
85  double length, MSEdge* const edge, int numericalID,
86  const PositionVector& shape, double width,
87  SVCPermissions permissions, int index, bool isRampAccel);
88 
89 
91  ~GUILane();
92 
97  const std::string& getParentName() const {
98  return getEdge().getID();
99  }
100 
101 
104 
114  const VehCont& getVehiclesSecure() const;
115 
116 
122  void releaseVehicles() const;
124 
125 
126 
129 
132  void planMovements(const SUMOTime t);
133 
136  bool executeMovements(SUMOTime t, std::vector<MSLane*>& into);
137 
140  bool integrateNewVehicle(SUMOTime t);
142 
143 
146  void detectCollisions(SUMOTime timestep, const std::string& stage);
147 
148 
151  MSVehicle* removeVehicle(MSVehicle* remVehicle, MSMoveReminder::Notification notification, bool notify);
152 
154  void removeParking(MSVehicle* veh);
155 
163  double setPartialOccupation(MSVehicle* v);
164 
168  void resetPartialOccupation(MSVehicle* v);
169 
170 
172 
173 
181  GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app,
182  GUISUMOAbstractView& parent);
183 
184 
192  GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app,
193  GUISUMOAbstractView& parent);
194 
195 
201  Boundary getCenteringBoundary() const;
202 
203 
208  void drawGL(const GUIVisualizationSettings& s) const;
210 
211 
212 
213  const PositionVector& getShape() const;
214  const std::vector<double>& getShapeRotations() const;
215  const std::vector<double>& getShapeLengths() const;
216 
217  double firstWaitingTime() const;
218 
220  void drawMarkings(const GUIVisualizationSettings& s, double scale) const;
221 
223  void drawBikeMarkings() const;
224 
226  void drawCrossties(double length, double spacing, double halfWidth) const;
227 
229  void drawDirectionIndicators() const;
230 
232  void debugDrawFoeIntersections() const;
233 
234  double getEdgeLaneNumber() const;
235 
238  double getStoredEdgeTravelTime() const;
239 
242  double getLoadedEdgeWeight() const;
243 
244 #ifdef HAVE_OSG
245  void setGeometry(osg::Geometry* geom) {
246  myGeom = geom;
247  }
248 
249  void updateColor(const GUIVisualizationSettings& s);
250 
251 #endif
252 
254  void closeTraffic(bool rebuildAllowed = true);
255 
256  bool isClosed() const {
257  return myAmClosed;
258  }
259 
261  double getColorValue(int activeScheme) const;
262 
264  bool isSelected() const;
265 
266 protected:
268  void swapAfterLaneChange(SUMOTime t);
269 
282  virtual void incorporateVehicle(MSVehicle* veh, double pos, double speed, double posLat,
283  const MSLane::VehCont::iterator& at,
285 
286 private:
288  void drawLinkNo(const GUIVisualizationSettings& s) const;
289  void drawTLSLinkNo(const GUIVisualizationSettings& s, const GUINet& net) const;
290  void drawLinkRules(const GUIVisualizationSettings& s, const GUINet& net) const;
291  void drawLinkRule(const GUIVisualizationSettings& s, const GUINet& net, MSLink* link, const PositionVector& shape, double x1, double x2) const;
292  void drawArrows() const;
293  void drawLane2LaneConnections() const;
294 
295 
297  PositionVector splitAtSegments(const PositionVector& shape);
298 
299 private:
300 
302  double getScaleValue(int activeScheme) const;
303 
305  bool setFunctionalColor(int activeScheme) const;
306 
308  bool setMultiColor(const GUIColorer& c) const;
309 
311  void setColor(const GUIVisualizationSettings& s) const;
312 
314  bool drawAsRailway(const GUIVisualizationSettings& s) const;
315 
317  bool drawAsWaterway(const GUIVisualizationSettings& s) const;
318 
320  bool isLaneOrEdgeSelected() const;
321 
323  std::vector<double> myShapeRotations;
324 
326  std::vector<double> myShapeLengths;
327 
329  mutable std::vector<RGBColor> myShapeColors;
330 
332  std::vector<int> myShapeSegments;
333 
336 
339 
340 #ifdef HAVE_OSG
341  osg::Geometry* myGeom;
342 #endif
343 
346 
347 private:
349  mutable MFXMutex myLock;
350 
351 
352 };
353 
354 
355 #endif
356 
357 /****************************************************************************/
358 
std::vector< int > myShapeSegments
the meso segment index for each geometry segment
Definition: GUILane.h:332
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition: GUILane.h:329
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:256
Notification
Definition of a vehicle state.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:47
std::vector< double > myShapeLengths
The lengths of the shape parts.
Definition: GUILane.h:326
The simulated network and simulation perfomer.
Definition: MSNet.h:90
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:69
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:97
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUILane.h:349
A list of positions.
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:89
The vehicle has departed (was inserted into the network)
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:88
The popup menu of a globject.
std::vector< double > myShapeRotations
The rotations of the shape parts.
Definition: GUILane.h:323
bool myAmClosed
state for dynamic lane closings
Definition: GUILane.h:345
long long int SUMOTime
Definition: TraCIDefs.h:51
double myHalfLaneWidth
Half of lane width, for speed-up.
Definition: GUILane.h:335
double myQuarterLaneWidth
Quarter of lane width, for speed-up.
Definition: GUILane.h:338
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
A window containing a gl-object&#39;s parameter.