Eclipse SUMO - Simulation of Urban MObility
NBPTStop.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 // The representation of a single pt stop
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
23 #include <string>
24 #include <utils/geom/Position.h>
27 #include "NBCont.h"
28 #include "NBPTPlatform.h"
29 
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 class OutputDevice;
35 class NBEdgeCont;
36 class NBEdge;
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
46 class NBPTStop : public Parameterised {
47 
48 public:
56  NBPTStop(std::string ptStopId, Position position, std::string edgeId, std::string origEdgeId, double length, std::string name,
57  SVCPermissions svcPermissions, double parkingLength = 0, const RGBColor color = RGBColor(false));
58 
60  virtual ~NBPTStop() {};
61 
62  std::string getID() const;
63 
64  const std::string getEdgeId() const;
65 
66  const std::string getOrigEdgeId() const;
67 
68  const std::string getName() const;
69 
70  const Position& getPosition() const;
71 
73 
74  long long int getAreaID() const {
75  return myAreaID;
76  }
77 
78  void write(OutputDevice& device);
79 
80  void reshiftPosition(const double offsetX, const double offsetY);
81 
82  const std::vector<NBPTPlatform>& getPlatformCands();
83 
84  bool getIsMultipleStopPositions() const;
85 
86  void setIsMultipleStopPositions(bool multipleStopPositions, long long int areaID);
87 
88  double getLength() const;
89 
90  bool setEdgeId(std::string edgeId, const NBEdgeCont& ec);
91 
92  void registerAdditionalEdge(std::string wayId, std::string edgeId);
93 
94  void addPlatformCand(NBPTPlatform platform);
95 
97 
98  bool findLaneAndComputeBusStopExtent(const NBEdge* edge);
99 
100  void setPTStopId(std::string id) {
101  myPTStopId = id;
102  }
103 
104  void setIsPlatform() {
105  myIsPlatform = true;
106  }
107 
108  bool isPlatform() const {
109  return myIsPlatform;
110  }
111  void addAccess(std::string laneID, double offset, double length);
112 
114  void clearAccess();
115 
117  void addLine(const std::string& line);
118 
119  void setBidiStop(NBPTStop* bidiStop) {
120  myBidiStop = bidiStop;
121  }
122 
124  return myBidiStop;
125  }
126 
127  bool isLoose() const {
128  return myIsLoose;
129  }
130 
131  double getEndPos() const {
132  return myEndPos;
133  }
134 
135  const std::vector<std::string>& getLines() const {
136  return myLines;
137  }
138 
140  void mirrorX();
141 
143  bool replaceEdge(const std::string& edgeID, const EdgeVector& replacement);
144 
145  const std::map<std::string, std::string>& getAdditionalEdgeCandidates() const {
147  }
148  void setOrigEdgeId(const std::string& origEdgeId) {
149  myOrigEdgeId = origEdgeId;
150  }
151  void setPTStopLength(double ptStopLength) {
152  myPTStopLength = ptStopLength;
153  }
154 
155 private:
156  void computeExtent(double center, double d);
157 
158 private:
159  std::string myPTStopId;
161  std::string myEdgeId;
162  std::map<std::string, std::string> myAdditionalEdgeCandidates;
163  std::string myOrigEdgeId;
165  const std::string myName;
166  const double myParkingLength;
168  std::string myLaneId;
170 
171  double myStartPos;
172  double myEndPos;
173 
175  std::vector<std::tuple<std::string, double, double>> myAccesses;
176 
178  std::vector<std::string> myLines;
179 
181 
183  bool myIsLoose;
184 
187 
188  std::vector<NBPTPlatform> myPlatformCands;
190  long long int myAreaID;
191 
192 private:
195 
196 };
197 
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:35
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
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
The representation of a single pt stop.
Definition: NBPTStop.h:46
bool myIsMultipleStopPositions
Definition: NBPTStop.h:189
std::map< std::string, std::string > myAdditionalEdgeCandidates
Definition: NBPTStop.h:162
double myStartPos
Definition: NBPTStop.h:171
void registerAdditionalEdge(std::string wayId, std::string edgeId)
Definition: NBPTStop.cpp:195
const SVCPermissions myPermissions
Definition: NBPTStop.h:169
NBPTStop & operator=(const NBPTStop &)
Invalidated assignment operator.
double myPTStopLength
Definition: NBPTStop.h:164
bool findLaneAndComputeBusStopExtent(const NBEdgeCont &ec)
Definition: NBPTStop.cpp:201
void addPlatformCand(NBPTPlatform platform)
Definition: NBPTStop.cpp:157
void clearAccess()
remove all access definitions
Definition: NBPTStop.cpp:232
std::string myLaneId
Definition: NBPTStop.h:168
NBPTStop * myBidiStop
Definition: NBPTStop.h:180
void setPTStopLength(double ptStopLength)
Definition: NBPTStop.h:151
std::string myPTStopId
Definition: NBPTStop.h:159
std::vector< NBPTPlatform > myPlatformCands
Definition: NBPTStop.h:188
double getEndPos() const
Definition: NBPTStop.h:131
std::vector< std::string > myLines
list of public transport lines (for displaying)
Definition: NBPTStop.h:178
bool setEdgeId(std::string edgeId, const NBEdgeCont &ec)
Definition: NBPTStop.cpp:188
const std::string getEdgeId() const
Definition: NBPTStop.cpp:66
bool replaceEdge(const std::string &edgeID, const EdgeVector &replacement)
replace the stop edge with the closest edge on the given edge list in all stops
Definition: NBPTStop.cpp:252
void setOrigEdgeId(const std::string &origEdgeId)
Definition: NBPTStop.h:148
void computeExtent(double center, double d)
Definition: NBPTStop.cpp:90
std::string getID() const
Definition: NBPTStop.cpp:54
void mirrorX()
mirror coordinates along the x-axis
Definition: NBPTStop.cpp:84
bool getIsMultipleStopPositions() const
Definition: NBPTStop.cpp:169
NBPTStop(std::string ptStopId, Position position, std::string edgeId, std::string origEdgeId, double length, std::string name, SVCPermissions svcPermissions, double parkingLength=0, const RGBColor color=RGBColor(false))
Constructor.
Definition: NBPTStop.cpp:32
void addAccess(std::string laneID, double offset, double length)
Definition: NBPTStop.cpp:237
void write(OutputDevice &device)
Definition: NBPTStop.cpp:106
virtual ~NBPTStop()
Destructor.
Definition: NBPTStop.h:60
const std::vector< NBPTPlatform > & getPlatformCands()
Definition: NBPTStop.cpp:163
const std::string myName
Definition: NBPTStop.h:165
void setPTStopId(std::string id)
Definition: NBPTStop.h:100
bool isPlatform() const
Definition: NBPTStop.h:108
long long int getAreaID() const
Definition: NBPTStop.h:74
std::vector< std::tuple< std::string, double, double > > myAccesses
laneId, lanePos, accessLength
Definition: NBPTStop.h:175
void setIsPlatform()
Definition: NBPTStop.h:104
Position myPosition
Definition: NBPTStop.h:160
void addLine(const std::string &line)
register line that services this stop (for displaying)
Definition: NBPTStop.cpp:97
double getLength() const
Definition: NBPTStop.cpp:182
void reshiftPosition(const double offsetX, const double offsetY)
Definition: NBPTStop.cpp:142
double myEndPos
Definition: NBPTStop.h:172
void setBidiStop(NBPTStop *bidiStop)
Definition: NBPTStop.h:119
NBPTStop * getBidiStop() const
Definition: NBPTStop.h:123
void setIsMultipleStopPositions(bool multipleStopPositions, long long int areaID)
Definition: NBPTStop.cpp:175
SVCPermissions getPermissions() const
Definition: NBPTStop.cpp:151
bool myIsLoose
whether the stop was not part of the road network and must be mapped
Definition: NBPTStop.h:183
const double myParkingLength
Definition: NBPTStop.h:166
const Position & getPosition() const
Definition: NBPTStop.cpp:78
const RGBColor myColor
Definition: NBPTStop.h:167
std::string myOrigEdgeId
Definition: NBPTStop.h:163
const std::vector< std::string > & getLines() const
Definition: NBPTStop.h:135
bool isLoose() const
Definition: NBPTStop.h:127
long long int myAreaID
Definition: NBPTStop.h:190
const std::map< std::string, std::string > & getAdditionalEdgeCandidates() const
Definition: NBPTStop.h:145
const std::string getOrigEdgeId() const
Definition: NBPTStop.cpp:60
const std::string getName() const
Definition: NBPTStop.cpp:72
std::string myEdgeId
Definition: NBPTStop.h:161
bool myIsPlatform
whether this stop was build from a platform position
Definition: NBPTStop.h:186
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37