SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ROEdge.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // A basic edge for routing applications
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
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 ROEdge_h
24 #define ROEdge_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 <string>
37 #include <map>
38 #include <vector>
39 #include <algorithm>
40 #include <utils/common/Named.h>
44 #include "RONode.h"
45 #include "ROVehicle.h"
46 
47 
48 // ===========================================================================
49 // class declarations
50 // ===========================================================================
51 class ROLane;
52 class ROVehicle;
53 
54 
55 // ===========================================================================
56 // class definitions
57 // ===========================================================================
67 class ROEdge : public Named {
68 public:
73  enum EdgeType {
84  };
85 
86 
94  ROEdge(const std::string& id, RONode* from, RONode* to, unsigned int index, const int priority);
95 
96 
98  virtual ~ROEdge();
99 
100 
102 
103 
112  virtual void addLane(ROLane* lane);
113 
114 
122  virtual void addFollower(ROEdge* s, std::string dir = "");
123 
124 
128  void setType(EdgeType type);
129 
130 
140  void buildTimeLines(const std::string& measure);
142 
143 
144 
146 
147 
152  EdgeType getType() const {
153  return myType;
154  }
155 
156 
160  SUMOReal getLength() const {
161  return myLength;
162  }
163 
167  unsigned int getNumericalID() const {
168  return myIndex;
169  }
170 
171 
175  SUMOReal getSpeed() const {
176  return mySpeed;
177  }
178 
179 
183  unsigned int getLaneNo() const {
184  return (unsigned int) myLanes.size();
185  }
186 
187 
191  RONode* getFromNode() const {
192  return myFromNode;
193  }
194 
195 
199  RONode* getToNode() const {
200  return myToNode;
201  }
202 
203 
209  bool isConnectedTo(const ROEdge* const e) const {
210  return std::find(myFollowingEdges.begin(), myFollowingEdges.end(), e) != myFollowingEdges.end();
211  }
212 
213 
218  inline bool prohibits(const ROVehicle* const vehicle) const {
219  const SUMOVehicleClass vclass = vehicle->getVClass();
220  return (myCombinedPermissions & vclass) != vclass;
221  }
222 
224  return myCombinedPermissions;
225  }
226 
227 
232  bool allFollowersProhibit(const ROVehicle* const vehicle) const;
234 
235 
236 
238 
239 
246  void addEffort(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd);
247 
248 
255  void addTravelTime(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd);
256 
257 
265  unsigned int getNoFollowing() const;
266 
267 
272  ROEdge* getFollower(unsigned int pos) const {
273  return myFollowingEdges[pos];
274  }
275 
276 
284  unsigned int getNumApproaching() const;
285 
286 
291  ROEdge* getApproaching(unsigned int pos) const {
292  return myApproachingEdges[pos];
293  }
294 
295 
303  SUMOReal getEffort(const ROVehicle* const veh, SUMOReal time) const;
304 
305 
312  SUMOReal getTravelTime(const ROVehicle* const veh, SUMOReal time) const;
313 
314 
321  SUMOReal getTravelTime(const SUMOReal maxSpeed, SUMOReal time) const;
322 
323 
329  SUMOReal getMinimumTravelTime(const ROVehicle* const veh) const;
330 
331 
332  SUMOReal getCOEffort(const ROVehicle* const veh, SUMOReal time) const;
333  SUMOReal getCO2Effort(const ROVehicle* const veh, SUMOReal time) const;
334  SUMOReal getPMxEffort(const ROVehicle* const veh, SUMOReal time) const;
335  SUMOReal getHCEffort(const ROVehicle* const veh, SUMOReal time) const;
336  SUMOReal getNOxEffort(const ROVehicle* const veh, SUMOReal time) const;
337  SUMOReal getFuelEffort(const ROVehicle* const veh, SUMOReal time) const;
338  SUMOReal getNoiseEffort(const ROVehicle* const veh, SUMOReal time) const;
340 
341 
343  SUMOReal getDistanceTo(const ROEdge* other) const;
344 
345 
347  static ROEdge* dictionary(size_t index);
348 
350  static size_t dictSize() {
351  return myEdges.size();
352  };
353 
354  static void setTimeLineOptions(
355  bool useBoundariesOnOverrideTT,
356  bool useBoundariesOnOverrideE,
357  bool interpolate) {
358  myUseBoundariesOnOverrideTT = useBoundariesOnOverrideTT;
359  myUseBoundariesOnOverrideE = useBoundariesOnOverrideE;
360  myInterpolate = interpolate;
361  }
362 
364  int getPriority() const {
365  return myPriority;
366  }
367 
368 protected:
375  bool getStoredEffort(SUMOReal time, SUMOReal& ret) const;
376 
377 
378 
379 protected:
381  RONode* const myFromNode, * const myToNode;
382 
384  const unsigned int myIndex;
385 
387  const int myPriority;
388 
391 
394 
395 
402 
409 
411  static bool myInterpolate;
412 
414  static bool myHaveEWarned;
416  static bool myHaveTTWarned;
417 
419  std::vector<ROEdge*> myFollowingEdges;
420 
422  std::vector<ROEdge*> myApproachingEdges;
423 
426 
428  std::vector<ROLane*> myLanes;
429 
432 
433  static std::vector<ROEdge*> myEdges;
434 
435 
436 private:
443  SUMOReal getTravelTime(SUMOReal time) const;
444 
445 private:
447  ROEdge(const ROEdge& src);
448 
450  ROEdge& operator=(const ROEdge& src);
451 
452 };
453 
454 
455 #endif
456 
457 /****************************************************************************/
458 
RONode * getToNode() const
Returns the node this edge ends at.
Definition: ROEdge.h:199
EdgeType getType() const
Returns the type of the edge.
Definition: ROEdge.h:152
static bool myUseBoundariesOnOverrideTT
Whether overriding weight boundaries shall be reported.
Definition: ROEdge.h:401
ROEdge * getFollower(unsigned int pos) const
Returns the edge at the given position from the list of reachable edges.
Definition: ROEdge.h:272
A single lane the router may use.
Definition: ROLane.h:51
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
SUMOReal getDistanceTo(const ROEdge *other) const
optimistic distance heuristic for use in routing
Definition: ROEdge.cpp:133
static std::vector< ROEdge * > myEdges
Definition: ROEdge.h:433
SUMOVehicleClass getVClass() const
Definition: ROVehicle.h:122
static bool myInterpolate
Information whether to interpolate at interval boundaries.
Definition: ROEdge.h:411
EdgeType
Possible types of edges.
Definition: ROEdge.h:73
static ROEdge * dictionary(size_t index)
Returns the ROEdge at the index.
Definition: ROEdge.cpp:356
ValueTimeLine< SUMOReal > myTravelTimes
Container storing passing time varying over time for the edge.
Definition: ROEdge.h:397
virtual void addLane(ROLane *lane)
Adds a lane to the edge while loading.
Definition: ROEdge.cpp:86
SUMOReal getPMxEffort(const ROVehicle *const veh, SUMOReal time) const
Definition: ROEdge.cpp:206
SUMOReal getCO2Effort(const ROVehicle *const veh, SUMOReal time) const
Definition: ROEdge.cpp:194
An internal edge which models driving across a junction. This is currently not used for routing...
Definition: ROEdge.h:83
std::vector< ROEdge * > myApproachingEdges
List of edges that approached this edge.
Definition: ROEdge.h:422
bool isConnectedTo(const ROEdge *const e) const
returns the information whether this edge is directly connected to the given
Definition: ROEdge.h:209
unsigned int getLaneNo() const
Returns the number of lanes this edge has.
Definition: ROEdge.h:183
static bool myUseBoundariesOnOverrideE
Whether overriding weight boundaries shall be reported.
Definition: ROEdge.h:408
SVCPermissions myCombinedPermissions
The list of allowed vehicle classes combined across lanes.
Definition: ROEdge.h:431
void addTravelTime(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd)
Adds a travel time value.
Definition: ROEdge.cpp:116
RONode * getFromNode() const
Returns the node this edge starts at.
Definition: ROEdge.h:191
An edge where vehicles are inserted at (no vehicle may come from back)
Definition: ROEdge.h:79
A vehicle as used by router.
Definition: ROVehicle.h:58
void setType(EdgeType type)
Sets the type of te edge.
Definition: ROEdge.cpp:308
bool allFollowersProhibit(const ROVehicle *const vehicle) const
Returns whether this edge succeding edges prohibit the given vehicle to pass them.
Definition: ROEdge.cpp:345
ValueTimeLine< SUMOReal > myEfforts
Container storing passing time varying over time for the edge.
Definition: ROEdge.h:404
bool myUsingTTTimeLine
Information whether the time line shall be used instead of the length value.
Definition: ROEdge.h:399
static bool myHaveEWarned
Information whether the edge has reported missing weights.
Definition: ROEdge.h:414
SUMOReal myLength
The length of the edge.
Definition: ROEdge.h:393
bool myUsingETimeLine
Information whether the time line shall be used instead of the length value.
Definition: ROEdge.h:406
SUMOReal getHCEffort(const ROVehicle *const veh, SUMOReal time) const
Definition: ROEdge.cpp:218
SUMOReal getNOxEffort(const ROVehicle *const veh, SUMOReal time) const
Definition: ROEdge.cpp:230
static void setTimeLineOptions(bool useBoundariesOnOverrideTT, bool useBoundariesOnOverrideE, bool interpolate)
Definition: ROEdge.h:354
unsigned int getNumericalID() const
Returns the index (numeric id) of the edge.
Definition: ROEdge.h:167
An edge representing a whole district.
Definition: ROEdge.h:77
std::vector< ROLane * > myLanes
This edge&#39;s lanes.
Definition: ROEdge.h:428
ROEdge(const std::string &id, RONode *from, RONode *to, unsigned int index, const int priority)
Constructor.
Definition: ROEdge.cpp:65
const unsigned int myIndex
The index (numeric id) of the edge.
Definition: ROEdge.h:384
virtual ~ROEdge()
Destructor.
Definition: ROEdge.cpp:78
A basic edge for routing applications.
Definition: ROEdge.h:67
Base class for objects which have an id.
Definition: Named.h:45
RONode *const *const myToNode
Definition: ROEdge.h:381
ROEdge * getApproaching(unsigned int pos) const
Returns the edge at the given position from the list of reachable edges.
Definition: ROEdge.h:291
SUMOReal mySpeed
The maximum speed allowed on this edge.
Definition: ROEdge.h:390
std::vector< ROEdge * > myFollowingEdges
List of edges that may be approached from this edge.
Definition: ROEdge.h:419
unsigned int getNoFollowing() const
Returns the number of edges this edge is connected to.
Definition: ROEdge.cpp:290
void addEffort(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd)
Adds a weight value.
Definition: ROEdge.cpp:109
int getPriority() const
get edge priority (road class)
Definition: ROEdge.h:364
SUMOReal getFuelEffort(const ROVehicle *const veh, SUMOReal time) const
Definition: ROEdge.cpp:242
SUMOReal getLength() const
Returns the length of the edge.
Definition: ROEdge.h:160
unsigned int getNumApproaching() const
Returns the number of edges this edge is connected to.
Definition: ROEdge.cpp:299
bool prohibits(const ROVehicle *const vehicle) const
Returns whether this edge prohibits the given vehicle to pass it.
Definition: ROEdge.h:218
A normal edge.
Definition: ROEdge.h:75
SUMOReal getEffort(const ROVehicle *const veh, SUMOReal time) const
Returns the effort for this edge.
Definition: ROEdge.cpp:123
void buildTimeLines(const std::string &measure)
Builds the internal representation of the travel time/effort.
Definition: ROEdge.cpp:314
bool getStoredEffort(SUMOReal time, SUMOReal &ret) const
Retrieves the stored effort.
Definition: ROEdge.cpp:265
RONode *const myFromNode
The nodes this edge is connecting.
Definition: ROEdge.h:381
static size_t dictSize()
Returns the number of edges.
Definition: ROEdge.h:350
SUMOReal getNoiseEffort(const ROVehicle *const veh, SUMOReal time) const
Definition: ROEdge.cpp:254
#define SUMOReal
Definition: config.h:215
SUMOReal getCOEffort(const ROVehicle *const veh, SUMOReal time) const
Definition: ROEdge.cpp:182
Base class for nodes used by the router.
Definition: RONode.h:46
SUMOReal getTravelTime(const ROVehicle *const veh, SUMOReal time) const
Returns the travel time for this edge.
Definition: ROEdge.cpp:144
An edge where vehicles disappear (no vehicle may leave this edge)
Definition: ROEdge.h:81
static bool myHaveTTWarned
Information whether the edge has reported missing weights.
Definition: ROEdge.h:416
SVCPermissions getPermissions() const
Definition: ROEdge.h:223
virtual void addFollower(ROEdge *s, std::string dir="")
Adds information about a connected edge.
Definition: ROEdge.cpp:100
SUMOReal getMinimumTravelTime(const ROVehicle *const veh) const
Returns the travel time for this edge without using any stored timeLine.
Definition: ROEdge.cpp:176
EdgeType myType
The type of the edge.
Definition: ROEdge.h:425
ROEdge & operator=(const ROEdge &src)
Invalidated assignment operator.
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
Definition: ROEdge.h:175
const int myPriority
The edge priority (road class)
Definition: ROEdge.h:387