Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NBPTStopCont.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2026 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/****************************************************************************/
18// Container for pt stops during the netbuilding process
19/****************************************************************************/
20#include <config.h>
22#include <utils/geom/Boundary.h>
23#include <utils/geom/Position.h>
25#include <microsim/MSLane.h>
26#include "NBEdgeCont.h"
27#include "NBEdge.h"
28#include "NBNode.h"
29#include "NBPTPlatform.h"
30#include "NBPTStop.h"
31#include "NBPTStopCont.h"
32
33
34// ===========================================================================
35// static members
36// ===========================================================================
37std::set<std::string> NBPTStopCont::myIgnoredStops;
38
39
40// ===========================================================================
41// method definitions
42// ===========================================================================
46
47
48bool
49NBPTStopCont::insert(std::shared_ptr<NBPTStop> ptStop, bool floating) {
50 std::string id = ptStop->getID();
51 auto i = myPTStops.find(id);
52 if (i != myPTStops.end()) {
53 return false;
54 }
55 myPTStops[id] = ptStop;
56 if (floating) {
57 myFloatingStops.push_back(ptStop);
58 }
59 return true;
60}
61
62
63std::shared_ptr<NBPTStop>
64NBPTStopCont::get(std::string id) const {
65 if (myPTStops.find(id) != myPTStops.end()) {
66 return myPTStops.find(id)->second;
67 }
68 return nullptr;
69}
70
71
72void
74 std::vector<std::shared_ptr<NBPTStop> > reverseStops;
75 //first pass localize pt stop at correct side of the street; create stop for opposite side if needed
76 for (const auto& ptStopIt : myPTStops) {
77 std::shared_ptr<NBPTStop> const stop = ptStopIt.second;
78 bool multipleStopPositions = stop->getIsMultipleStopPositions();
79 bool platformsDefined = !stop->getPlatformCands().empty();
80 if (!platformsDefined) {
81 //create pt stop for reverse edge if edge exists
82 std::shared_ptr<NBPTStop> reverseStop = getReverseStop(stop, cont);
83 if (reverseStop != nullptr) {
84 reverseStops.push_back(reverseStop);
85 }
86 } else if (multipleStopPositions) {
87 //create pt stop for closest platform at corresponding edge
89 } else {
90 //create pt stop for each side of the street where a platform is defined (create additional pt stop as needed)
91 std::shared_ptr<NBPTStop> additionalStop = assignAndCreatNewPTStopAsNeeded(stop, cont);
92 if (additionalStop != nullptr) {
93 reverseStops.push_back(additionalStop);
94 }
95 }
96 }
97 //insert new stops if any
98 for (std::shared_ptr<NBPTStop>& reverseStop : reverseStops) {
99 insert(reverseStop);
100 }
101}
102
103
104void
106 //scnd pass set correct lane
107 for (auto i = myPTStops.begin(); i != myPTStops.end();) {
108 std::shared_ptr<NBPTStop> stop = i->second;
109 if (!stop->findLaneAndComputeBusStopExtent(cont)) {
110 WRITE_WARNINGF(TL("Could not find corresponding edge or compatible lane for pt stop '%' (%). Thus, it will be removed!"),
111 i->first, i->second->getName());
112 //EdgeVector edgeVector = cont.getGeneratedFrom((*i).second->getOrigEdgeId());
113 //std::cout << edgeVector.size() << std::endl;
114 myPTStops.erase(i++);
115 } else {
116 i++;
117 }
118 }
119}
120
121
122int
124 int existingBidiStops = 0;
125 std::vector<std::shared_ptr<NBPTStop> > toAdd;
126 for (auto i = myPTStops.begin(); i != myPTStops.end(); i++) {
127 std::shared_ptr<NBPTStop> stop = i->second;
128 NBEdge* edge = ec.getByID(stop->getEdgeId());
129 if (edge != nullptr && edge->isBidiRail()) {
130 NBEdge* bidiEdge = edge->getTurnDestination(true);
131 assert(bidiEdge != 0);
132 const std::string id = getReverseID(stop->getID());
133 if (myPTStops.count(id) > 0) {
134 if (myPTStops[id]->getEdgeId() != bidiEdge->getID()) {
135 WRITE_WARNINGF(TL("Could not create reverse-direction stop for superposed edge '%' (origStop '%'). Stop id '%' already in use by stop on edge '%'."),
136 bidiEdge->getID(), i->first, id, myPTStops[id]->getEdgeId());
137 } else {
138 existingBidiStops++;
139 }
140 continue;
141 }
142 std::shared_ptr<NBPTStop> bidiStop = std::make_shared<NBPTStop>(stop->getElement(), id,
143 stop->getPosition(),
144 bidiEdge->getID(),
145 stop->getOrigEdgeId(),
146 stop->getLength(),
147 stop->getName(),
148 stop->getPermissions());
149 if (bidiStop->findLaneAndComputeBusStopExtent(ec)) {
150 toAdd.push_back(bidiStop);
151 stop->setBidiStop(bidiStop);
152 bidiStop->setBidiStop(stop);
153 } else {
154 // should not happen
155 assert(false);
156 }
157 } else if (edge != nullptr) {
158 NBEdge* bidiEdge = edge->getTurnDestination(true);
159 if (bidiEdge != nullptr) {
160 const std::string id = getReverseID(stop->getID());
161 if (myPTStops.count(id) > 0) {
162 existingBidiStops++;
163 }
164 }
165 }
166 }
167 for (std::shared_ptr<NBPTStop> newStop : toAdd) {
168 myPTStops[newStop->getID()] = newStop;
169 }
170 if (toAdd.size() > 0) {
171 WRITE_MESSAGEF(TL("Added % stops for superposed rail edges."), toString(toAdd.size()));
172 }
173 return (int)toAdd.size() + existingBidiStops;
174}
175
176
177int
179 int existingBidiStops = 0;
180 for (auto item : myPTStops) {
181 auto stop = item.second;
182 NBEdge* edge = ec.getByID(stop->getEdgeId());
183 if (edge != nullptr && edge->isBidiRail()) {
184 NBEdge* bidiEdge = edge->getTurnDestination(true);
185 assert(bidiEdge != 0);
186 const std::string id = getReverseID(stop->getID());
187 // @note loaded pairs of bidi-stops might have arbitrary ids and we should rather search through all stops on bidiEdge
188 auto it = myPTStops.find(id);
189 if (it != myPTStops.end() && it->second->getEdgeId() == bidiEdge->getID()) {
190 existingBidiStops++;
191 }
192 }
193 }
194 return existingBidiStops;
195}
196
197
198std::shared_ptr<NBPTStop>
199NBPTStopCont::getReverseStop(std::shared_ptr<NBPTStop> pStop, const NBEdgeCont& ec) {
200 std::string edgeId = pStop->getEdgeId();
201 NBEdge* edge = ec.getByID(edgeId);
202 NBEdge* reverse = NBPTStopCont::getReverseEdge(edge);
203 if (reverse != nullptr) {
204 const std::string reverseID = getReverseID(pStop->getID());
205 if (myPTStops.count(reverseID) == 0) {
206 std::shared_ptr<NBPTStop> result = std::make_shared<NBPTStop>(pStop->getElement(), reverseID, pStop->getPosition(), reverse->getID(), reverse->getID(),
207 pStop->getLength(), pStop->getName(), pStop->getPermissions());
208 for (const std::string& line : pStop->getLines()) {
209 result->addLine(line);
210 }
211 return result;
212 } else {
213 return myPTStops[reverseID];
214 }
215 }
216 return nullptr;
217}
218
219
220std::shared_ptr<NBPTStop>
221NBPTStopCont::assignAndCreatNewPTStopAsNeeded(std::shared_ptr<NBPTStop> pStop, NBEdgeCont& cont) {
222 std::string edgeId = pStop->getEdgeId();
223 NBEdge* edge = cont.getByID(edgeId);
224 if (edge == nullptr) {
225 return nullptr;
226 }
227 bool rightOfEdge = false;
228 bool leftOfEdge = false;
229 const NBPTPlatform* left = nullptr;
230 for (const NBPTPlatform& platform : pStop->getPlatformCands()) {
231 double crossProd = computeCrossProductEdgePosition(edge, platform.getPos());
232 //TODO consider driving on the left!!! [GL May '17]
233 if (crossProd > 0) {
234 leftOfEdge = true;
235 left = &platform;
236 } else {
237 rightOfEdge = true;
238 pStop->setPTStopLength(platform.getLength());
239 }
240 }
241
242 if (leftOfEdge && rightOfEdge) {
243 std::shared_ptr<NBPTStop> leftStop = getReverseStop(pStop, cont);
244 if (leftStop) {
245 leftStop->setPTStopLength(left->getLength());
246 }
247 return leftStop;
248 } else if (leftOfEdge) {
249 NBEdge* reverse = getReverseEdge(edge);
250 if (reverse != nullptr) {
251 pStop->setEdgeId(reverse->getID(), cont);
252 pStop->setPTStopLength(left->getLength());
253 }
254 }
255
256 return nullptr;
257}
258
259
260void
261NBPTStopCont::assignPTStopToEdgeOfClosestPlatform(std::shared_ptr<NBPTStop> pStop, NBEdgeCont& cont) {
262 std::string edgeId = pStop->getEdgeId();
263 NBEdge* edge = cont.getByID(edgeId);
264 NBEdge* reverse = NBPTStopCont::getReverseEdge(edge);
265 const NBPTPlatform* closestPlatform = getClosestPlatformToPTStopPosition(pStop);
266 pStop->setPTStopLength(closestPlatform->getLength());
267 if (reverse != nullptr) {
268
269 //TODO make isLeft in PositionVector static [GL May '17]
270// if (PositionVector::isLeft(edge->getFromNode()->getPosition(),edge->getToNode()->getPosition(),closestPlatform)){
271//
272// }
273 double crossProd = computeCrossProductEdgePosition(edge, closestPlatform->getPos());
274
275 //TODO consider driving on the left!!! [GL May '17]
276 if (crossProd > 0) { //pt stop is on the left of the orig edge
277 pStop->setEdgeId(reverse->getID(), cont);
278 }
279 }
280}
281
282
283double
284NBPTStopCont::computeCrossProductEdgePosition(const NBEdge* edge, const Position& closestPlatform) const {
285 PositionVector geom = edge->getGeometry();
286 int idxTmp = geom.indexOfClosest(closestPlatform);
287 double offset = geom.nearest_offset_to_point2D(closestPlatform, true);
288 double offset2 = geom.offsetAtIndex2D(idxTmp);
289 int idx1, idx2;
290 if (offset2 < offset) {
291 idx1 = idxTmp;
292 idx2 = idx1 + 1;
293 } else {
294 idx2 = idxTmp;
295 idx1 = idxTmp - 1;
296 }
297 if (idx1 < 0 || idx1 >= (int) geom.size() || idx2 < 0 || idx2 >= (int) geom.size()) {
298 WRITE_WARNINGF(TL("Could not determine cross product for edge '%'."), edge->getID());
299 return 0;
300 }
301 Position p1 = geom[idx1];
302 Position p2 = geom[idx2];
303
304 double x0 = p1.x();
305 double y0 = p1.y();
306 double x1 = p2.x();
307 double y1 = p2.y();
308 double x2 = closestPlatform.x();
309 double y2 = closestPlatform.y();
310 double crossProd = (x1 - x0) * (y2 - y0) - (y1 - y0) * (x2 - x0);
311 return crossProd;
312}
313
314
315const NBPTPlatform*
316NBPTStopCont::getClosestPlatformToPTStopPosition(std::shared_ptr<NBPTStop> pStop) {
317 Position stopPosition = pStop->getPosition();
318 const NBPTPlatform* closest = nullptr;
319 double minSqrDist = std::numeric_limits<double>::max();
320 for (const NBPTPlatform& platform : pStop->getPlatformCands()) {
321 double sqrDist = stopPosition.distanceSquaredTo2D(platform.getPos());
322 if (sqrDist < minSqrDist) {
323 minSqrDist = sqrDist;
324 closest = &platform;
325 }
326 }
327 return closest;
328}
329
330//static functions
331
332NBEdge*
334 if (edge != nullptr) {
335 const PositionVector rGeom = edge->getGeometry().reverse();
336 for (auto it = edge->getToNode()->getOutgoingEdges().begin();
337 it != edge->getToNode()->getOutgoingEdges().end();
338 it++) {
339 if ((*it)->getToNode() == edge->getFromNode() && (*it)->getGeometry() == rGeom) {
340 return (*it);
341 }
342 }
343 }
344 return nullptr;
345}
346
347
348int
350 int numDeleted = 0;
351 for (auto i = myPTStops.begin(); i != myPTStops.end();) {
352 if (cont.getByID(i->second->getEdgeId()) == nullptr) {
353 WRITE_WARNINGF(TL("Removing pt stop '%' on non existing edge '%'."), i->first, i->second->getEdgeId());
354 i = myPTStops.erase(i);
355 numDeleted++;
356 } else {
357 i++;
358 }
359 }
360 return numDeleted;
361}
362
363
364void
365NBPTStopCont::addEdges2Keep(const OptionsCont& /* oc */, std::set<std::string>& into) {
366 for (auto stop : myPTStops) {
367 into.insert(stop.second->getEdgeId());
368 }
369}
370
371
372void
373NBPTStopCont::replaceEdge(const std::string& edgeID, const EdgeVector& replacement) {
374 if (myPTStops.size() > 0 && myPTStopLookup.size() == 0) {
375 // init lookup once
376 for (auto& item : myPTStops) {
377 myPTStopLookup[item.second->getEdgeId()].push_back(item.second);
378 }
379 }
380 // make a copy because the vector gets modified
381 const std::vector<std::shared_ptr<NBPTStop> > stops = myPTStopLookup[edgeID];
382 for (std::shared_ptr<NBPTStop> stop : stops) {
383 if (!stop->replaceEdge(edgeID, replacement)) {
384 WRITE_WARNINGF(TL("Could not re-assign pt stop '%' after replacing edge '%'."), stop->getID(), edgeID);
385 } else {
386 myPTStopLookup[stop->getEdgeId()].push_back(stop);
387 }
388 }
389 myPTStopLookup.erase(edgeID);
390}
391
392
393void
394NBPTStopCont::postprocess(std::set<std::string>& usedStops) {
395 for (auto i = myPTStops.begin(); i != myPTStops.end();) {
396 if (usedStops.find(i->second->getID()) == usedStops.end()) {
397 myPTStops.erase(i++);
398 } else {
399 i++;
400 }
401 }
402}
403
404std::string
405NBPTStopCont::getReverseID(const std::string& id) {
406 return id.size() > 0 && id[0] == '-' ? id.substr(1) : "-" + id;
407}
408
409void
411 PTStopsCont stops = myPTStops;
412 for (auto& i : stops) {
413 std::shared_ptr<NBPTStop> s = i.second;
414 const std::string& stopId = s->getID();
415 if (s->getEdgeId() == "" || s->wasLoaded()) {
416 continue;
417 }
418 const char edgeSign = s->getEdgeId().at(0);
419 const char stopSign = stopId.at(0);
420 if (edgeSign != stopSign && (edgeSign == '-' || stopSign == '-')) {
421 const std::string reverseID = getReverseID(stopId);
422 std::shared_ptr<NBPTStop> rs = get(reverseID);
423 if (rs != nullptr && rs->wasLoaded()) {
424 continue;
425 }
426 s->setPTStopId(reverseID);
427 myPTStops.erase(stopId);
428 myPTStops[reverseID] = s;
429 if (rs != nullptr) {
430 rs->setPTStopId(stopId);
431 myPTStops[stopId] = rs;
432 }
433 }
434 }
435}
436
437void
439 NamedRTree r;
441 for (const auto& item : cont) {
442 NBEdge* edge = item.second;
443 if ((edge->getPermissions() & publicPermissions) == 0) {
444 continue;
445 }
446 const Boundary& bound = edge->getGeometry().getBoxBoundary();
447 float min[2] = { static_cast<float>(bound.xmin()), static_cast<float>(bound.ymin()) };
448 float max[2] = { static_cast<float>(bound.xmax()), static_cast<float>(bound.ymax()) };
449 r.Insert(min, max, edge);
450 }
451 for (std::shared_ptr<NBPTStop> ptStop : myFloatingStops) {
452 std::set<const Named*> edges;
453 Named::StoringVisitor visitor(edges);
454 const Position& pos = ptStop->getPosition();
455 float min[2] = {static_cast<float>(pos.x() - maxRadius), static_cast<float>(pos.y() - maxRadius)};
456 float max[2] = {static_cast<float>(pos.x() + maxRadius), static_cast<float>(pos.y() + maxRadius)};
457 r.Search(min, max, visitor);
458 std::vector<NBEdge*> nearby;
459 for (const Named* namedEdge : edges) {
460 NBEdge* e = const_cast<NBEdge*>(dynamic_cast<const NBEdge*>(namedEdge));
461 if ((e->getPermissions() & ptStop->getPermissions()) != 0) {
462 nearby.push_back(e);
463 }
464 }
465 std::sort(nearby.begin(), nearby.end(), [pos](NBEdge * a, NBEdge * b) {
466 return a->getLaneShape(0).distance2D(pos, false) < b->getLaneShape(0).distance2D(pos, false);
467 });
468
469 for (NBEdge* e : nearby) {
470 ptStop->setEdgeId(e->getID(), cont);
471 if (ptStop->getLaneId() != "") {
472 break;
473 }
474 }
475 if (ptStop->getLaneId() == "") {
476 WRITE_WARNINGF(TL("Could not find corresponding edge or compatible lane for free-floating pt stop '%' (%). Thus, it will be removed!"),
477 ptStop->getID(), ptStop->getName());
478 myPTStops.erase(ptStop->getID());
479 }
480 }
481}
482
483void
484NBPTStopCont::findAccessEdgesForRailStops(NBEdgeCont& cont, double maxRadius, int maxCount, double accessFactor) {
485 NamedRTree r;
486 for (auto edge : cont) {
487 const Boundary& bound = edge.second->getGeometry().getBoxBoundary();
488 float min[2] = { static_cast<float>(bound.xmin()), static_cast<float>(bound.ymin()) };
489 float max[2] = { static_cast<float>(bound.xmax()), static_cast<float>(bound.ymax()) };
490 r.Insert(min, max, edge.second);
491 }
492 for (auto& ptStop : myPTStops) {
493 const std::string& stopEdgeID = ptStop.second->getEdgeId();
494 NBEdge* stopEdge = cont.getByID(stopEdgeID);
495 //std::cout << "findAccessEdgesForRailStops edge=" << stopEdgeID << " exists=" << (stopEdge != 0) << "\n";
496 if (stopEdge != nullptr && (stopEdge->getPermissions() & SVC_PEDESTRIAN) == 0) {
497 //if (stopEdge != 0 && isRailway(stopEdge->getPermissions())) {
498 std::set<const Named*> edges;
499 Named::StoringVisitor visitor(edges);
500 const Position& pos = ptStop.second->getPosition();
501 float min[2] = {static_cast<float>(pos.x() - maxRadius), static_cast<float>(pos.y() - maxRadius)};
502 float max[2] = {static_cast<float>(pos.x() + maxRadius), static_cast<float>(pos.y() + maxRadius)};
503 r.Search(min, max, visitor);
504 std::vector<NBEdge*> edgCants;
505 for (const Named* namedEdge : edges) {
506 NBEdge* e = const_cast<NBEdge*>(dynamic_cast<const NBEdge*>(namedEdge));
507 edgCants.push_back(e);
508 }
509 std::sort(edgCants.begin(), edgCants.end(), [pos](NBEdge * a, NBEdge * b) {
510 return a->getLaneShape(0).distance2D(pos, false) < b->getLaneShape(0).distance2D(pos, false);
511 });
512 int cnt = 0;
513 for (auto edge : edgCants) {
514 int laneIdx = 0;
515 for (auto lane : edge->getLanes()) {
516 if ((lane.permissions & SVC_PEDESTRIAN) != 0) {
517 double offset = lane.shape.nearest_offset_to_point2D(pos, false);
518 double finalLength = edge->getFinalLength();
519 double laneLength = lane.shape.length();
520 double accessLength = pos.distanceTo2D(lane.shape.positionAtOffset2D(offset)) * accessFactor;
521 ptStop.second->addAccess(edge->getLaneID(laneIdx), offset * finalLength / laneLength, accessLength);
522 cnt++;
523 break;
524 }
525 laneIdx++;
526 }
527 if (cnt == maxCount) {
528 break;
529 }
530 }
531 }
532 }
533}
534
535
536std::shared_ptr<NBPTStop>
537NBPTStopCont::findStop(const std::string& origEdgeID, Position pos, double threshold) const {
538 for (auto& item : myPTStops) {
539 if (item.second->getOrigEdgeId() == origEdgeID &&
540 item.second->getPosition().distanceTo2D(pos) < threshold) {
541 return item.second;
542 }
543 }
544 return nullptr;
545}
546
547
548/****************************************************************************/
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:287
#define WRITE_MESSAGEF(...)
Definition MsgHandler.h:289
#define TL(string)
Definition MsgHandler.h:304
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition NBCont.h:42
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ SVC_RAIL
vehicle is a not electrified rail
@ SVC_RAIL_URBAN
vehicle is a city rail
@ SVC_TRAM
vehicle is a light rail
@ SVC_TAXI
vehicle is a taxi
@ SVC_BUS
vehicle is a bus
@ SVC_PEDESTRIAN
pedestrian
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:49
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
double ymin() const
Returns minimum y-coordinate.
Definition Boundary.cpp:127
double xmin() const
Returns minimum x-coordinate.
Definition Boundary.cpp:115
double ymax() const
Returns maximum y-coordinate.
Definition Boundary.cpp:133
double xmax() const
Returns maximum x-coordinate.
Definition Boundary.cpp:121
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.
The representation of a single edge during network building.
Definition NBEdge.h:92
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition NBEdge.cpp:4540
NBNode * getToNode() const
Returns the destination node of the edge.
Definition NBEdge.h:552
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition NBEdge.h:789
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
Definition NBEdge.cpp:772
const std::string & getID() const
Definition NBEdge.h:1551
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition NBEdge.h:545
NBEdge * getTurnDestination(bool possibleDestination=false) const
Definition NBEdge.cpp:4169
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
Definition NBNode.h:273
double getLength() const
const Position & getPos() const
static std::string getReverseID(const std::string &id)
void replaceEdge(const std::string &edgeID, const std::vector< NBEdge * > &replacement)
replace the edge with the closes edge on the given edge list in all stops
int cleanupDeleted(NBEdgeCont &cont)
remove stops on non existing (removed) edges
void assignPTStopToEdgeOfClosestPlatform(std::shared_ptr< NBPTStop > pStop, NBEdgeCont &cont)
static std::set< std::string > myIgnoredStops
static NBEdge * getReverseEdge(NBEdge *edge)
double computeCrossProductEdgePosition(const NBEdge *edge, const Position &closestPlatform) const
void postprocess(std::set< std::string > &usedStops)
std::map< std::string, std::vector< std::shared_ptr< NBPTStop > > > myPTStopLookup
The map of edge ids to stops.
std::shared_ptr< NBPTStop > get(std::string id) const
Retrieve a previously inserted pt stop.
void addEdges2Keep(const OptionsCont &oc, std::set< std::string > &into)
add edges that must be kept
PTStopsCont myPTStops
The map of names to pt stops.
std::vector< std::shared_ptr< NBPTStop > > myFloatingStops
void localizePTStops(NBEdgeCont &cont)
std::shared_ptr< NBPTStop > getReverseStop(std::shared_ptr< NBPTStop > pStop, const NBEdgeCont &ec)
std::map< std::string, std::shared_ptr< NBPTStop > > PTStopsCont
Definition of the map of names to pt stops.
void assignEdgeForFloatingStops(NBEdgeCont &cont, double maxRadius)
void findAccessEdgesForRailStops(NBEdgeCont &cont, double maxRadius, int maxCount, double accessFactor)
const NBPTPlatform * getClosestPlatformToPTStopPosition(std::shared_ptr< NBPTStop > pStop)
int generateBidiStops(NBEdgeCont &cont)
duplicate stops for superposed rail edges and return the number of generated stops
std::shared_ptr< NBPTStop > findStop(const std::string &origEdgeID, Position pos, double threshold=1) const
void assignLanes(NBEdgeCont &cont)
std::shared_ptr< NBPTStop > assignAndCreatNewPTStopAsNeeded(std::shared_ptr< NBPTStop > pStop, NBEdgeCont &cont)
int countBidiStops(NBEdgeCont &cont) const
count number of stop-pairs for superposed rail-edges
bool insert(std::shared_ptr< NBPTStop > ptStop, bool floating=false)
Inserts a node into the map.
Allows to store the object; used as context while traveling the rtree in TraCI.
Definition Named.h:90
Base class for objects which have an id.
Definition Named.h:54
A RT-tree for efficient storing of SUMO's Named objects.
Definition NamedRTree.h:61
void Insert(const float a_min[2], const float a_max[2], Named *const &a_data)
Insert entry.
Definition NamedRTree.h:79
int Search(const float a_min[2], const float a_max[2], const Named::StoringVisitor &c) const
Find all within search rectangle.
Definition NamedRTree.h:112
A storage for options typed value containers)
Definition OptionsCont.h:89
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
Definition Position.h:278
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition Position.h:273
double x() const
Returns the x-position.
Definition Position.h:52
double y() const
Returns the y-position.
Definition Position.h:57
A list of positions.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
int indexOfClosest(const Position &p, bool twoD=false) const
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
double offsetAtIndex2D(int index) const
return the offset at the given index
PositionVector reverse() const
reverse position vector