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-2020 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 
23 #include <string>
24 #include <map>
25 #include "NBPTStop.h"
26 
27 class NBEdge;
28 class NBEdgeCont;
29 
30 class NBPTStopCont {
31 
32 public:
33 
34  ~NBPTStopCont();
35 
40  bool insert(NBPTStop* ptStop);
41 
43  NBPTStop* get(std::string id);
44 
46  int size() const {
47  return (int) myPTStops.size();
48  }
49 
53  std::map<std::string, NBPTStop*>::const_iterator begin() const {
54  return myPTStops.begin();
55  }
56 
60  std::map<std::string, NBPTStop*>::const_iterator end() const {
61  return myPTStops.end();
62  }
63 
64  const std::map<std::string, NBPTStop*>& getStops() const {
65  return myPTStops;
66  }
67 
68 
73  int cleanupDeleted(NBEdgeCont& cont);
74 
75  void assignLanes(NBEdgeCont& cont);
76 
78  int generateBidiStops(NBEdgeCont& cont);
79 
80  void localizePTStops(NBEdgeCont& cont);
81 
82  void findAccessEdgesForRailStops(NBEdgeCont& cont, double maxRadius, int maxCount, double accessFactor);
83 
84  void postprocess(std::set<std::string>& usedStops);
85 
87  void addEdges2Keep(const OptionsCont& oc, std::set<std::string>& into);
88 
89  NBPTStop* findStop(const std::string& origEdgeID, Position pos, double threshold = 1) const;
90 
91 private:
93  typedef std::map<std::string, NBPTStop*> PTStopsCont;
94 
97 
99 
100 
104  double computeCrossProductEdgePosition(const NBEdge* edge, const Position& closestPlatform) const;
105 
106  static std::string getReverseID(const std::string& id);
107 
108 public:
109  static NBEdge* getReverseEdge(NBEdge* edge);
110 
111 
112  void alignIdSigns();
113 };
114 
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:64
static NBEdge * getReverseEdge(NBEdge *edge)
double computeCrossProductEdgePosition(const NBEdge *edge, const Position &closestPlatform) const
void postprocess(std::set< std::string > &usedStops)
NBPTStop * findStop(const std::string &origEdgeID, Position pos, double threshold=1) const
void addEdges2Keep(const OptionsCont &oc, std::set< std::string > &into)
add edges that must be kept
NBPTStop * get(std::string id)
Retrieve a previously inserted pt stop.
std::map< std::string, NBPTStop * > PTStopsCont
Definition of the map of names to pt stops.
Definition: NBPTStopCont.h:93
std::map< std::string, NBPTStop * >::const_iterator begin() const
Returns the pointer to the begin of the stored pt stops.
Definition: NBPTStopCont.h:53
int size() const
Returns the number of pt stops stored in this container.
Definition: NBPTStopCont.h:46
PTStopsCont myPTStops
The map of names to pt stops.
Definition: NBPTStopCont.h:96
const NBPTPlatform * getClosestPlatformToPTStopPosition(NBPTStop *pStop)
void localizePTStops(NBEdgeCont &cont)
void alignIdSigns()
NBPTStop * getReverseStop(NBPTStop *pStop, NBEdgeCont &cont)
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:60
NBPTStop * assignAndCreatNewPTStopAsNeeded(NBPTStop *pStop, NBEdgeCont &cont)
The representation of a single pt stop.
Definition: NBPTStop.h:44
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:36