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 return std::make_shared<NBPTStop>(pStop->getElement(), reverseID, pStop->getPosition(), reverse->getID(), reverse->getID(),
207 pStop->getLength(), pStop->getName(), pStop->getPermissions());
208 } else {
209 return myPTStops[reverseID];
210 }
211 }
212 return nullptr;
213}
214
215
216std::shared_ptr<NBPTStop>
217NBPTStopCont::assignAndCreatNewPTStopAsNeeded(std::shared_ptr<NBPTStop> pStop, NBEdgeCont& cont) {
218 std::string edgeId = pStop->getEdgeId();
219 NBEdge* edge = cont.getByID(edgeId);
220 if (edge == nullptr) {
221 return nullptr;
222 }
223 bool rightOfEdge = false;
224 bool leftOfEdge = false;
225 const NBPTPlatform* left = nullptr;
226 for (const NBPTPlatform& platform : pStop->getPlatformCands()) {
227 double crossProd = computeCrossProductEdgePosition(edge, platform.getPos());
228 //TODO consider driving on the left!!! [GL May '17]
229 if (crossProd > 0) {
230 leftOfEdge = true;
231 left = &platform;
232 } else {
233 rightOfEdge = true;
234 pStop->setPTStopLength(platform.getLength());
235 }
236 }
237
238 if (leftOfEdge && rightOfEdge) {
239 std::shared_ptr<NBPTStop> leftStop = getReverseStop(pStop, cont);
240 if (leftStop) {
241 leftStop->setPTStopLength(left->getLength());
242 }
243 return leftStop;
244 } else if (leftOfEdge) {
245 NBEdge* reverse = getReverseEdge(edge);
246 if (reverse != nullptr) {
247 pStop->setEdgeId(reverse->getID(), cont);
248 pStop->setPTStopLength(left->getLength());
249 }
250 }
251
252 return nullptr;
253}
254
255
256void
257NBPTStopCont::assignPTStopToEdgeOfClosestPlatform(std::shared_ptr<NBPTStop> pStop, NBEdgeCont& cont) {
258 std::string edgeId = pStop->getEdgeId();
259 NBEdge* edge = cont.getByID(edgeId);
260 NBEdge* reverse = NBPTStopCont::getReverseEdge(edge);
261 const NBPTPlatform* closestPlatform = getClosestPlatformToPTStopPosition(pStop);
262 pStop->setPTStopLength(closestPlatform->getLength());
263 if (reverse != nullptr) {
264
265 //TODO make isLeft in PositionVector static [GL May '17]
266// if (PositionVector::isLeft(edge->getFromNode()->getPosition(),edge->getToNode()->getPosition(),closestPlatform)){
267//
268// }
269 double crossProd = computeCrossProductEdgePosition(edge, closestPlatform->getPos());
270
271 //TODO consider driving on the left!!! [GL May '17]
272 if (crossProd > 0) { //pt stop is on the left of the orig edge
273 pStop->setEdgeId(reverse->getID(), cont);
274 }
275 }
276}
277
278
279double
280NBPTStopCont::computeCrossProductEdgePosition(const NBEdge* edge, const Position& closestPlatform) const {
281 PositionVector geom = edge->getGeometry();
282 int idxTmp = geom.indexOfClosest(closestPlatform);
283 double offset = geom.nearest_offset_to_point2D(closestPlatform, true);
284 double offset2 = geom.offsetAtIndex2D(idxTmp);
285 int idx1, idx2;
286 if (offset2 < offset) {
287 idx1 = idxTmp;
288 idx2 = idx1 + 1;
289 } else {
290 idx2 = idxTmp;
291 idx1 = idxTmp - 1;
292 }
293 if (idx1 < 0 || idx1 >= (int) geom.size() || idx2 < 0 || idx2 >= (int) geom.size()) {
294 WRITE_WARNINGF(TL("Could not determine cross product for edge '%'."), edge->getID());
295 return 0;
296 }
297 Position p1 = geom[idx1];
298 Position p2 = geom[idx2];
299
300 double x0 = p1.x();
301 double y0 = p1.y();
302 double x1 = p2.x();
303 double y1 = p2.y();
304 double x2 = closestPlatform.x();
305 double y2 = closestPlatform.y();
306 double crossProd = (x1 - x0) * (y2 - y0) - (y1 - y0) * (x2 - x0);
307 return crossProd;
308}
309
310
311const NBPTPlatform*
312NBPTStopCont::getClosestPlatformToPTStopPosition(std::shared_ptr<NBPTStop> pStop) {
313 Position stopPosition = pStop->getPosition();
314 const NBPTPlatform* closest = nullptr;
315 double minSqrDist = std::numeric_limits<double>::max();
316 for (const NBPTPlatform& platform : pStop->getPlatformCands()) {
317 double sqrDist = stopPosition.distanceSquaredTo2D(platform.getPos());
318 if (sqrDist < minSqrDist) {
319 minSqrDist = sqrDist;
320 closest = &platform;
321 }
322 }
323 return closest;
324}
325
326//static functions
327
328NBEdge*
330 if (edge != nullptr) {
331 const PositionVector rGeom = edge->getGeometry().reverse();
332 for (auto it = edge->getToNode()->getOutgoingEdges().begin();
333 it != edge->getToNode()->getOutgoingEdges().end();
334 it++) {
335 if ((*it)->getToNode() == edge->getFromNode() && (*it)->getGeometry() == rGeom) {
336 return (*it);
337 }
338 }
339 }
340 return nullptr;
341}
342
343
344int
346 int numDeleted = 0;
347 for (auto i = myPTStops.begin(); i != myPTStops.end();) {
348 if (cont.getByID(i->second->getEdgeId()) == nullptr) {
349 WRITE_WARNINGF(TL("Removing pt stop '%' on non existing edge '%'."), i->first, i->second->getEdgeId());
350 i = myPTStops.erase(i);
351 numDeleted++;
352 } else {
353 i++;
354 }
355 }
356 return numDeleted;
357}
358
359
360void
361NBPTStopCont::addEdges2Keep(const OptionsCont& /* oc */, std::set<std::string>& into) {
362 for (auto stop : myPTStops) {
363 into.insert(stop.second->getEdgeId());
364 }
365}
366
367
368void
369NBPTStopCont::replaceEdge(const std::string& edgeID, const EdgeVector& replacement) {
370 if (myPTStops.size() > 0 && myPTStopLookup.size() == 0) {
371 // init lookup once
372 for (auto& item : myPTStops) {
373 myPTStopLookup[item.second->getEdgeId()].push_back(item.second);
374 }
375 }
376 // make a copy because the vector gets modified
377 const std::vector<std::shared_ptr<NBPTStop> > stops = myPTStopLookup[edgeID];
378 for (std::shared_ptr<NBPTStop> stop : stops) {
379 if (!stop->replaceEdge(edgeID, replacement)) {
380 WRITE_WARNINGF(TL("Could not re-assign pt stop '%' after replacing edge '%'."), stop->getID(), edgeID);
381 } else {
382 myPTStopLookup[stop->getEdgeId()].push_back(stop);
383 }
384 }
385 myPTStopLookup.erase(edgeID);
386}
387
388
389void
390NBPTStopCont::postprocess(std::set<std::string>& usedStops) {
391 for (auto i = myPTStops.begin(); i != myPTStops.end();) {
392 if (usedStops.find(i->second->getID()) == usedStops.end()) {
393 myPTStops.erase(i++);
394 } else {
395 i++;
396 }
397 }
398}
399
400std::string
401NBPTStopCont::getReverseID(const std::string& id) {
402 return id.size() > 0 && id[0] == '-' ? id.substr(1) : "-" + id;
403}
404
405void
407 PTStopsCont stops = myPTStops;
408 for (auto& i : stops) {
409 std::shared_ptr<NBPTStop> s = i.second;
410 const std::string& stopId = s->getID();
411 if (s->getEdgeId() == "" || s->wasLoaded()) {
412 continue;
413 }
414 const char edgeSign = s->getEdgeId().at(0);
415 const char stopSign = stopId.at(0);
416 if (edgeSign != stopSign && (edgeSign == '-' || stopSign == '-')) {
417 const std::string reverseID = getReverseID(stopId);
418 std::shared_ptr<NBPTStop> rs = get(reverseID);
419 if (rs != nullptr && rs->wasLoaded()) {
420 continue;
421 }
422 s->setPTStopId(reverseID);
423 myPTStops.erase(stopId);
424 myPTStops[reverseID] = s;
425 if (rs != nullptr) {
426 rs->setPTStopId(stopId);
427 myPTStops[stopId] = rs;
428 }
429 }
430 }
431}
432
433void
435 NamedRTree r;
437 for (const auto& item : cont) {
438 NBEdge* edge = item.second;
439 if ((edge->getPermissions() & publicPermissions) == 0) {
440 continue;
441 }
442 const Boundary& bound = edge->getGeometry().getBoxBoundary();
443 float min[2] = { static_cast<float>(bound.xmin()), static_cast<float>(bound.ymin()) };
444 float max[2] = { static_cast<float>(bound.xmax()), static_cast<float>(bound.ymax()) };
445 r.Insert(min, max, edge);
446 }
447 for (std::shared_ptr<NBPTStop> ptStop : myFloatingStops) {
448 std::set<const Named*> edges;
449 Named::StoringVisitor visitor(edges);
450 const Position& pos = ptStop->getPosition();
451 float min[2] = {static_cast<float>(pos.x() - maxRadius), static_cast<float>(pos.y() - maxRadius)};
452 float max[2] = {static_cast<float>(pos.x() + maxRadius), static_cast<float>(pos.y() + maxRadius)};
453 r.Search(min, max, visitor);
454 std::vector<NBEdge*> nearby;
455 for (const Named* namedEdge : edges) {
456 NBEdge* e = const_cast<NBEdge*>(dynamic_cast<const NBEdge*>(namedEdge));
457 if ((e->getPermissions() & ptStop->getPermissions()) != 0) {
458 nearby.push_back(e);
459 }
460 }
461 std::sort(nearby.begin(), nearby.end(), [pos](NBEdge * a, NBEdge * b) {
462 return a->getLaneShape(0).distance2D(pos, false) < b->getLaneShape(0).distance2D(pos, false);
463 });
464
465 for (NBEdge* e : nearby) {
466 ptStop->setEdgeId(e->getID(), cont);
467 if (ptStop->getLaneId() != "") {
468 break;
469 }
470 }
471 if (ptStop->getLaneId() == "") {
472 WRITE_WARNINGF(TL("Could not find corresponding edge or compatible lane for free-floating pt stop '%' (%). Thus, it will be removed!"),
473 ptStop->getID(), ptStop->getName());
474 myPTStops.erase(ptStop->getID());
475 }
476 }
477}
478
479void
480NBPTStopCont::findAccessEdgesForRailStops(NBEdgeCont& cont, double maxRadius, int maxCount, double accessFactor) {
481 NamedRTree r;
482 for (auto edge : cont) {
483 const Boundary& bound = edge.second->getGeometry().getBoxBoundary();
484 float min[2] = { static_cast<float>(bound.xmin()), static_cast<float>(bound.ymin()) };
485 float max[2] = { static_cast<float>(bound.xmax()), static_cast<float>(bound.ymax()) };
486 r.Insert(min, max, edge.second);
487 }
488 for (auto& ptStop : myPTStops) {
489 const std::string& stopEdgeID = ptStop.second->getEdgeId();
490 NBEdge* stopEdge = cont.getByID(stopEdgeID);
491 //std::cout << "findAccessEdgesForRailStops edge=" << stopEdgeID << " exists=" << (stopEdge != 0) << "\n";
492 if (stopEdge != nullptr && (stopEdge->getPermissions() & SVC_PEDESTRIAN) == 0) {
493 //if (stopEdge != 0 && isRailway(stopEdge->getPermissions())) {
494 std::set<const Named*> edges;
495 Named::StoringVisitor visitor(edges);
496 const Position& pos = ptStop.second->getPosition();
497 float min[2] = {static_cast<float>(pos.x() - maxRadius), static_cast<float>(pos.y() - maxRadius)};
498 float max[2] = {static_cast<float>(pos.x() + maxRadius), static_cast<float>(pos.y() + maxRadius)};
499 r.Search(min, max, visitor);
500 std::vector<NBEdge*> edgCants;
501 for (const Named* namedEdge : edges) {
502 NBEdge* e = const_cast<NBEdge*>(dynamic_cast<const NBEdge*>(namedEdge));
503 edgCants.push_back(e);
504 }
505 std::sort(edgCants.begin(), edgCants.end(), [pos](NBEdge * a, NBEdge * b) {
506 return a->getLaneShape(0).distance2D(pos, false) < b->getLaneShape(0).distance2D(pos, false);
507 });
508 int cnt = 0;
509 for (auto edge : edgCants) {
510 int laneIdx = 0;
511 for (auto lane : edge->getLanes()) {
512 if ((lane.permissions & SVC_PEDESTRIAN) != 0) {
513 double offset = lane.shape.nearest_offset_to_point2D(pos, false);
514 double finalLength = edge->getFinalLength();
515 double laneLength = lane.shape.length();
516 double accessLength = pos.distanceTo2D(lane.shape.positionAtOffset2D(offset)) * accessFactor;
517 ptStop.second->addAccess(edge->getLaneID(laneIdx), offset * finalLength / laneLength, accessLength);
518 cnt++;
519 break;
520 }
521 laneIdx++;
522 }
523 if (cnt == maxCount) {
524 break;
525 }
526 }
527 }
528 }
529}
530
531
532std::shared_ptr<NBPTStop>
533NBPTStopCont::findStop(const std::string& origEdgeID, Position pos, double threshold) const {
534 for (auto& item : myPTStops) {
535 if (item.second->getOrigEdgeId() == origEdgeID &&
536 item.second->getPosition().distanceTo2D(pos) < threshold) {
537 return item.second;
538 }
539 }
540 return nullptr;
541}
542
543
544/****************************************************************************/
#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: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: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