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-2012 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>
40 #include "GUILaneWrapper.h"
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
52 class GUIEdge : public MSEdge, public GUIGlObject {
53 public:
59  GUIEdge(const std::string& id, unsigned int numericalID, const std::string& streetName) ;
60 
61 
63  ~GUIEdge() ;
64 
65 
68  void initGeometry() ;
69 
70 
71  /* @brief Returns the gl-ids of all known edges
72  * @param[in] includeInternal Whether to include ids of internal edges
73  */
74  static std::vector<GUIGlID> getIDs(bool includeInternal);
75 
77  Boundary getBoundary() const;
78 
80  MSLane& getLane(size_t laneNo);
81 
82 
83 
85  GUILaneWrapper& getLaneGeometry(size_t laneNo) const;
86 
87  GUILaneWrapper& getLaneGeometry(const MSLane* lane) const;
88 
92  static std::pair<SUMOReal, SUMOReal> getLaneOffsets(SUMOReal x1, SUMOReal y1,
93  SUMOReal x2, SUMOReal y2, SUMOReal prev, SUMOReal wanted);
94 
95  static void fill(std::vector<GUIEdge*> &netsWrappers);
96 
97 
98 
100 
101 
110  GUISUMOAbstractView& parent) ;
111 
112 
121  GUISUMOAbstractView& parent) ;
122 
123 
130 
131 
136  void drawGL(const GUIVisualizationSettings& s) const ;
138 
139 
140 #ifdef HAVE_MESOSIM
141  unsigned int getVehicleNo() const;
142  std::string getVehicleIDs() const;
143  SUMOReal getOccupancy() const;
144  SUMOReal getMeanSpeed() const;
145  SUMOReal getAllowedSpeed() const;
147  SUMOReal getFlow() const;
149  SUMOReal getFlowAlternative() const;
151  SUMOReal getRelativeSpeed() const;
152 
154  void setColor(const GUIVisualizationSettings& s) const;
155 
157  SUMOReal getColorValue(size_t activeScheme) const;
158 
159 #endif
160 
161 private:
163  typedef std::vector<GUILaneWrapper*> LaneWrapperVector;
164 
167 
173  public:
175  explicit lane_wrapper_finder(const MSLane& lane) : myLane(lane) { }
176 
178  bool operator()(const GUILaneWrapper* const wrapper) {
179  return wrapper->forLane(myLane);
180  }
181 
182  private:
183  lane_wrapper_finder& operator=(const lane_wrapper_finder&); // just to avoid a compiler warning
184  private:
186  const MSLane& myLane;
187 
188  };
189 
190 private:
192  GUIEdge(const GUIEdge& s);
193 
195  GUIEdge& operator=(const GUIEdge& s);
196 
197 
198 };
199 
200 
201 #endif
202 
203 /****************************************************************************/
204