21 #ifndef IntermodalEdge_h 22 #define IntermodalEdge_h 43 #define TL_RED_PENALTY 20 48 template <
class E,
class L>
50 if (edge ==
nullptr) {
54 const std::vector<L*>& lanes = edge->getLanes();
55 for (
const L*
const lane : lanes) {
60 for (
const L*
const lane : lanes) {
74 template<
class E,
class N,
class V>
77 IntermodalTrip(
const E* _from,
const E* _to,
double _departPos,
double _arrivalPos,
78 double _speed,
SUMOTime _departTime,
const N* _node,
82 departPos(_departPos < 0 ? _from->getLength() + _departPos : _departPos),
83 arrivalPos(_arrivalPos < 0 ? _to->getLength() + _arrivalPos : _arrivalPos),
117 template<
class E,
class L,
class N,
class V>
120 IntermodalEdge(
const std::string
id,
int numericalID,
const E* edge,
const std::string& line) :
122 myNumericalID(numericalID),
125 myLength(edge == nullptr ? 0. : edge->getLength()),
126 myEfforts(nullptr) { }
143 return myNumericalID;
147 myFollowingEdges.push_back(s);
151 myFollowingEdges = edges;
155 myFollowingEdges.clear();
159 myFollowingEdges.erase(std::find(myFollowingEdges.begin(), myFollowingEdges.end(), edge));
164 return myFollowingEdges;
176 return edge ==
nullptr ? 0. : edge->
getTravelTime(trip, time);
196 return myEfforts !=
nullptr;
230 template<
class E,
class L,
class N,
class V>
233 PedestrianEdge(
int numericalID,
const E* edge,
const L* lane,
bool forward,
const double pos = -1.) :
234 IntermodalEdge<E, L, N, V>(edge->
getID() + (edge->isWalkingArea() ?
"" : (forward ?
"_fwd" :
"_bwd")) +
toString(pos), numericalID, edge,
"!ped"),
237 myStartPos(pos >= 0 ? pos : (forward ? 0. : edge->getLength())) { }
240 return allEdges || (!this->getEdge()->isCrossing() && !this->getEdge()->isWalkingArea());
244 if (trip->
node == 0) {
249 return (this->getEdge()->getFromJunction() != trip->
node 250 && this->getEdge()->getToJunction() != trip->
node);
255 double length = this->getLength();
256 if (this->getEdge() == trip->
from && !myForward && trip->
departPos < myStartPos) {
257 length = trip->
departPos - (myStartPos - this->getLength());
259 if (this->getEdge() == trip->
to && myForward && trip->
arrivalPos < myStartPos + this->getLength()) {
262 if (this->getEdge() == trip->
from && myForward && trip->
departPos > myStartPos) {
263 length -= (trip->
departPos - myStartPos);
265 if (this->getEdge() == trip->
to && !myForward && trip->
arrivalPos > myStartPos - this->getLength()) {
266 length -= (trip->
arrivalPos - (myStartPos - this->getLength()));
272 if (this->getEdge()->isCrossing() && myLane->getIncomingLinkState() ==
LINKSTATE_TL_RED) {
276 #ifdef IntermodalRouter_DEBUG_EFFORTS 277 std::cout <<
" effort for " << trip->
getID() <<
" at " << time <<
" edge=" << edge->getID() <<
" effort=" << length / trip->
speed + tlsDelay <<
" l=" << length <<
" s=" << trip->
speed <<
" tlsDelay=" << tlsDelay <<
"\n";
279 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)
static double getEffortStatic(const IntermodalEdge *const edge, const IntermodalTrip< E, N, V > *const trip, double time)
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)
virtual double getEffort(const IntermodalTrip< E, N, V > *const, double) const
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
ValueTimeLine< double > * myEfforts
Container for passing effort varying over time for the edge.
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)