44template<
class E,
class L,
class N,
class V>
59 nullptr,
false,
nullptr,
true);
67 nullptr,
false,
nullptr,
true);
84 double compute(
const E* from,
const E* to,
double departPos,
double arrivalPos,
double speed,
85 SUMOTime msTime,
const N* onlyNode,
const SUMOVTypeParameter& pars, std::vector<const E*>& into,
bool allEdges =
false)
const {
87 WRITE_WARNINGF(
TL(
"Departure edge '%' does not allow pedestrians."), from->getID());
91 WRITE_WARNINGF(
TL(
"Destination edge '%' does not allow pedestrians."), to->getID());
94 _IntermodalTrip trip(from, to, departPos, arrivalPos, speed, msTime, onlyNode, pars);
95 std::vector<const _IntermodalEdge*> intoPed;
96 const bool silent = allEdges;
99 &trip, msTime, intoPed, silent);
103 if (pedEdge->includeInRoute(allEdges)) {
104 into.push_back(pedEdge->getEdge());
109#ifdef PedestrianRouter_DEBUG_ROUTES
110 std::cout <<
TIME2STEPS(msTime) <<
" trip from " << from->getID() <<
" to " << to->getID()
111 <<
" departPos=" << departPos
112 <<
" arrivalPos=" << arrivalPos
113 <<
" onlyNode=" << (onlyNode == 0 ?
"NULL" : onlyNode->getID())
115 <<
" resultEdges=" <<
toString(into)
119 return success ? time : -1.;
125 SUMOTime, std::vector<const E*>&,
bool) {
129 void prohibit(
const std::map<const E*, double>& toProhibit) {
130 std::map<const _IntermodalEdge*, double> toProhibitPE;
131 for (
auto item : toProhibit) {
132 toProhibitPE[
myPedNet->getBothDirections(item.first).first] = item.second;
133 toProhibitPE[
myPedNet->getBothDirections(item.first).second] = item.second;
140 if (edges.size() == 0) {
143 }
else if (edges.size() == 1) {
144 length = fabs(toPos - fromPos);
145 return length / speed;
148 int last = (int)edges.size() - 1;
149 for (
int i = 0; i < last; i++) {
150 std::vector<const E*> into;
151 const E* from = edges[i];
152 const E* to = edges[i + 1];
153 const double fp = (i == 0 ? fromPos : from->getLength() / 2);
154 const double tp = (i == (last - 1) ? toPos : to->getLength() / 2);
157 if (node == from->getToJunction()) {
158 length += from->getLength() - fromPos;
163 length += from->getLength();
165 if (i == (last - 1)) {
166 if (node == to->getFromJunction()) {
169 length += to->getLength() - toPos;
172 double time = this->
compute(from, to, fp, tp, speed, msTime, node, pars, into,
true);
175 for (
const E* edge : into) {
176 if (edge->isCrossing()) {
177 length += edge->getLength();
178 }
else if (edge->isWalkingArea()) {
180 length += edge->getLength();
184 throw ProcessError(
"Could not compute cost between edge '" + from->getID() +
"' and edge '" + to->getID() +
"'.");
198 if (from->getToJunction() == to->getFromJunction() || from->getToJunction() == to->getToJunction()) {
199 return from->getToJunction();
200 }
else if (from->getFromJunction() == to->getFromJunction() || from->getFromJunction() == to->getToJunction()) {
201 return from->getFromJunction();
const L * getSidewalk(const E *edge, SUMOVehicleClass svc=SVC_PEDESTRIAN)
#define WRITE_WARNINGF(...)
double gWeightsRandomFactor
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Computes the shortest path through a network using the Dijkstra algorithm.
the base edge type that is given to the internal router (SUMOAbstractRouter)
static double getTravelTimeStatic(const IntermodalEdge *const edge, const IntermodalTrip< E, N, V > *const trip, double time)
static double getTravelTimeStaticRandomized(const IntermodalEdge *const edge, const IntermodalTrip< E, N, V > *const trip, double time)
the intermodal network storing edges, connections and the mappings to the "real" edges
the "vehicle" type that is given to the internal router (SUMOAbstractRouter)
PedestrianRouter & operator=(const PedestrianRouter &s)
Invalidated assignment operator.
DijkstraRouter< _IntermodalEdge, _IntermodalTrip > _InternalRouter
_IntermodalNetwork * myPedNet
IntermodalTrip< MSEdge, MSJunction, SUMOVehicle > _IntermodalTrip
PedestrianRouter(_IntermodalNetwork *net)
IntermodalNetwork< MSEdge, MSLane, MSJunction, SUMOVehicle > _IntermodalNetwork
bool compute(const E *, const E *, const _IntermodalTrip *const, SUMOTime, std::vector< const E * > &, bool)
Builds the route between the given edges using the minimum effort at the given time The definition of...
PedestrianRouter()
Constructor.
void prohibit(const std::map< const E *, double > &toProhibit)
double compute(const E *from, const E *to, double departPos, double arrivalPos, double speed, SUMOTime msTime, const N *onlyNode, const SUMOVTypeParameter &pars, std::vector< const E * > &into, bool allEdges=false) const
Builds the route between the given edges using the minimum effort at the given time The definition of...
double recomputeWalkCosts(const std::vector< const E * > &edges, double speed, double fromPos, double toPos, SUMOTime msTime, const SUMOVTypeParameter &pars, double &length) const
IntermodalEdge< MSEdge, MSLane, MSJunction, SUMOVehicle > _IntermodalEdge
virtual SUMOAbstractRouter< E, _IntermodalTrip > * clone()
const N * getCommonNode(const E *from, const E *to) const
virtual ~PedestrianRouter()
Destructor.
_InternalRouter * myInternalRouter
SUMOAbstractRouter(const std::string &type, bool unbuildIsWarning, Operation operation, Operation ttOperation, const bool havePermissions, const bool haveRestrictions)
Structure representing possible vehicle parameter.