SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUIEdge.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // A road/street connecting two junctions (gui-version)
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
13 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef GUIEdge_h
24 #define GUIEdge_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <vector>
37 #include <string>
38 #include <microsim/MSEdge.h>
41 #include "GUILaneWrapper.h"
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 #ifdef HAVE_INTERNAL
47 class MESegment;
48 #endif
49 class MSBaseVehicle;
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
60 class GUIEdge : public MSEdge, public GUIGlObject {
61 public:
67  GUIEdge(const std::string& id, int numericalID,
68  const EdgeBasicFunction function, const std::string& streetName);
69 
70 
72  ~GUIEdge();
73 
74 
77  void initGeometry();
78 
79 
80  /* @brief Returns the gl-ids of all known edges
81  * @param[in] includeInternal Whether to include ids of internal edges
82  */
83  static std::vector<GUIGlID> getIDs(bool includeInternal);
84 
86  Boundary getBoundary() const;
87 
89  MSLane& getLane(size_t laneNo);
90 
91 
92 
94  GUILaneWrapper& getLaneGeometry(size_t laneNo) const;
95 
96  GUILaneWrapper& getLaneGeometry(const MSLane* lane) const;
97 
101  static std::pair<SUMOReal, SUMOReal> getLaneOffsets(SUMOReal x1, SUMOReal y1,
102  SUMOReal x2, SUMOReal y2, SUMOReal prev, SUMOReal wanted);
103 
104  static void fill(std::vector<GUIEdge*>& netsWrappers);
105 
106 
107 
109 
110 
119  GUISUMOAbstractView& parent);
120 
121 
130  GUISUMOAbstractView& parent);
131 
132 
139 
140 
145  void drawGL(const GUIVisualizationSettings& s) const;
147 
148 
149  void addPerson(MSPerson* p) {
152  }
153 
157  }
158 
159 
160 #ifdef HAVE_INTERNAL
161  unsigned int getVehicleNo() const;
162  std::string getVehicleIDs() const;
163  SUMOReal getOccupancy() const;
164  SUMOReal getMeanSpeed() const;
165  SUMOReal getAllowedSpeed() const;
167  SUMOReal getFlow() const;
169  SUMOReal getRelativeSpeed() const;
170 
172  void setColor(const GUIVisualizationSettings& s) const;
173 
175  SUMOReal getColorValue(size_t activeScheme) const;
176 
178  MESegment* getSegmentAtPosition(const Position& pos);
179 
181  void setVehicleColor(const GUIVisualizationSettings& s, MSBaseVehicle* veh) const;
182 
183 #endif
184 
185 private:
187  typedef std::vector<GUILaneWrapper*> LaneWrapperVector;
188 
191 
197  public:
199  explicit lane_wrapper_finder(const MSLane& lane) : myLane(lane) { }
200 
202  bool operator()(const GUILaneWrapper* const wrapper) {
203  return wrapper->forLane(myLane);
204  }
205 
206  private:
207  lane_wrapper_finder& operator=(const lane_wrapper_finder&); // just to avoid a compiler warning
208  private:
210  const MSLane& myLane;
211 
212  };
213 
214 private:
216  GUIEdge(const GUIEdge& s);
217 
219  GUIEdge& operator=(const GUIEdge& s);
220 
221 private:
223  mutable MFXMutex myLock;
224 
225 };
226 
227 
228 #endif
229 
230 /****************************************************************************/
231