22 #ifndef IntermodalEdge_h 23 #define IntermodalEdge_h 43 #define TL_RED_PENALTY 20 48 template <
class E,
class L>
53 const std::vector<L*>& lanes = edge->getLanes();
54 for (
typename std::vector<L*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
68 template<
class E,
class N,
class V>
71 IntermodalTrip(
const E* _from,
const E* _to,
double _departPos,
double _arrivalPos,
72 double _speed,
SUMOTime _departTime,
const N* _node,
76 departPos(_departPos < 0 ? _from->getLength() + _departPos : _departPos),
77 arrivalPos(_arrivalPos < 0 ? _to->getLength() + _arrivalPos : _arrivalPos),
111 template<
class E,
class L,
class N,
class V>
114 IntermodalEdge(
const std::string
id,
int numericalID,
const E* edge,
const std::string& line) :
116 myNumericalID(numericalID),
119 myLength(edge->getLength()) { }
136 return myNumericalID;
140 myFollowingEdges.push_back(s);
144 myFollowingEdges = edges;
148 myFollowingEdges.clear();
152 myFollowingEdges.erase(std::find(myFollowingEdges.begin(), myFollowingEdges.end(), edge));
157 return myFollowingEdges;
208 template<
class E,
class L,
class N,
class V>
211 PedestrianEdge(
int numericalID,
const E* edge,
const L* lane,
bool forward,
const double pos = -1.) :
212 IntermodalEdge<E, L, N, V>(edge->
getID() + (edge->isWalkingArea() ?
"" : (forward ?
"_fwd" :
"_bwd")) +
toString(pos), numericalID, edge,
"!ped"),
215 myStartPos(pos >= 0 ? pos : 0.) { }
218 return allEdges || (!this->getEdge()->isCrossing() && !this->getEdge()->isWalkingArea());
222 if (trip->
node == 0) {
227 return (this->getEdge()->getFromJunction() != trip->
node 228 && this->getEdge()->getToJunction() != trip->
node);
233 double length = this->getLength();
234 if (this->getEdge() == trip->
from && !myForward) {
237 if (this->getEdge() == trip->
to && myForward) {
240 if (this->getEdge() == trip->
from && myForward) {
241 length -= (trip->
departPos - myStartPos);
243 if (this->getEdge() == trip->
to && !myForward) {
250 if (this->getEdge()->isCrossing() && myLane->getIncomingLinkState() ==
LINKSTATE_TL_RED) {
254 #ifdef IntermodalRouter_DEBUG_EFFORTS 255 std::cout <<
" effort for " << trip->
getID() <<
" at " << time <<
" edge=" << edge->getID() <<
" effort=" << length / trip->
speed + tlsDelay <<
" l=" << length <<
" s=" << trip->
speed <<
" tlsDelay=" << tlsDelay <<
"\n";
257 return length / trip->
speed + tlsDelay;
virtual double getTravelTime(const IntermodalTrip< E, N, V > *const trip, double time) const
IntermodalEdge(const std::string id, int numericalID, const E *edge, const std::string &line)
const E *const myEdge
the original edge
const std::string & getLine() const
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
const std::string myLine
public transport line or ped vs car
virtual const std::vector< IntermodalEdge * > & getSuccessors(SUMOVehicleClass) const
virtual bool includeInRoute(bool) const
static double getTravelTimeStatic(const IntermodalEdge *const edge, const IntermodalTrip< E, N, V > *const trip, double time)
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
IntermodalTrip(const E *_from, const E *_to, double _departPos, double _arrivalPos, double _speed, SUMOTime _departTime, const N *_node, const V *_vehicle=0, const SVCPermissions _modeSet=SVC_PEDESTRIAN)
void addSuccessor(IntermodalEdge *s)
std::string time2string(SUMOTime t)
int getNumericalID() const
std::vector< IntermodalEdge * > myFollowingEdges
List of edges that may be approached from this edge.
const double myStartPos
the starting position for split edges
void removeSuccessor(const IntermodalEdge *const edge)
const E * getEdge() const
virtual bool prohibits(const IntermodalTrip< E, N, V > *const) const
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
SUMOVehicleClass getVClass() const
const SVCPermissions modeSet
const bool myForward
the direction of this edge
void setSuccessors(const std::vector< IntermodalEdge *> &edges)
const SUMOTime departTime
IntermodalTrip & operator=(const IntermodalTrip &)
Invalidated assignment operator.
the "vehicle" type that is given to the internal router (SUMOAbstractRouter)
const L * myLane
the original edge
virtual ~IntermodalEdge()
bool prohibits(const IntermodalTrip< E, N, V > *const trip) const
Base class for objects which have an id.
the base edge type that is given to the internal router (SUMOAbstractRouter)
The link has red light (must brake)
double myLength
adaptable length (for splitted edges)
std::string getID() const
the pedestrian edge type that is given to the internal router (SUMOAbstractRouter) ...
PedestrianEdge(int numericalID, const E *edge, const L *lane, bool forward, const double pos=-1.)
const int myNumericalID
the index in myEdges
const L * getSidewalk(const E *edge)
bool includeInRoute(bool allEdges) const
virtual double getTravelTime(const IntermodalTrip< E, N, V > *const, double) const
void setLength(const double length)