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