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 
28 class NBEdge;
29 class NBEdgeCont;
30 
31 class NBPTStopCont {
32 
33 public:
34 
35  ~NBPTStopCont();
36 
41  bool insert(NBPTStop* ptStop);
42 
44  NBPTStop* get(std::string id) const;
45 
47  int size() const {
48  return (int) myPTStops.size();
49  }
50 
54  std::map<std::string, NBPTStop*>::const_iterator begin() const {
55  return myPTStops.begin();
56  }
57 
61  std::map<std::string, NBPTStop*>::const_iterator end() const {
62  return myPTStops.end();
63  }
64 
65  const std::map<std::string, NBPTStop*>& getStops() const {
66  return myPTStops;
67  }
68 
69 
74  int cleanupDeleted(NBEdgeCont& cont);
75 
76  void assignLanes(NBEdgeCont& cont);
77 
79  int generateBidiStops(NBEdgeCont& cont);
80 
81  void localizePTStops(NBEdgeCont& cont);
82 
83  void findAccessEdgesForRailStops(NBEdgeCont& cont, double maxRadius, int maxCount, double accessFactor);
84 
85  void postprocess(std::set<std::string>& usedStops);
86 
88  void addEdges2Keep(const OptionsCont& oc, std::set<std::string>& into);
89 
91  void replaceEdge(const std::string& edgeID, const EdgeVector& replacement);
92 
93 
94  NBPTStop* findStop(const std::string& origEdgeID, Position pos, double threshold = 1) const;
95 
96  NBPTStop* getReverseStop(NBPTStop* pStop, const NBEdgeCont& ec);
97 
98 private:
100  typedef std::map<std::string, NBPTStop*> PTStopsCont;
101 
104 
106  std::map<std::string, std::vector<NBPTStop*> > myPTStopLookup;
107 
108 
112  double computeCrossProductEdgePosition(const NBEdge* edge, const Position& closestPlatform) const;
113 
114  static std::string getReverseID(const std::string& id);
115 
116 public:
117  static NBEdge* getReverseEdge(NBEdge* edge);
118 
119 
120  void alignIdSigns();
121 };
122 
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:35
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:91
bool insert(NBPTStop *ptStop)
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
const std::map< std::string, NBPTStop * > & getStops() const
Definition: NBPTStopCont.h:65
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< NBPTStop * > > myPTStopLookup
The map of edge ids to stops.
Definition: NBPTStopCont.h:106
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
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:100
NBPTStop * get(std::string id) const
Retrieve a previously inserted pt stop.
std::map< std::string, NBPTStop * >::const_iterator begin() const
Returns the pointer to the begin of the stored pt stops.
Definition: NBPTStopCont.h:54
int size() const
Returns the number of pt stops stored in this container.
Definition: NBPTStopCont.h:47
PTStopsCont myPTStops
The map of names to pt stops.
Definition: NBPTStopCont.h:103
NBPTStop * getReverseStop(NBPTStop *pStop, const NBEdgeCont &ec)
const NBPTPlatform * getClosestPlatformToPTStopPosition(NBPTStop *pStop)
void localizePTStops(NBEdgeCont &cont)
void alignIdSigns()
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::map< std::string, NBPTStop * >::const_iterator end() const
Returns the pointer to the end of the stored pt stops.
Definition: NBPTStopCont.h:61
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