20 #ifndef PedestrianRouter_h
21 #define PedestrianRouter_h
46 #define TL_RED_PENALTY 20
52 template <
class E,
class L>
57 const std::vector<L*>& lanes = edge->getLanes();
58 for (
typename std::vector<L*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
71 template<
class E,
class N>
78 departPos(_departPos < 0 ? _from->getLength() + _departPos : _departPos),
79 arrivalPos(_arrivalPos < 0 ? _to->getLength() + _arrivalPos : _arrivalPos),
98 template<
class E,
class L,
class N>
100 typedef std::pair<PedestrianEdge*, PedestrianEdge*>
EdgePair;
120 #ifdef PedestrianRouter_DEBUG_NETWORK
121 std::cout <<
"initPedestrianNetwork\n";
124 unsigned int numericalID = 0;
125 for (
size_t i = 0; i < noE; i++) {
127 const L* lane = getSidewalk<E, L>(edge);
128 if (edge->isInternal() || lane == 0) {
130 }
else if (edge->isWalkingArea()) {
145 for (
size_t i = 0; i < noE; i++) {
147 const L* lane = getSidewalk<E, L>(edge);
148 if (edge->isInternal() || lane == 0) {
150 }
else if (edge->isWalkingArea()) {
163 for (
size_t i = 0; i < noE; i++) {
165 const L* lane = getSidewalk<E, L>(edge);
166 if (edge->isInternal() || lane == 0) {
171 const L* sidewalk = getSidewalk<E, L>(edge);
174 #ifdef PedestrianRouter_DEBUG_NETWORK
175 std::cout <<
" building connections from " << sidewalk->getID() <<
"\n";
177 std::vector<const L*> outgoing = sidewalk->getOutgoingLanes();
178 for (
typename std::vector<const L*>::iterator it = outgoing.begin(); it != outgoing.end(); ++it) {
179 const L* target = *it;
180 const E* targetEdge = &(target->getEdge());
181 #ifdef PedestrianRouter_DEBUG_NETWORK
182 std::cout <<
" lane=" << getSidewalk<E, L>(targetEdge)->
getID() << (target == getSidewalk<E, L>(targetEdge) ?
"(used)" :
"") <<
"\n";
184 if (target == getSidewalk<E, L>(targetEdge)) {
186 pair.first->myFollowingEdges.push_back(targetPair.first);
187 targetPair.second->myFollowingEdges.push_back(pair.second);
188 #ifdef PedestrianRouter_DEBUG_NETWORK
189 std::cout <<
" " << pair.first->getID() <<
" -> " << targetPair.first->getID() <<
"\n";
190 std::cout <<
" " << targetPair.second->getID() <<
" -> " << pair.second->getID() <<
"\n";
194 if (edge->isWalkingArea()) {
203 pair.first->myFollowingEdges.push_back(endConnector);
204 pair.second->myFollowingEdges.push_back(endConnector);
205 #ifdef PedestrianRouter_DEBUG_NETWORK
206 std::cout <<
" " << startConnector->
getID() <<
" -> " << pair.first->getID() <<
"\n";
207 std::cout <<
" " << startConnector->
getID() <<
" -> " << pair.second->getID() <<
"\n";
208 std::cout <<
" " << pair.first->getID() <<
" -> " << endConnector->
getID() <<
"\n";
209 std::cout <<
" " << pair.second->getID() <<
" -> " << endConnector->
getID() <<
"\n";
224 typename std::map<const E*, EdgePair>::const_iterator it =
myBidiLookup.find(e);
227 throw ProcessError(
"Edge '" + e->getID() +
"' not found in pedestrian network '");
234 typename std::map<const E*, EdgePair>::const_iterator it =
myFromToLookup.find(e);
237 throw ProcessError(
"Edge '" + e->getID() +
"' not found in pedestrian network '");
239 return (*it).second.first;
244 typename std::map<const E*, EdgePair>::const_iterator it =
myFromToLookup.find(e);
247 throw ProcessError(
"Edge '" + e->getID() +
"' not found in pedestrian network '");
249 return (*it).second.second;
274 if (trip->
node == 0) {
279 return (
myEdge->getFromJunction() != trip->
node
316 #ifdef PedestrianRouter_DEBUG_EFFORTS
317 std::cout <<
" effort for " <<
getID() <<
" at " << time <<
": " << length / trip->
speed + tlsDelay <<
" l=" << length <<
" s=" << trip->
speed <<
" tlsDelay=" << tlsDelay <<
"\n";
319 return length / trip->
speed + tlsDelay;
323 PedestrianEdge(
unsigned int numericalID,
const E* edge,
const L* lane,
bool forward,
bool connector =
false) :
324 Named(edge->
getID() + (edge->isWalkingArea() ?
"" :
325 ((forward ?
"_fwd" :
"_bwd") + std::string(connector ?
"_connector" :
"")))),
366 template<
class E,
class L,
class N,
class INTERNALROUTER>
388 SUMOTime msTime,
const N* onlyNode, std::vector<const E*>& into,
bool allEdges =
false) {
390 _PedestrianTrip trip(from, to, departPos, arrivalPos, speed, msTime, onlyNode);
391 std::vector<const _PedestrianEdge*> intoPed;
394 for (
size_t i = 0; i < intoPed.size(); ++i) {
395 if (intoPed[i]->includeInRoute(allEdges)) {
396 into.push_back(intoPed[i]->getEdge());
399 #ifdef PedestrianRouter_DEBUG_ROUTES
400 std::cout <<
TIME2STEPS(msTime) <<
" trip from " << from->getID() <<
" to " << to->getID()
401 <<
" departPos=" << departPos
402 <<
" arrivalPos=" << arrivalPos
403 <<
" onlyNode=" << (onlyNode == 0 ?
"NULL" : onlyNode->getID())
405 <<
" resultEdges=" <<
toString(into)
423 std::vector<_PedestrianEdge*> toProhibitPE;
424 for (
typename std::vector<E*>::const_iterator it = toProhibit.begin(); it != toProhibit.end(); ++it) {
444 template<
class E,
class L,
class N>
446 DijkstraRouterTT_Direct<PedestrianEdge<E, L, N>, PedestrianTrip<E, N>, prohibited_withRestrictions<PedestrianEdge<E, L, N>, PedestrianTrip<E, N> > > > { };
453 template<
class E,
class L,
class N>
456 template<
class E,
class L,
class N>
459 template<
class E,
class L,
class N>