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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // The representation of one direction of a single pt line
16 /****************************************************************************/
17 #ifndef SUMO_NBPTLINE_H
18 #define SUMO_NBPTLINE_H
19 
20 
21 #include <string>
22 #include <vector>
23 #include <map>
24 #include "NBEdge.h" // Cherednychek
25 
26 // ===========================================================================
27 // class declarations
28 // ===========================================================================
29 class OutputDevice;
30 class NBPTStop;
31 class NBEdgeCont;
32 
33 class NBPTLine {
34 
35 public:
36  explicit NBPTLine(const std::string& id, const std::string& name,
37  const std::string& type, const std::string& ref, int interval, const std::string& nightService,
38  SUMOVehicleClass vClass);
39 
40  void addPTStop(NBPTStop* pStop);
41 
42  const std::string& getLineID() const {
43  return myPTLineId;
44  }
45 
46  const std::string& getName() const {
47  return myName;
48  }
49 
50  const std::string& getType() const {
51  return myType;
52  }
53 
54  std::vector<NBPTStop*> getStops();
55  void write(OutputDevice& device, NBEdgeCont& ec);
56  void addWayNode(long long int way, long long int node);
57 
58  void setMyNumOfStops(int numStops);
59 
61  const std::string& getRef() const {
62  return myRef;
63  }
64 
65  void replaceStops(std::vector<NBPTStop*> stops) {
66  myPTStops = stops;
67  }
69  std::vector<NBEdge*> getStopEdges(const NBEdgeCont& ec) const;
70 
72  NBEdge* getRouteStart(const NBEdgeCont& ec) const;
73 
75  NBEdge* getRouteEnd(const NBEdgeCont& ec) const;
76 
78  void replaceStop(NBPTStop* oldStop, NBPTStop* newStop);
79 
80 private:
81  std::string myName;
82  std::string myType;
83  std::vector<NBPTStop*> myPTStops;
84 
85 private:
86  std::map<std::string, std::vector<long long int> > myWaysNodes;
87  std::vector<std::string> myWays;
88 public:
89  const std::vector<std::string>& getMyWays() const;
90  std::vector<long long int>* getWaysNodes(std::string wayId);
91 private:
92 
93  std::string myCurrentWay;
94  std::string myPTLineId;
95  std::string myRef;
97  std::string myNightService;
99 
100 public:
101  void setEdges(const std::vector<NBEdge*>& edges);
102 private:
103  // route of ptline
104  std::vector<NBEdge*> myRoute;
105 public:
106  const std::vector<NBEdge*>& getRoute() const;
107 private:
108 
110 };
111 
112 
113 #endif //SUMO_NBPTLINE_H
NBPTLine::getName
const std::string & getName() const
Definition: NBPTLine.h:46
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:133
NBPTLine::myRoute
std::vector< NBEdge * > myRoute
Definition: NBPTLine.h:104
NBEdgeCont
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:60
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
NBPTLine::getStops
std::vector< NBPTStop * > getStops()
Definition: NBPTLine.cpp:43
NBPTLine::replaceStop
void replaceStop(NBPTStop *oldStop, NBPTStop *newStop)
replace the given stop
Definition: NBPTLine.cpp:211
NBPTLine
Definition: NBPTLine.h:33
NBPTLine::myInterval
int myInterval
Definition: NBPTLine.h:96
NBPTLine::getType
const std::string & getType() const
Definition: NBPTLine.h:50
NBPTLine::getWaysNodes
std::vector< long long int > * getWaysNodes(std::string wayId)
Definition: NBPTLine.cpp:102
NBPTLine::myName
std::string myName
Definition: NBPTLine.h:81
NBPTLine::myPTStops
std::vector< NBPTStop * > myPTStops
Definition: NBPTLine.h:83
NBPTLine::setMyNumOfStops
void setMyNumOfStops(int numStops)
Definition: NBPTLine.cpp:133
NBPTLine::myNightService
std::string myNightService
Definition: NBPTLine.h:97
NBPTLine::getLineID
const std::string & getLineID() const
Definition: NBPTLine.h:42
NBPTLine::NBPTLine
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:27
NBPTLine::write
void write(OutputDevice &device, NBEdgeCont &ec)
Definition: NBPTLine.cpp:47
NBEdge
The representation of a single edge during network building.
Definition: NBEdge.h:91
NBPTLine::getStopEdges
std::vector< NBEdge * > getStopEdges(const NBEdgeCont &ec) const
get stop edges
Definition: NBPTLine.cpp:141
NBPTLine::replaceStops
void replaceStops(std::vector< NBPTStop * > stops)
Definition: NBPTLine.h:65
NBPTLine::myWays
std::vector< std::string > myWays
Definition: NBPTLine.h:87
NBPTLine::myCurrentWay
std::string myCurrentWay
Definition: NBPTLine.h:93
NBPTLine::myType
std::string myType
Definition: NBPTLine.h:82
NBPTLine::addPTStop
void addPTStop(NBPTStop *pStop)
Definition: NBPTLine.cpp:38
NBPTLine::myRef
std::string myRef
Definition: NBPTLine.h:95
NBPTLine::getRoute
const std::vector< NBEdge * > & getRoute() const
Definition: NBPTLine.cpp:136
NBPTLine::myWaysNodes
std::map< std::string, std::vector< long long int > > myWaysNodes
Definition: NBPTLine.h:86
NBPTLine::getRouteEnd
NBEdge * getRouteEnd(const NBEdgeCont &ec) const
return last valid edge of myRoute (if it doest not lie before the last stop)
Definition: NBPTLine.cpp:182
NBPTLine::setEdges
void setEdges(const std::vector< NBEdge * > &edges)
Definition: NBPTLine.cpp:110
NBPTLine::myVClass
SUMOVehicleClass myVClass
Definition: NBPTLine.h:98
NBPTLine::getMyWays
const std::vector< std::string > & getMyWays() const
Definition: NBPTLine.cpp:99
NBPTLine::getRef
const std::string & getRef() const
get line reference (not unique)
Definition: NBPTLine.h:61
NBPTLine::addWayNode
void addWayNode(long long int way, long long int node)
Definition: NBPTLine.cpp:90
NBPTLine::getRouteStart
NBEdge * getRouteStart(const NBEdgeCont &ec) const
return first valid edge of myRoute (if it doest not lie after the first stop)
Definition: NBPTLine.cpp:153
NBPTStop
The representation of a single pt stop.
Definition: NBPTStop.h:44
NBPTLine::myPTLineId
std::string myPTLineId
Definition: NBPTLine.h:94
NBEdge.h
NBPTLine::myNumOfStops
int myNumOfStops
Definition: NBPTLine.h:109