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 {
82  };
83 
84 
92  ROEdge(const std::string& id, RONode* from, RONode* to, unsigned int index, const int priority);
93 
94 
96  virtual ~ROEdge();
97 
98 
100 
101 
110  virtual void addLane(ROLane* lane);
111 
112 
120  virtual void addFollower(ROEdge* s, std::string dir = "");
121 
122 
126  void setType(EdgeType type);
127 
128 
138  void buildTimeLines(const std::string& measure);
140 
141 
142 
144 
145 
150  EdgeType getType() const {
151  return myType;
152  }
153 
154 
158  SUMOReal getLength() const {
159  return myLength;
160  }
161 
165  unsigned int getNumericalID() const {
166  return myIndex;
167  }
168 
169 
173  SUMOReal getSpeed() const {
174  return mySpeed;
175  }
176 
177 
181  unsigned int getLaneNo() const {
182  return (unsigned int) myLanes.size();
183  }
184 
185 
189  RONode* getFromNode() const {
190  return myFromNode;
191  }
192 
193 
197  RONode* getToNode() const {
198  return myToNode;
199  }
200 
201 
207  bool isConnectedTo(const ROEdge* const e) const {
208  return std::find(myFollowingEdges.begin(), myFollowingEdges.end(), e) != myFollowingEdges.end();
209  }
210 
211 
216  inline bool prohibits(const ROVehicle* const vehicle) const {
217  const SUMOVehicleClass vclass = vehicle->getVClass();
218  return (myCombinedPermissions & vclass) != vclass;
219  }
220 
222  return myCombinedPermissions;
223  }
224 
225 
230  bool allFollowersProhibit(const ROVehicle* const vehicle) const;
232 
233 
234 
236 
237 
244  void addEffort(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd);
245 
246 
253  void addTravelTime(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd);
254 
255 
263  unsigned int getNoFollowing() const;
264 
265 
270  ROEdge* getFollower(unsigned int pos) const {
271  return myFollowingEdges[pos];
272  }
273 
274 
275 #ifdef HAVE_INTERNAL // catchall for internal stuff
276 
283  unsigned int getNumApproaching() const;
284 
285 
290  ROEdge* getApproaching(unsigned int pos) const {
291  return myApproachingEdges[pos];
292  }
293 #endif
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 
421 #ifdef HAVE_INTERNAL // catchall for internal stuff
422  std::vector<ROEdge*> myApproachingEdges;
424 #endif
425 
428 
430  std::vector<ROLane*> myLanes;
431 
434 
435  static std::vector<ROEdge*> myEdges;
436 
437 
438 private:
445  SUMOReal getTravelTime(SUMOReal time) const;
446 
447 private:
449  ROEdge(const ROEdge& src);
450 
452  ROEdge& operator=(const ROEdge& src);
453 
454 };
455 
456 
457 #endif
458 
459 /****************************************************************************/
460 
RONode * getToNode() const
Returns the node this edge ends at.
Definition: ROEdge.h:197
EdgeType getType() const
Returns the type of the edge.
Definition: ROEdge.h:150
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:270
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:135
static std::vector< ROEdge * > myEdges
Definition: ROEdge.h:435
SUMOVehicleClass getVClass() const
Definition: ROVehicle.h:117
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:360
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:208
SUMOReal getCO2Effort(const ROVehicle *const veh, SUMOReal time) const
Definition: ROEdge.cpp:196
bool isConnectedTo(const ROEdge *const e) const
returns the information whether this edge is directly connected to the given
Definition: ROEdge.h:207
unsigned int getLaneNo() const
Returns the number of lanes this edge has.
Definition: ROEdge.h:181
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:433
void addTravelTime(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd)
Adds a travel time value.
Definition: ROEdge.cpp:118
RONode * getFromNode() const
Returns the node this edge starts at.
Definition: ROEdge.h:189
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:57
void setType(EdgeType type)
Sets the type of te edge.
Definition: ROEdge.cpp:312
bool allFollowersProhibit(const ROVehicle *const vehicle) const
Returns whether this edge succeding edges prohibit the given vehicle to pass them.
Definition: ROEdge.cpp:349
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:220
SUMOReal getNOxEffort(const ROVehicle *const veh, SUMOReal time) const
Definition: ROEdge.cpp:232
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:165
An edge representing a whole district.
Definition: ROEdge.h:77
std::vector< ROLane * > myLanes
This edge&#39;s lanes.
Definition: ROEdge.h:430
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
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:292
void addEffort(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd)
Adds a weight value.
Definition: ROEdge.cpp:111
int getPriority() const
get edge priority (road class)
Definition: ROEdge.h:364
SUMOReal getFuelEffort(const ROVehicle *const veh, SUMOReal time) const
Definition: ROEdge.cpp:244
SUMOReal getLength() const
Returns the length of the edge.
Definition: ROEdge.h:158
bool prohibits(const ROVehicle *const vehicle) const
Returns whether this edge prohibits the given vehicle to pass it.
Definition: ROEdge.h:216
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:125
void buildTimeLines(const std::string &measure)
Builds the internal representation of the travel time/effort.
Definition: ROEdge.cpp:318
bool getStoredEffort(SUMOReal time, SUMOReal &ret) const
Retrieves the stored effort.
Definition: ROEdge.cpp:267
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:256
#define SUMOReal
Definition: config.h:221
SUMOReal getCOEffort(const ROVehicle *const veh, SUMOReal time) const
Definition: ROEdge.cpp:184
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:146
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:221
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:178
EdgeType myType
The type of the edge.
Definition: ROEdge.h:427
ROEdge & operator=(const ROEdge &src)
Invalidated assignment operator.
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
Definition: ROEdge.h:173
const int myPriority
The edge priority (road class)
Definition: ROEdge.h:387