Eclipse SUMO - Simulation of Urban MObility
NBPTLineCont.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 NBPTLine during netbuild
19 /****************************************************************************/
20 
21 #pragma once
22 
23 
24 #include <vector>
26 #include "NBPTLine.h"
27 #include "NBEdgeCont.h"
28 
29 class NBPTLineCont {
30 
31 public:
33  NBPTLineCont();
34 
36  ~NBPTLineCont();
37 
39  void insert(NBPTLine* ptLine);
40 
41  const std::map<std::string, NBPTLine*>& getLines() const {
42  return myPTLines;
43  }
44 
45  void process(NBEdgeCont& ec, NBPTStopCont& sc);
46 
48  void addEdges2Keep(const OptionsCont& oc, std::set<std::string>& into);
49 
51  void replaceEdge(const std::string& edgeID, const EdgeVector& replacement);
52 
54  void fixBidiStops(const NBEdgeCont& ec);
55 
56  std::set<std::string>& getServedPTStops();
57 private:
58 
59  static const int FWD;
60  static const int BWD;
61 
63  std::map<std::string, NBPTLine*> myPTLines;
64 
66  void reviseStops(NBPTLine* line, const NBEdgeCont& ec, NBPTStopCont& sc);
67 
68  void reviseSingleWayStops(NBPTLine* line, const NBEdgeCont& ec, NBPTStopCont& sc);
69 
70  /* @brief find way element corresponding to the stop
71  * @note: if the edge id is updated, the stop extent is recomputed */
72  NBPTStop* findWay(NBPTLine* line, NBPTStop* stop, const NBEdgeCont& ec, NBPTStopCont& sc) const;
73 
74  void constructRoute(NBPTLine* myPTLine, NBEdgeCont& cont);
75 
76  std::set<std::string> myServedPTStops;
77 
78  static double getCost(const NBEdgeCont& ec, SUMOAbstractRouter<NBRouterEdge, NBVehicle>& router,
79  const NBPTStop* from, const NBPTStop* to, const NBVehicle* veh);
80 
81  static std::string getWayID(const std::string& edgeID);
82 };
83 
84 
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:34
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:59
void reviseStops(NBPTLine *line, const NBEdgeCont &ec, NBPTStopCont &sc)
find directional edge for all stops of the line
static double getCost(const NBEdgeCont &ec, SUMOAbstractRouter< NBRouterEdge, NBVehicle > &router, const NBPTStop *from, const NBPTStop *to, const NBVehicle *veh)
std::set< std::string > myServedPTStops
Definition: NBPTLineCont.h:76
~NBPTLineCont()
destructor
std::map< std::string, NBPTLine * > myPTLines
The map of names to pt lines.
Definition: NBPTLineCont.h:63
void constructRoute(NBPTLine *myPTLine, NBEdgeCont &cont)
void replaceEdge(const std::string &edgeID, const EdgeVector &replacement)
replace the edge with the given edge list in all lines
std::set< std::string > & getServedPTStops()
NBPTStop * findWay(NBPTLine *line, NBPTStop *stop, const NBEdgeCont &ec, NBPTStopCont &sc) const
void process(NBEdgeCont &ec, NBPTStopCont &sc)
void addEdges2Keep(const OptionsCont &oc, std::set< std::string > &into)
add edges that must be kept
void fixBidiStops(const NBEdgeCont &ec)
select the correct stop on superposed rail edges
NBPTLineCont()
constructor
const std::map< std::string, NBPTLine * > & getLines() const
Definition: NBPTLineCont.h:41
static const int BWD
Definition: NBPTLineCont.h:60
void insert(NBPTLine *ptLine)
insert new line
static const int FWD
Definition: NBPTLineCont.h:59
static std::string getWayID(const std::string &edgeID)
void reviseSingleWayStops(NBPTLine *line, const NBEdgeCont &ec, NBPTStopCont &sc)
The representation of a single pt stop.
Definition: NBPTStop.h:44
A vehicle as used by router.
Definition: NBVehicle.h:42
A storage for options typed value containers)
Definition: OptionsCont.h:89