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