Eclipse SUMO - Simulation of Urban MObility
NBPTLineCont.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // Container for NBPTLine during netbuild
16 /****************************************************************************/
17 
18 #include <iostream>
20 #include <utils/common/ToString.h>
23 #include "NBPTLineCont.h"
24 #include "NBPTStop.h"
25 #include "NBEdge.h"
26 #include "NBNode.h"
27 #include "NBVehicle.h"
28 #include "NBPTStopCont.h"
29 
30 //#define DEBUG_FIND_WAY
31 #define DEBUGSTOPID ""
32 
33 // ===========================================================================
34 // static value definitions
35 // ===========================================================================
36 const int NBPTLineCont::FWD(1);
37 const int NBPTLineCont::BWD(-1);
38 // ===========================================================================
39 // method definitions
40 // ===========================================================================
41 
43 
44 
46  for (auto& myPTLine : myPTLines) {
47  delete myPTLine.second;
48  }
49  myPTLines.clear();
50 }
51 
52 void
54  myPTLines[ptLine->getLineID()] = ptLine;
55 }
56 
58  for (auto& item : myPTLines) {
59  if (item.second->getMyWays().size() > 0) {
60  // loaded from OSM rather than ptline input. We can use extra
61  // information to reconstruct route and stops
62  constructRoute(item.second, ec);
63  // map stops to ways, using the constructed route for loose stops
64  reviseStops(item.second, ec, sc);
65  }
66  }
67 }
68 
70  const std::vector<std::string>& waysIds = line->getMyWays();
71  if (waysIds.size() <= 1) {
72  WRITE_WARNING("Cannot revise pt stop localization for pt line: " + line->getLineID() + ", which consist of one way only. Ignoring!");
73  return;
74  }
75  if (line->getRoute().size() == 0) {
76  WRITE_WARNING("Cannot revise pt stop localization for pt line: " + line->getLineID() + ", which has no route edges. Ignoring!");
77  return;
78  }
79  std::vector<NBPTStop*> stops = line->getStops();
80  for (NBPTStop* stop : stops) {
81  //get the corresponding and one of the two adjacent ways
82  stop = findWay(line, stop, ec, sc);
83  auto waysIdsIt = std::find(waysIds.begin(), waysIds.end(), stop->getOrigEdgeId());
84  if (waysIdsIt == waysIds.end()) {
85  // warning already given
86  continue;
87  }
88  // find directional edge (OSM ways are bidirectional)
89  std::vector<long long int>* way = line->getWaysNodes(stop->getOrigEdgeId());
90  if (way == nullptr) {
91  WRITE_WARNING("Cannot assign stop '" + stop->getID() + "' on edge '" + stop->getOrigEdgeId() + "' to pt line '" + line->getLineID() + "' (wayNodes not found). Ignoring!");
92  continue;
93  }
94 
95 
96  int dir;
97  std::string adjIdPrev;
98  std::string adjIdNext;
99  if (waysIdsIt != waysIds.begin()) {
100  adjIdPrev = *(waysIdsIt - 1);
101  }
102  if (waysIdsIt != (waysIds.end() - 1)) {
103  adjIdNext = *(waysIdsIt + 1);
104  }
105  std::vector<long long int>* wayPrev = line->getWaysNodes(adjIdPrev);
106  std::vector<long long int>* wayNext = line->getWaysNodes(adjIdNext);
107  if (wayPrev == nullptr && wayNext == nullptr) {
108  WRITE_WARNING("Cannot revise pt stop localization for incomplete pt line: " + line->getLineID()
109  + ". Ignoring!");
110  continue;
111  }
112  long long int wayEnds = *(way->end() - 1);
113  long long int wayBegins = *(way->begin());
114  long long int wayPrevEnds = wayPrev != nullptr ? *(wayPrev->end() - 1) : 0;
115  long long int wayPrevBegins = wayPrev != nullptr ? *(wayPrev->begin()) : 0;
116  long long int wayNextEnds = wayNext != nullptr ? *(wayNext->end() - 1) : 0;
117  long long int wayNextBegins = wayNext != nullptr ? *(wayNext->begin()) : 0;
118  if (wayBegins == wayPrevEnds || wayBegins == wayPrevBegins || wayEnds == wayNextBegins
119  || wayEnds == wayNextEnds) {
120  dir = FWD;
121  } else if (wayEnds == wayPrevBegins || wayEnds == wayPrevEnds || wayBegins == wayNextEnds
122  || wayBegins == wayNextBegins) {
123  dir = BWD;
124  } else {
125  WRITE_WARNING("Cannot revise pt stop localization for incomplete pt line: " + line->getLineID()
126  + ". Ignoring!");
127  continue;
128  }
129 
130  std::string edgeId = stop->getEdgeId();
131  NBEdge* current = ec.getByID(edgeId);
132  int assignedTo = edgeId.at(0) == '-' ? BWD : FWD;
133 
134  if (dir != assignedTo) {
135  NBEdge* reverse = NBPTStopCont::getReverseEdge(current);
136  if (reverse == nullptr) {
137  WRITE_WARNING("Could not re-assign PT stop: " + stop->getID() + " probably broken osm file");
138  continue;
139  }
140  stop->setEdgeId(reverse->getID(), ec);
141  WRITE_WARNING("PT stop: " + stop->getID() + " has been moved to edge: " + reverse->getID());
142  }
143  myServedPTStops.insert(stop->getID());
144  stop->addLine(line->getRef());
145  }
146 }
147 
148 NBPTStop*
149 NBPTLineCont::findWay(NBPTLine* line, NBPTStop* stop, const NBEdgeCont& ec, NBPTStopCont& sc) const {
150  const std::vector<std::string>& waysIds = line->getMyWays();
151 #ifdef DEBUG_FIND_WAY
152  if (stop->getID() == DEBUGSTOPID) {
153  std::cout << " stop=" << stop->getID() << " line=" << line->getLineID() << " edgeID=" << stop->getEdgeId() << " origID=" << stop->getOrigEdgeId() << "\n";
154  }
155 #endif
156  if (stop->isLoose()) {
157  // find closest edge in route
158  double minDist = std::numeric_limits<double>::max();
159  NBEdge* best = nullptr;
160  for (NBEdge* edge : line->getRoute()) {
161  const double dist = edge->getLaneShape(0).distance2D(stop->getPosition());
162  if (dist < minDist) {
163  best = edge;
164  minDist = dist;
165  }
166  }
167 #ifdef DEBUG_FIND_WAY
168  if (stop->getID() == DEBUGSTOPID) {
169  std::cout << " best=" << Named::getIDSecure(best) << " minDist=" << minDist << " wayID=" << getWayID(best->getID())
170  << " found=" << (std::find(waysIds.begin(), waysIds.end(), getWayID(best->getID())) != waysIds.end())
171  << " wayIDs=" << toString(waysIds) << "\n";
172  }
173 #endif
174  if (minDist < OptionsCont::getOptions().getFloat("ptline.match-dist")) {
175  const std::string wayID = getWayID(best->getID());
176  if (stop->getEdgeId() == "") {
177  stop->setEdgeId(best->getID(), ec);
178  stop->setMyOrigEdgeId(wayID);
179  } else if (stop->getEdgeId() != best->getID()) {
180  // stop is used by multiple lines and mapped to different edges.
181  // check if an alterantive stop already exists
182  NBPTStop* newStop = sc.findStop(wayID, stop->getPosition());
183  if (newStop == nullptr) {
184  newStop = new NBPTStop(stop->getID() + "@" + line->getLineID(), stop->getPosition(), best->getID(), wayID, stop->getLength(), stop->getName(), stop->getPermissions());
185  newStop->setEdgeId(best->getID(), ec); // trigger lane assignment
186  sc.insert(newStop);
187  }
188  line->replaceStop(stop, newStop);
189  stop = newStop;
190  }
191  } else {
192  WRITE_WARNING("Could not assign stop '" + stop->getID() + "' to pt line '" + line->getLineID()
193  + "' (closest edge '" + best->getID() + "', distance " + toString(minDist) + "). Ignoring!");
194  }
195  } else {
196  // if the stop is part of an edge, find that edge among the line edges
197  auto waysIdsIt = waysIds.begin();
198  for (; waysIdsIt != waysIds.end(); waysIdsIt++) {
199  if ((*waysIdsIt) == stop->getOrigEdgeId()) {
200  break;
201  }
202  }
203 
204  if (waysIdsIt == waysIds.end()) {
205  // stop edge not found, try additional edges
206  for (auto& edgeCand : stop->getMyAdditionalEdgeCandidates()) {
207  bool found = false;
208  waysIdsIt = waysIds.begin();
209  for (; waysIdsIt != waysIds.end(); waysIdsIt++) {
210  if ((*waysIdsIt) == edgeCand.first) {
211  if (stop->setEdgeId(edgeCand.second, ec)) {
212  stop->setMyOrigEdgeId(edgeCand.first);
213  found = true;
214  break;
215  }
216  }
217  }
218  if (found) {
219  break;
220  }
221  }
222  if (waysIdsIt == waysIds.end()) {
223  WRITE_WARNING("Cannot assign stop '" + stop->getID() + "' on edge '" + stop->getOrigEdgeId() + "' to pt line '" + line->getLineID() + "'. Ignoring!");
224  }
225  }
226  }
227  return stop;
228 }
229 
230 
232  std::vector<NBEdge*> edges;
233 
234  NBNode* first = nullptr;
235  NBNode* last = nullptr;
236  std::vector<NBEdge*> prevWayEdges;
237  std::vector<NBEdge*> prevWayMinusEdges;
238  prevWayEdges.clear();
239  prevWayMinusEdges.clear();
240  std::vector<NBEdge*> currentWayEdges;
241  std::vector<NBEdge*> currentWayMinusEdges;
242  for (auto it3 = pTLine->getMyWays().begin();
243  it3 != pTLine->getMyWays().end(); it3++) {
244 
245  if (cont.retrieve(*it3, false) != nullptr) {
246  currentWayEdges.push_back(cont.retrieve(*it3, false));
247  } else {
248  int i = 0;
249  while (cont.retrieve(*it3 + "#" + std::to_string(i), false) != nullptr) {
250  currentWayEdges.push_back(cont.retrieve(*it3 + "#" + std::to_string(i), false));
251  i++;
252  }
253  }
254 
255  if (cont.retrieve("-" + *it3, false) != nullptr) {
256  currentWayMinusEdges.push_back(cont.retrieve("-" + *it3, false));
257  } else {
258  int i = 0;
259  while (cont.retrieve("-" + *it3 + "#" + std::to_string(i), false) != nullptr) {
260  currentWayMinusEdges.insert(currentWayMinusEdges.begin(),
261  cont.retrieve("-" + *it3 + "#" + std::to_string(i), false));
262  i++;
263  }
264  }
265  if (currentWayEdges.empty()) {
266  continue;
267  }
268  if (last == currentWayEdges.front()->getFromNode() && last != nullptr) {
269  if (!prevWayEdges.empty()) {
270  edges.insert(edges.end(), prevWayEdges.begin(), prevWayEdges.end());
271  prevWayEdges.clear();
272  prevWayMinusEdges.clear();
273  }
274  edges.insert(edges.end(), currentWayEdges.begin(), currentWayEdges.end());
275  last = currentWayEdges.back()->getToNode();
276  } else if (last == currentWayEdges.back()->getToNode() && last != nullptr) {
277  if (!prevWayEdges.empty()) {
278  edges.insert(edges.end(), prevWayEdges.begin(), prevWayEdges.end());
279  prevWayEdges.clear();
280  prevWayMinusEdges.clear();
281  }
282  if (currentWayMinusEdges.empty()) {
283  currentWayEdges.clear();
284  last = nullptr;
285  continue;
286  } else {
287  edges.insert(edges.end(), currentWayMinusEdges.begin(), currentWayMinusEdges.end());
288  last = currentWayMinusEdges.back()->getToNode();
289  }
290  } else if (first == currentWayEdges.front()->getFromNode() && first != nullptr) {
291  edges.insert(edges.end(), prevWayMinusEdges.begin(), prevWayMinusEdges.end());
292  edges.insert(edges.end(), currentWayEdges.begin(), currentWayEdges.end());
293  last = currentWayEdges.back()->getToNode();
294  prevWayEdges.clear();
295  prevWayMinusEdges.clear();
296  } else if (first == currentWayEdges.back()->getToNode() && first != nullptr) {
297  edges.insert(edges.end(), prevWayMinusEdges.begin(), prevWayMinusEdges.end());
298  if (currentWayMinusEdges.empty()) {
299  currentWayEdges.clear();
300  last = nullptr;
301  prevWayEdges.clear();
302  prevWayMinusEdges.clear();
303  continue;
304  } else {
305  edges.insert(edges.end(), currentWayMinusEdges.begin(), currentWayMinusEdges.end());
306  last = currentWayMinusEdges.back()->getToNode();
307  prevWayEdges.clear();
308  prevWayMinusEdges.clear();
309  }
310  } else {
311  if (it3 != pTLine->getMyWays().begin()) {
312  WRITE_WARNING("Incomplete route for ptline '" + toString(pTLine->getLineID()) +
313  (pTLine->getName() != "" ? "' (" + pTLine->getName() + ")" : ""));
314  }
315  prevWayEdges = currentWayEdges;
316  prevWayMinusEdges = currentWayMinusEdges;
317  if (!prevWayEdges.empty()) {
318  first = prevWayEdges.front()->getFromNode();
319  last = prevWayEdges.back()->getToNode();
320  } else {
321  first = nullptr;
322  last = nullptr;
323  }
324  }
325  currentWayEdges.clear();
326  currentWayMinusEdges.clear();
327  }
328  pTLine->setEdges(edges);
329 }
330 
331 
332 void
333 NBPTLineCont::addEdges2Keep(const OptionsCont& oc, std::set<std::string>& into) {
334  if (oc.isSet("ptline-output")) {
335  for (auto& item : myPTLines) {
336  for (auto edge : item.second->getRoute()) {
337  into.insert(edge->getID());
338  }
339  }
340  }
341 }
342 
343 
344 std::set<std::string>&
346  return myServedPTStops;
347 }
348 
349 
350 void
352  std::map<std::string, SUMOVehicleClass> types;
353  types["bus"] = SVC_BUS;
354  types["tram"] = SVC_TRAM;
355  types["train"] = SVC_RAIL;
356  types["subway"] = SVC_RAIL_URBAN;
357  types["light_rail"] = SVC_RAIL_URBAN;
358  types["ferry"] = SVC_SHIP;
359 
361  ec.getAllRouterEdges(), true, &NBRouterEdge::getTravelTimeStatic, nullptr, true);
362 
363  for (auto& item : myPTLines) {
364  NBPTLine* line = item.second;
365  std::vector<NBPTStop*> stops = line->getStops();
366  if (stops.size() < 2) {
367  continue;
368  }
369  if (types.count(line->getType()) == 0) {
370  WRITE_WARNING("Could not determine vehicle class for public transport line of type '"
371  + line->getType() + "'.");
372  continue;
373  }
374  NBVehicle veh(line->getRef(), types[line->getType()]);
375  std::vector<NBPTStop*> newStops;
376  NBPTStop* from = nullptr;
377  for (auto it = stops.begin(); it != stops.end(); ++it) {
378  NBPTStop* to = *it;
379  NBPTStop* used = *it;
380  if (to->getBidiStop() != nullptr) {
381  double best = std::numeric_limits<double>::max();
382  NBPTStop* to2 = to->getBidiStop();
383  if (from == nullptr) {
384  if ((it + 1) != stops.end()) {
385  from = to;
386  NBPTStop* from2 = to2;
387  to = *(it + 1);
388  const double c1 = getCost(ec, *router, from, to, &veh);
389  const double c2 = getCost(ec, *router, from2, to, &veh);
390  //std::cout << " from=" << from->getID() << " to=" << to->getID() << " c1=" << MIN2(10000.0, c1) << "\n";
391  //std::cout << " from2=" << from2->getID() << " to=" << to->getID() << " c2=" << MIN2(10000.0, c2) << "\n";
392  best = c1;
393  if (to->getBidiStop() != nullptr) {
394  to2 = to->getBidiStop();
395  const double c3 = getCost(ec, *router, from, to2, &veh);
396  const double c4 = getCost(ec, *router, from2, to2, &veh);
397  //std::cout << " from=" << from->getID() << " to2=" << to2->getID() << " c3=" << MIN2(10000.0, c3) << "\n";
398  //std::cout << " from2=" << from2->getID() << " to2=" << to2->getID() << " c4=" << MIN2(10000.0, c4) << "\n";
399  if (c2 < best) {
400  used = from2;
401  best = c2;
402  }
403  if (c3 < best) {
404  used = from;
405  best = c3;
406  }
407  if (c4 < best) {
408  used = from2;
409  best = c4;
410  }
411  } else {
412  if (c2 < c1) {
413  used = from2;
414  best = c2;
415  } else {
416  best = c1;
417  }
418  }
419  }
420  } else {
421  const double c1 = getCost(ec, *router, from, to, &veh);
422  const double c2 = getCost(ec, *router, from, to2, &veh);
423  //std::cout << " from=" << from->getID() << " to=" << to->getID() << " c1=" << MIN2(10000.0, c1) << "\n";
424  //std::cout << " from=" << from->getID() << " t2o=" << to2->getID() << " c2=" << MIN2(10000.0, c2) << "\n";
425  if (c2 < c1) {
426  used = to2;
427  best = c2;
428  } else {
429  best = c1;
430  }
431 
432  }
433  if (best < std::numeric_limits<double>::max()) {
434  from = used;
435  } else {
436  WRITE_WARNING("Could not determine direction for line '" + toString(line->getLineID()) + "' at stop '" + used->getID() + "'");
437  };
438  }
439  from = used;
440  newStops.push_back(used);
441  }
442  assert(stops.size() == newStops.size());
443  line->replaceStops(newStops);
444  }
445  delete router;
446 }
447 
448 
449 double
451  const NBPTStop* from, const NBPTStop* to, const NBVehicle* veh) {
452  NBEdge* fromEdge = ec.getByID(from->getEdgeId());
453  NBEdge* toEdge = ec.getByID(to->getEdgeId());
454  if (fromEdge == nullptr || toEdge == nullptr) {
455  return std::numeric_limits<double>::max();
456  }
457  std::vector<const NBRouterEdge*> route;
458  router.compute(fromEdge, toEdge, veh, 0, route);
459  if (route.size() == 0) {
460  return std::numeric_limits<double>::max();
461  } else {
462  return router.recomputeCosts(route, veh, 0);
463  }
464 }
465 
466 
467 std::string
468 NBPTLineCont::getWayID(const std::string& edgeID) {
469  std::size_t found = edgeID.rfind("#");
470  std::string result = edgeID;
471  if (found != std::string::npos) {
472  result = edgeID.substr(0, found);
473  }
474  if (result[0] == '-') {
475  result = result.substr(1);
476  }
477  return result;
478 }
SUMOAbstractRouter::compute
virtual bool compute(const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E * > &into, bool silent=false)=0
Builds the route between the given edges using the minimum effort at the given time The definition of...
OptionsCont::isSet
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
Definition: OptionsCont.cpp:135
NBPTLine::getName
const std::string & getName() const
Definition: NBPTLine.h:46
ToString.h
NBPTStopCont
Definition: NBPTStopCont.h:27
NBEdgeCont::retrieve
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
Definition: NBEdgeCont.cpp:246
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
NBEdgeCont
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:60
NBPTLineCont::BWD
static const int BWD
Definition: NBPTLineCont.h:54
NBPTLineCont::constructRoute
void constructRoute(NBPTLine *myPTLine, NBEdgeCont &cont)
Definition: NBPTLineCont.cpp:231
NBRouterEdge::getTravelTimeStatic
static double getTravelTimeStatic(const NBRouterEdge *const edge, const NBVehicle *const, double)
Definition: NBEdge.h:81
NBPTLineCont::process
void process(NBEdgeCont &ec, NBPTStopCont &sc)
Definition: NBPTLineCont.cpp:57
NBPTLineCont::insert
void insert(NBPTLine *ptLine)
insert new line
Definition: NBPTLineCont.cpp:53
NBPTStop::getPermissions
SVCPermissions getPermissions() const
Definition: NBPTStop.cpp:131
OptionsCont.h
NBPTLine::getStops
std::vector< NBPTStop * > getStops()
Definition: NBPTLine.cpp:43
NBPTLine::replaceStop
void replaceStop(NBPTStop *oldStop, NBPTStop *newStop)
replace the given stop
Definition: NBPTLine.cpp:211
NBPTStop::getLength
double getLength() const
Definition: NBPTStop.cpp:161
NBPTStop::getMyAdditionalEdgeCandidates
const std::map< std::string, std::string > & getMyAdditionalEdgeCandidates() const
Definition: NBPTStop.cpp:180
NBPTLineCont::myServedPTStops
std::set< std::string > myServedPTStops
Definition: NBPTLineCont.h:68
MsgHandler.h
NBPTLineCont::FWD
static const int FWD
Definition: NBPTLineCont.h:53
NBPTLine
Definition: NBPTLine.h:33
NBPTLine::getType
const std::string & getType() const
Definition: NBPTLine.h:50
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:57
NBPTStop::getID
std::string getID() const
Definition: NBPTStop.cpp:48
NBPTLine::getWaysNodes
std::vector< long long int > * getWaysNodes(std::string wayId)
Definition: NBPTLine.cpp:102
NBEdgeCont::getByID
NBEdge * getByID(const std::string &edgeID) const
Returns the edge with id if it exists.
Definition: NBEdgeCont.cpp:1045
NBPTStop::getOrigEdgeId
const std::string getOrigEdgeId() const
Definition: NBPTStop.cpp:53
NBPTStopCont::getReverseEdge
static NBEdge * getReverseEdge(NBEdge *edge)
Definition: NBPTStopCont.cpp:284
NBPTLineCont::NBPTLineCont
NBPTLineCont()
constructor
Definition: NBPTLineCont.cpp:42
SVC_RAIL
@ SVC_RAIL
vehicle is a not electrified rail
Definition: SUMOVehicleClass.h:188
SVC_RAIL_URBAN
@ SVC_RAIL_URBAN
vehicle is a city rail
Definition: SUMOVehicleClass.h:186
NBPTLine::getLineID
const std::string & getLineID() const
Definition: NBPTLine.h:42
NBPTStop::getEdgeId
const std::string getEdgeId() const
Definition: NBPTStop.cpp:59
DijkstraRouter
Computes the shortest path through a network using the Dijkstra algorithm.
Definition: DijkstraRouter.h:61
NBPTLineCont::fixBidiStops
void fixBidiStops(const NBEdgeCont &ec)
select the correct stop on superposed rail edges
Definition: NBPTLineCont.cpp:351
NBEdge
The representation of a single edge during network building.
Definition: NBEdge.h:91
NBPTLineCont::~NBPTLineCont
~NBPTLineCont()
destructor
Definition: NBPTLineCont.cpp:45
SVC_TRAM
@ SVC_TRAM
vehicle is a light rail
Definition: SUMOVehicleClass.h:184
NBPTLineCont::findWay
NBPTStop * findWay(NBPTLine *line, NBPTStop *stop, const NBEdgeCont &ec, NBPTStopCont &sc) const
Definition: NBPTLineCont.cpp:149
NBPTLine::replaceStops
void replaceStops(std::vector< NBPTStop * > stops)
Definition: NBPTLine.h:65
NBPTLineCont::getCost
static double getCost(const NBEdgeCont &ec, SUMOAbstractRouter< NBRouterEdge, NBVehicle > &router, const NBPTStop *from, const NBPTStop *to, const NBVehicle *veh)
Definition: NBPTLineCont.cpp:450
NBPTStop::isLoose
bool isLoose() const
Definition: NBPTStop.h:90
NBPTLineCont.h
NBPTLineCont::getServedPTStops
std::set< std::string > & getServedPTStops()
Definition: NBPTLineCont.cpp:345
NBPTLineCont::addEdges2Keep
void addEdges2Keep(const OptionsCont &oc, std::set< std::string > &into)
add edges that must be kept
Definition: NBPTLineCont.cpp:333
NBPTStop::setMyOrigEdgeId
void setMyOrigEdgeId(const std::string &myOrigEdgeId)
Definition: NBPTStop.cpp:186
NBVehicle
A vehicle as used by router.
Definition: NBVehicle.h:43
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
NBPTLine::getRoute
const std::vector< NBEdge * > & getRoute() const
Definition: NBPTLine.cpp:136
SVC_SHIP
@ SVC_SHIP
is an arbitrary ship
Definition: SUMOVehicleClass.h:195
SUMOAbstractRouter< NBRouterEdge, NBVehicle >
PositionVector::distance2D
double distance2D(const Position &p, bool perpendicular=false) const
closest 2D-distance to point p (or -1 if perpendicular is true and the point is beyond this vector)
Definition: PositionVector.cpp:1259
NBPTLineCont::reviseStops
void reviseStops(NBPTLine *line, const NBEdgeCont &ec, NBPTStopCont &sc)
find directional edge for all stops of the line
Definition: NBPTLineCont.cpp:69
NBPTStopCont::findStop
NBPTStop * findStop(const std::string &origEdgeID, Position pos, double threshold=1) const
Definition: NBPTStopCont.cpp:413
OptionsCont::getFloat
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
Definition: OptionsCont.cpp:208
NBPTStop::getBidiStop
NBPTStop * getBidiStop() const
Definition: NBPTStop.h:86
NBEdge::getLaneShape
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
Definition: NBEdge.cpp:879
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
NBPTStop::getPosition
const Position & getPosition() const
Definition: NBPTStop.cpp:71
NBPTLine::setEdges
void setEdges(const std::vector< NBEdge * > &edges)
Definition: NBPTLine.cpp:110
SUMOAbstractRouter::recomputeCosts
double recomputeCosts(const std::vector< const E * > &edges, const V *const v, SUMOTime msTime, double *lengthp=nullptr) const
Definition: SUMOAbstractRouter.h:195
NBPTStop::getName
const std::string getName() const
Definition: NBPTStop.cpp:65
NBPTLine::getMyWays
const std::vector< std::string > & getMyWays() const
Definition: NBPTLine.cpp:99
NBPTStop.h
NBPTLine::getRef
const std::string & getRef() const
get line reference (not unique)
Definition: NBPTLine.h:61
Named::getIDSecure
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
Definition: Named.h:69
SVC_BUS
@ SVC_BUS
vehicle is a bus
Definition: SUMOVehicleClass.h:165
DijkstraRouter.h
NBPTLineCont::myPTLines
std::map< std::string, NBPTLine * > myPTLines
The map of names to pt lines.
Definition: NBPTLineCont.h:57
NBNode
Represents a single node (junction) during network building.
Definition: NBNode.h:67
NBVehicle.h
NBPTStopCont::insert
bool insert(NBPTStop *ptStop)
Inserts a node into the map.
Definition: NBPTStopCont.cpp:38
NBPTStop::setEdgeId
bool setEdgeId(std::string edgeId, const NBEdgeCont &ec)
Definition: NBPTStop.cpp:167
NBPTStop
The representation of a single pt stop.
Definition: NBPTStop.h:44
NBNode.h
DEBUGSTOPID
#define DEBUGSTOPID
Definition: NBPTLineCont.cpp:31
NBEdge.h
NBEdgeCont::getAllRouterEdges
RouterEdgeVector getAllRouterEdges() const
Definition: NBEdgeCont.cpp:1609
NBPTStopCont.h
NBPTLineCont::getWayID
static std::string getWayID(const std::string &edgeID)
Definition: NBPTLineCont.cpp:468
NBEdge::getID
const std::string & getID() const
Definition: NBEdge.h:1380