Eclipse SUMO - Simulation of Urban MObility
NBPTLine.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 /****************************************************************************/
19 // The representation of one direction of a single pt line
20 /****************************************************************************/
21 #pragma once
22 
23 
24 #include <string>
25 #include <vector>
26 #include <map>
27 #include "NBEdge.h" // Cherednychek
28 
29 // ===========================================================================
30 // class declarations
31 // ===========================================================================
32 class OutputDevice;
33 class NBPTStop;
34 class NBEdgeCont;
35 
36 class NBPTLine {
37 
38 public:
39  explicit NBPTLine(const std::string& id, const std::string& name,
40  const std::string& type, const std::string& ref, int interval, const std::string& nightService,
41  SUMOVehicleClass vClass);
42 
43  void addPTStop(NBPTStop* pStop);
44 
45  const std::string& getLineID() const {
46  return myPTLineId;
47  }
48 
49  const std::string& getName() const {
50  return myName;
51  }
52 
53  const std::string& getType() const {
54  return myType;
55  }
56 
57  std::vector<NBPTStop*> getStops();
58  void write(OutputDevice& device, NBEdgeCont& ec);
59  void addWayNode(long long int way, long long int node);
60 
61  void setMyNumOfStops(int numStops);
62 
64  const std::string& getRef() const {
65  return myRef;
66  }
67 
68  void replaceStops(std::vector<NBPTStop*> stops) {
69  myPTStops = stops;
70  }
72  std::vector<NBEdge*> getStopEdges(const NBEdgeCont& ec) const;
73 
75  NBEdge* getRouteStart(const NBEdgeCont& ec) const;
76 
78  NBEdge* getRouteEnd(const NBEdgeCont& ec) const;
79 
81  void replaceStop(NBPTStop* oldStop, NBPTStop* newStop);
82 
84  void replaceEdge(const std::string& edgeID, const EdgeVector& replacement);
85 
86  void setName(const std::string& name) {
87  myName = name;
88  }
89 
90 private:
91  std::string myName;
92  std::string myType;
93  std::vector<NBPTStop*> myPTStops;
94 
95 private:
96  std::map<std::string, std::vector<long long int> > myWaysNodes;
97  std::vector<std::string> myWays;
98 public:
99  const std::vector<std::string>& getMyWays() const;
100  std::vector<long long int>* getWaysNodes(std::string wayId);
101 private:
102 
103  std::string myCurrentWay;
104  std::string myPTLineId;
105  std::string myRef;
106 
107  // @brief the service interval in minutes
109 
110  std::string myNightService;
112 
113 public:
114  void setEdges(const std::vector<NBEdge*>& edges);
115 private:
116  // route of ptline
117  std::vector<NBEdge*> myRoute;
118 public:
119  const std::vector<NBEdge*>& getRoute() const;
120 private:
121 
123 };
124 
125 
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:34
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
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
std::vector< NBPTStop * > myPTStops
Definition: NBPTLine.h:93
SUMOVehicleClass myVClass
Definition: NBPTLine.h:111
std::string myPTLineId
Definition: NBPTLine.h:104
void setName(const std::string &name)
Definition: NBPTLine.h:86
void addPTStop(NBPTStop *pStop)
Definition: NBPTLine.cpp:42
std::vector< std::string > myWays
Definition: NBPTLine.h:97
void replaceStops(std::vector< NBPTStop * > stops)
Definition: NBPTLine.h:68
std::vector< NBEdge * > myRoute
Definition: NBPTLine.h:117
const std::vector< std::string > & getMyWays() const
Definition: NBPTLine.cpp:103
int myNumOfStops
Definition: NBPTLine.h:122
const std::string & getLineID() const
Definition: NBPTLine.h:45
void write(OutputDevice &device, NBEdgeCont &ec)
Definition: NBPTLine.cpp:51
int myInterval
Definition: NBPTLine.h:108
const std::string & getType() const
Definition: NBPTLine.h:53
std::string myName
Definition: NBPTLine.h:91
std::vector< long long int > * getWaysNodes(std::string wayId)
Definition: NBPTLine.cpp:106
std::string myCurrentWay
Definition: NBPTLine.h:103
std::string myRef
Definition: NBPTLine.h:105
NBEdge * getRouteEnd(const NBEdgeCont &ec) const
return last valid edge of myRoute (if it doest not lie before the last stop)
Definition: NBPTLine.cpp:186
const std::vector< NBEdge * > & getRoute() const
Definition: NBPTLine.cpp:140
void addWayNode(long long int way, long long int node)
Definition: NBPTLine.cpp:94
const std::string & getName() const
Definition: NBPTLine.h:49
const std::string & getRef() const
get line reference (not unique)
Definition: NBPTLine.h:64
std::string myType
Definition: NBPTLine.h:92
std::string myNightService
Definition: NBPTLine.h:110
NBEdge * getRouteStart(const NBEdgeCont &ec) const
return first valid edge of myRoute (if it doest not lie after the first stop)
Definition: NBPTLine.cpp:157
std::map< std::string, std::vector< long long int > > myWaysNodes
Definition: NBPTLine.h:96
std::vector< NBEdge * > getStopEdges(const NBEdgeCont &ec) const
get stop edges
Definition: NBPTLine.cpp:145
void setMyNumOfStops(int numStops)
Definition: NBPTLine.cpp:137
void replaceStop(NBPTStop *oldStop, NBPTStop *newStop)
replace the given stop
Definition: NBPTLine.cpp:215
void replaceEdge(const std::string &edgeID, const EdgeVector &replacement)
replace the edge with the given edge list
Definition: NBPTLine.cpp:224
std::vector< NBPTStop * > getStops()
Definition: NBPTLine.cpp:47
NBPTLine(const std::string &id, const std::string &name, const std::string &type, const std::string &ref, int interval, const std::string &nightService, SUMOVehicleClass vClass)
Definition: NBPTLine.cpp:31
void setEdges(const std::vector< NBEdge * > &edges)
Definition: NBPTLine.cpp:114
The representation of a single pt stop.
Definition: NBPTStop.h:44
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60