Eclipse SUMO - Simulation of Urban MObility
NBPTStopCont.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2001-2022 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
21#pragma once
22#include <config.h>
23
24#include <string>
25#include <map>
26#include "NBPTStop.h"
27
28class NBEdge;
29class NBEdgeCont;
30
32
33public:
34
36
42 bool insert(NBPTStop* ptStop, bool floating = false);
43
45 NBPTStop* get(std::string id) const;
46
48 int size() const {
49 return (int) myPTStops.size();
50 }
51
55 std::map<std::string, NBPTStop*>::const_iterator begin() const {
56 return myPTStops.begin();
57 }
58
62 std::map<std::string, NBPTStop*>::const_iterator end() const {
63 return myPTStops.end();
64 }
65
66 const std::map<std::string, NBPTStop*>& getStops() const {
67 return myPTStops;
68 }
69
70
75 int cleanupDeleted(NBEdgeCont& cont);
76
77 void assignLanes(NBEdgeCont& cont);
78
81
82 void localizePTStops(NBEdgeCont& cont);
83
84 void assignEdgeForFloatingStops(NBEdgeCont& cont, double maxRadius);
85
86 void findAccessEdgesForRailStops(NBEdgeCont& cont, double maxRadius, int maxCount, double accessFactor);
87
88 void postprocess(std::set<std::string>& usedStops);
89
91 void addEdges2Keep(const OptionsCont& oc, std::set<std::string>& into);
92
94 void replaceEdge(const std::string& edgeID, const EdgeVector& replacement);
95
96
97 NBPTStop* findStop(const std::string& origEdgeID, Position pos, double threshold = 1) const;
98
99 NBPTStop* getReverseStop(NBPTStop* pStop, const NBEdgeCont& ec);
100
101private:
103 typedef std::map<std::string, NBPTStop*> PTStopsCont;
104
107
109 std::map<std::string, std::vector<NBPTStop*> > myPTStopLookup;
110
111 std::vector<NBPTStop*> myFloatingStops;
112
113
117 double computeCrossProductEdgePosition(const NBEdge* edge, const Position& closestPlatform) const;
118
119 static std::string getReverseID(const std::string& id);
120
121 static std::set<std::string> myIgnoredStops;
122
123
124public:
125 static NBEdge* getReverseEdge(NBEdge* edge);
126
127 static void addIgnored(const std::string& stopID) {
128 myIgnoredStops.insert(stopID);
129 }
130
131 static bool wasIgnored(const std::string& stopID) {
132 return myIgnoredStops.count(stopID) > 0;
133 }
134
135 void alignIdSigns();
136};
137
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:42
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:59
The representation of a single edge during network building.
Definition: NBEdge.h:92
bool insert(NBPTStop *ptStop, bool floating=false)
Inserts a node into the map.
static std::string getReverseID(const std::string &id)
int cleanupDeleted(NBEdgeCont &cont)
remove stops on non existing (removed) edges
static std::set< std::string > myIgnoredStops
Definition: NBPTStopCont.h:121
static NBEdge * getReverseEdge(NBEdge *edge)
double computeCrossProductEdgePosition(const NBEdge *edge, const Position &closestPlatform) const
void postprocess(std::set< std::string > &usedStops)
static void addIgnored(const std::string &stopID)
Definition: NBPTStopCont.h:127
std::map< std::string, std::vector< NBPTStop * > > myPTStopLookup
The map of edge ids to stops.
Definition: NBPTStopCont.h:109
NBPTStop * findStop(const std::string &origEdgeID, Position pos, double threshold=1) const
void replaceEdge(const std::string &edgeID, const EdgeVector &replacement)
replace the edge with the closes edge on the given edge list in all stops
std::map< std::string, NBPTStop * >::const_iterator begin() const
Returns the pointer to the begin of the stored pt stops.
Definition: NBPTStopCont.h:55
void addEdges2Keep(const OptionsCont &oc, std::set< std::string > &into)
add edges that must be kept
std::map< std::string, NBPTStop * > PTStopsCont
Definition of the map of names to pt stops.
Definition: NBPTStopCont.h:103
std::map< std::string, NBPTStop * >::const_iterator end() const
Returns the pointer to the end of the stored pt stops.
Definition: NBPTStopCont.h:62
NBPTStop * get(std::string id) const
Retrieve a previously inserted pt stop.
int size() const
Returns the number of pt stops stored in this container.
Definition: NBPTStopCont.h:48
PTStopsCont myPTStops
The map of names to pt stops.
Definition: NBPTStopCont.h:106
NBPTStop * getReverseStop(NBPTStop *pStop, const NBEdgeCont &ec)
const std::map< std::string, NBPTStop * > & getStops() const
Definition: NBPTStopCont.h:66
const NBPTPlatform * getClosestPlatformToPTStopPosition(NBPTStop *pStop)
void localizePTStops(NBEdgeCont &cont)
static bool wasIgnored(const std::string &stopID)
Definition: NBPTStopCont.h:131
void alignIdSigns()
void assignEdgeForFloatingStops(NBEdgeCont &cont, double maxRadius)
void findAccessEdgesForRailStops(NBEdgeCont &cont, double maxRadius, int maxCount, double accessFactor)
int generateBidiStops(NBEdgeCont &cont)
duplicate stops for superposed rail edges and return the number of generated stops
void assignLanes(NBEdgeCont &cont)
void assignPTStopToEdgeOfClosestPlatform(NBPTStop *pStop, NBEdgeCont &cont)
std::vector< NBPTStop * > myFloatingStops
Definition: NBPTStopCont.h:111
NBPTStop * assignAndCreatNewPTStopAsNeeded(NBPTStop *pStop, NBEdgeCont &cont)
The representation of a single pt stop.
Definition: NBPTStop.h:46
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