Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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-2025 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 }
138 continue;
139 }
140 std::shared_ptr<NBPTStop> bidiStop = std::make_shared<NBPTStop>(id,
141 stop->getPosition(),
142 bidiEdge->getID(),
143 stop->getOrigEdgeId(),
144 stop->getLength(),
145 stop->getName(),
146 stop->getPermissions());
147 if (bidiStop->findLaneAndComputeBusStopExtent(ec)) {
148 toAdd.push_back(bidiStop);
149 stop->setBidiStop(bidiStop);
150 bidiStop->setBidiStop(stop);
151 } else {
152 // should not happen
153 assert(false);
154 }
155 } else if (edge != nullptr) {
156 NBEdge* bidiEdge = edge->getTurnDestination(true);
157 if (bidiEdge != nullptr) {
158 const std::string id = getReverseID(stop->getID());
159 if (myPTStops.count(id) > 0) {
160 existingBidiStops++;
161 }
162 }
163 }
164 }
165 for (std::shared_ptr<NBPTStop> newStop : toAdd) {
166 myPTStops[newStop->getID()] = newStop;
167 }
168 if (toAdd.size() > 0) {
169 WRITE_MESSAGEF(TL("Added % stops for superposed rail edges."), toString(toAdd.size()));
170 }
171 return (int)toAdd.size() + existingBidiStops;
172}
173
174
175int
177 int existingBidiStops = 0;
178 for (auto item : myPTStops) {
179 auto stop = item.second;
180 NBEdge* edge = ec.getByID(stop->getEdgeId());
181 if (edge != nullptr && edge->isBidiRail()) {
182 NBEdge* bidiEdge = edge->getTurnDestination(true);
183 assert(bidiEdge != 0);
184 const std::string id = getReverseID(stop->getID());
185 // @note loaded pairs of bidi-stops might have arbitrary ids and we should rather search through all stops on bidiEdge
186 auto it = myPTStops.find(id);
187 if (it != myPTStops.end() && it->second->getEdgeId() == bidiEdge->getID()) {
188 existingBidiStops++;
189 }
190 }
191 }
192 return existingBidiStops;
193}
194
195
196std::shared_ptr<NBPTStop>
197NBPTStopCont::getReverseStop(std::shared_ptr<NBPTStop> pStop, const NBEdgeCont& ec) {
198 std::string edgeId = pStop->getEdgeId();
199 NBEdge* edge = ec.getByID(edgeId);
200 NBEdge* reverse = NBPTStopCont::getReverseEdge(edge);
201 if (reverse != nullptr) {
202 const std::string reverseID = getReverseID(pStop->getID());
203 if (myPTStops.count(reverseID) == 0) {
204 return std::make_shared<NBPTStop>(reverseID, pStop->getPosition(), reverse->getID(), reverse->getID(),
205 pStop->getLength(), pStop->getName(), pStop->getPermissions());
206 } else {
207 return myPTStops[reverseID];
208 }
209 }
210 return nullptr;
211}
212
213
214std::shared_ptr<NBPTStop>
215NBPTStopCont::assignAndCreatNewPTStopAsNeeded(std::shared_ptr<NBPTStop> pStop, NBEdgeCont& cont) {
216 std::string edgeId = pStop->getEdgeId();
217 NBEdge* edge = cont.getByID(edgeId);
218 if (edge == nullptr) {
219 return nullptr;
220 }
221 bool rightOfEdge = false;
222 bool leftOfEdge = false;
223 const NBPTPlatform* left = nullptr;
224 for (const NBPTPlatform& platform : pStop->getPlatformCands()) {
225 double crossProd = computeCrossProductEdgePosition(edge, platform.getPos());
226 //TODO consider driving on the left!!! [GL May '17]
227 if (crossProd > 0) {
228 leftOfEdge = true;
229 left = &platform;
230 } else {
231 rightOfEdge = true;
232 pStop->setPTStopLength(platform.getLength());
233 }
234 }
235
236 if (leftOfEdge && rightOfEdge) {
237 std::shared_ptr<NBPTStop> leftStop = getReverseStop(pStop, cont);
238 if (leftStop) {
239 leftStop->setPTStopLength(left->getLength());
240 }
241 return leftStop;
242 } else if (leftOfEdge) {
243 NBEdge* reverse = getReverseEdge(edge);
244 if (reverse != nullptr) {
245 pStop->setEdgeId(reverse->getID(), cont);
246 pStop->setPTStopLength(left->getLength());
247 }
248 }
249
250 return nullptr;
251}
252
253
254void
255NBPTStopCont::assignPTStopToEdgeOfClosestPlatform(std::shared_ptr<NBPTStop> pStop, NBEdgeCont& cont) {
256 std::string edgeId = pStop->getEdgeId();
257 NBEdge* edge = cont.getByID(edgeId);
258 NBEdge* reverse = NBPTStopCont::getReverseEdge(edge);
259 const NBPTPlatform* closestPlatform = getClosestPlatformToPTStopPosition(pStop);
260 pStop->setPTStopLength(closestPlatform->getLength());
261 if (reverse != nullptr) {
262
263 //TODO make isLeft in PositionVector static [GL May '17]
264// if (PositionVector::isLeft(edge->getFromNode()->getPosition(),edge->getToNode()->getPosition(),closestPlatform)){
265//
266// }
267 double crossProd = computeCrossProductEdgePosition(edge, closestPlatform->getPos());
268
269 //TODO consider driving on the left!!! [GL May '17]
270 if (crossProd > 0) { //pt stop is on the left of the orig edge
271 pStop->setEdgeId(reverse->getID(), cont);
272 }
273 }
274}
275
276
277double
278NBPTStopCont::computeCrossProductEdgePosition(const NBEdge* edge, const Position& closestPlatform) const {
279 PositionVector geom = edge->getGeometry();
280 int idxTmp = geom.indexOfClosest(closestPlatform);
281 double offset = geom.nearest_offset_to_point2D(closestPlatform, true);
282 double offset2 = geom.offsetAtIndex2D(idxTmp);
283 int idx1, idx2;
284 if (offset2 < offset) {
285 idx1 = idxTmp;
286 idx2 = idx1 + 1;
287 } else {
288 idx2 = idxTmp;
289 idx1 = idxTmp - 1;
290 }
291 if (idx1 < 0 || idx1 >= (int) geom.size() || idx2 < 0 || idx2 >= (int) geom.size()) {
292 WRITE_WARNINGF(TL("Could not determine cross product for edge '%'."), edge->getID());
293 return 0;
294 }
295 Position p1 = geom[idx1];
296 Position p2 = geom[idx2];
297
298 double x0 = p1.x();
299 double y0 = p1.y();
300 double x1 = p2.x();
301 double y1 = p2.y();
302 double x2 = closestPlatform.x();
303 double y2 = closestPlatform.y();
304 double crossProd = (x1 - x0) * (y2 - y0) - (y1 - y0) * (x2 - x0);
305 return crossProd;
306}
307
308
309const NBPTPlatform*
310NBPTStopCont::getClosestPlatformToPTStopPosition(std::shared_ptr<NBPTStop> pStop) {
311 Position stopPosition = pStop->getPosition();
312 const NBPTPlatform* closest = nullptr;
313 double minSqrDist = std::numeric_limits<double>::max();
314 for (const NBPTPlatform& platform : pStop->getPlatformCands()) {
315 double sqrDist = stopPosition.distanceSquaredTo2D(platform.getPos());
316 if (sqrDist < minSqrDist) {
317 minSqrDist = sqrDist;
318 closest = &platform;
319 }
320 }
321 return closest;
322}
323
324//static functions
325
326NBEdge*
328 if (edge != nullptr) {
329 for (auto it = edge->getToNode()->getOutgoingEdges().begin();
330 it != edge->getToNode()->getOutgoingEdges().end();
331 it++) {
332 if ((*it)->getToNode() == edge->getFromNode()) {
333 return (*it);
334 }
335 }
336 }
337 return nullptr;
338}
339
340
341int
343 int numDeleted = 0;
344 for (auto i = myPTStops.begin(); i != myPTStops.end();) {
345 if (cont.getByID(i->second->getEdgeId()) == nullptr) {
346 WRITE_WARNINGF(TL("Removing pt stop '%' on non existing edge '%'."), i->first, i->second->getEdgeId());
347 i = myPTStops.erase(i);
348 numDeleted++;
349 } else {
350 i++;
351 }
352 }
353 return numDeleted;
354}
355
356
357void
358NBPTStopCont::addEdges2Keep(const OptionsCont& /* oc */, std::set<std::string>& into) {
359 for (auto stop : myPTStops) {
360 into.insert(stop.second->getEdgeId());
361 }
362}
363
364
365void
366NBPTStopCont::replaceEdge(const std::string& edgeID, const EdgeVector& replacement) {
367 if (myPTStops.size() > 0 && myPTStopLookup.size() == 0) {
368 // init lookup once
369 for (auto& item : myPTStops) {
370 myPTStopLookup[item.second->getEdgeId()].push_back(item.second);
371 }
372 }
373 // make a copy because the vector gets modified
374 const std::vector<std::shared_ptr<NBPTStop> > stops = myPTStopLookup[edgeID];
375 for (std::shared_ptr<NBPTStop> stop : stops) {
376 if (!stop->replaceEdge(edgeID, replacement)) {
377 WRITE_WARNINGF(TL("Could not re-assign pt stop '%' after replacing edge '%'."), stop->getID(), edgeID);
378 } else {
379 myPTStopLookup[stop->getEdgeId()].push_back(stop);
380 }
381 }
382 myPTStopLookup.erase(edgeID);
383}
384
385
386void
387NBPTStopCont::postprocess(std::set<std::string>& usedStops) {
388 for (auto i = myPTStops.begin(); i != myPTStops.end();) {
389 if (usedStops.find(i->second->getID()) == usedStops.end()) {
390 myPTStops.erase(i++);
391 } else {
392 i++;
393 }
394 }
395}
396
397std::string
398NBPTStopCont::getReverseID(const std::string& id) {
399 return id.size() > 0 && id[0] == '-' ? id.substr(1) : "-" + id;
400}
401
402void
404 PTStopsCont stops = myPTStops;
405 for (auto& i : stops) {
406 std::shared_ptr<NBPTStop> s = i.second;
407 const std::string& stopId = s->getID();
408 if (s->getEdgeId() == "" || s->wasLoaded()) {
409 continue;
410 }
411 const char edgeSign = s->getEdgeId().at(0);
412 const char stopSign = stopId.at(0);
413 if (edgeSign != stopSign && (edgeSign == '-' || stopSign == '-')) {
414 const std::string reverseID = getReverseID(stopId);
415 std::shared_ptr<NBPTStop> rs = get(reverseID);
416 if (rs != nullptr && rs->wasLoaded()) {
417 continue;
418 }
419 s->setPTStopId(reverseID);
420 myPTStops.erase(stopId);
421 myPTStops[reverseID] = s;
422 if (rs != nullptr) {
423 rs->setPTStopId(stopId);
424 myPTStops[stopId] = rs;
425 }
426 }
427 }
428}
429
430void
432 NamedRTree r;
434 for (const auto& item : cont) {
435 NBEdge* edge = item.second;
436 if ((edge->getPermissions() & publicPermissions) == 0) {
437 continue;
438 }
439 const Boundary& bound = edge->getGeometry().getBoxBoundary();
440 float min[2] = { static_cast<float>(bound.xmin()), static_cast<float>(bound.ymin()) };
441 float max[2] = { static_cast<float>(bound.xmax()), static_cast<float>(bound.ymax()) };
442 r.Insert(min, max, edge);
443 }
444 for (std::shared_ptr<NBPTStop> ptStop : myFloatingStops) {
445 std::set<const Named*> edges;
446 Named::StoringVisitor visitor(edges);
447 const Position& pos = ptStop->getPosition();
448 float min[2] = {static_cast<float>(pos.x() - maxRadius), static_cast<float>(pos.y() - maxRadius)};
449 float max[2] = {static_cast<float>(pos.x() + maxRadius), static_cast<float>(pos.y() + maxRadius)};
450 r.Search(min, max, visitor);
451 std::vector<NBEdge*> nearby;
452 for (const Named* namedEdge : edges) {
453 NBEdge* e = const_cast<NBEdge*>(dynamic_cast<const NBEdge*>(namedEdge));
454 if ((e->getPermissions() & ptStop->getPermissions()) != 0) {
455 nearby.push_back(e);
456 }
457 }
458 std::sort(nearby.begin(), nearby.end(), [pos](NBEdge * a, NBEdge * b) {
459 return a->getLaneShape(0).distance2D(pos, false) < b->getLaneShape(0).distance2D(pos, false);
460 });
461
462 for (NBEdge* e : nearby) {
463 ptStop->setEdgeId(e->getID(), cont);
464 if (ptStop->getLaneId() != "") {
465 break;
466 }
467 }
468 if (ptStop->getLaneId() == "") {
469 WRITE_WARNINGF(TL("Could not find corresponding edge or compatible lane for free-floating pt stop '%' (%). Thus, it will be removed!"),
470 ptStop->getID(), ptStop->getName());
471 myPTStops.erase(ptStop->getID());
472 }
473 }
474}
475
476void
477NBPTStopCont::findAccessEdgesForRailStops(NBEdgeCont& cont, double maxRadius, int maxCount, double accessFactor) {
478 NamedRTree r;
479 for (auto edge : cont) {
480 const Boundary& bound = edge.second->getGeometry().getBoxBoundary();
481 float min[2] = { static_cast<float>(bound.xmin()), static_cast<float>(bound.ymin()) };
482 float max[2] = { static_cast<float>(bound.xmax()), static_cast<float>(bound.ymax()) };
483 r.Insert(min, max, edge.second);
484 }
485 for (auto& ptStop : myPTStops) {
486 const std::string& stopEdgeID = ptStop.second->getEdgeId();
487 NBEdge* stopEdge = cont.getByID(stopEdgeID);
488 //std::cout << "findAccessEdgesForRailStops edge=" << stopEdgeID << " exists=" << (stopEdge != 0) << "\n";
489 if (stopEdge != nullptr && (stopEdge->getPermissions() & SVC_PEDESTRIAN) == 0) {
490 //if (stopEdge != 0 && isRailway(stopEdge->getPermissions())) {
491 std::set<const Named*> edges;
492 Named::StoringVisitor visitor(edges);
493 const Position& pos = ptStop.second->getPosition();
494 float min[2] = {static_cast<float>(pos.x() - maxRadius), static_cast<float>(pos.y() - maxRadius)};
495 float max[2] = {static_cast<float>(pos.x() + maxRadius), static_cast<float>(pos.y() + maxRadius)};
496 r.Search(min, max, visitor);
497 std::vector<NBEdge*> edgCants;
498 for (const Named* namedEdge : edges) {
499 NBEdge* e = const_cast<NBEdge*>(dynamic_cast<const NBEdge*>(namedEdge));
500 edgCants.push_back(e);
501 }
502 std::sort(edgCants.begin(), edgCants.end(), [pos](NBEdge * a, NBEdge * b) {
503 return a->getLaneShape(0).distance2D(pos, false) < b->getLaneShape(0).distance2D(pos, false);
504 });
505 int cnt = 0;
506 for (auto edge : edgCants) {
507 int laneIdx = 0;
508 for (auto lane : edge->getLanes()) {
509 if ((lane.permissions & SVC_PEDESTRIAN) != 0) {
510 double offset = lane.shape.nearest_offset_to_point2D(pos, false);
511 double finalLength = edge->getFinalLength();
512 double laneLength = lane.shape.length();
513 double accessLength = pos.distanceTo2D(lane.shape.positionAtOffset2D(offset)) * accessFactor;
514 ptStop.second->addAccess(edge->getLaneID(laneIdx), offset * finalLength / laneLength, accessLength);
515 cnt++;
516 break;
517 }
518 laneIdx++;
519 }
520 if (cnt == maxCount) {
521 break;
522 }
523 }
524 }
525 }
526}
527
528
529std::shared_ptr<NBPTStop>
530NBPTStopCont::findStop(const std::string& origEdgeID, Position pos, double threshold) const {
531 for (auto& item : myPTStops) {
532 if (item.second->getOrigEdgeId() == origEdgeID &&
533 item.second->getPosition().distanceTo2D(pos) < threshold) {
534 return item.second;
535 }
536 }
537 return nullptr;
538}
539
540
541/****************************************************************************/
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:288
#define WRITE_MESSAGEF(...)
Definition MsgHandler.h:290
#define TL(string)
Definition MsgHandler.h:305
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:46
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:4469
NBNode * getToNode() const
Returns the destination node of the edge.
Definition NBEdge.h:546
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition NBEdge.h:783
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
Definition NBEdge.cpp:749
const std::string & getID() const
Definition NBEdge.h:1531
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition NBEdge.h:539
NBEdge * getTurnDestination(bool possibleDestination=false) const
Definition NBEdge.cpp:4098
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