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.dev/sumo
3 // Copyright (C) 2001-2024 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 <memory>
24 #include <string>
26 #include <utils/geom/Position.h>
27 #include "NBPTPlatform.h"
28 
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 class OutputDevice;
34 class NBEdgeCont;
35 class NBEdge;
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
45 class NBPTStop : public Parameterised {
46 
47 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), double givenStartPos = -1);
58 
60  virtual ~NBPTStop() {};
61 
62  std::string getID() const;
63 
64  const std::string& getEdgeId() const;
65 
66  const std::string& getLaneId() const {
67  return myLaneId;
68  }
69 
70  const std::string getOrigEdgeId() const;
71 
72  const std::string getName() const;
73 
74  const Position& getPosition() const;
75 
77 
78  long long int getAreaID() const {
79  return myAreaID;
80  }
81 
82  void write(OutputDevice& device);
83 
84  void reshiftPosition(const double offsetX, const double offsetY);
85 
86  const std::vector<NBPTPlatform>& getPlatformCands();
87 
88  bool getIsMultipleStopPositions() const;
89 
90  void setIsMultipleStopPositions(bool multipleStopPositions, long long int areaID);
91 
92  double getLength() const;
93 
94  bool setEdgeId(std::string edgeId, const NBEdgeCont& ec);
95 
96  void registerAdditionalEdge(std::string wayId, std::string edgeId);
97 
98  void addPlatformCand(NBPTPlatform platform);
99 
101 
102  bool findLaneAndComputeBusStopExtent(const NBEdge* edge);
103 
104  void setPTStopId(std::string id) {
105  myPTStopId = id;
106  }
107 
108  void setIsPlatform() {
109  myIsPlatform = true;
110  }
111 
112  bool isPlatform() const {
113  return myIsPlatform;
114  }
115  void addAccess(std::string laneID, double offset, double length);
116 
118  void clearAccess();
119 
121  void addLine(const std::string& line);
122 
123  void setBidiStop(std::shared_ptr<NBPTStop> bidiStop) {
124  myBidiStop = bidiStop;
125  }
126 
127  std::shared_ptr<NBPTStop> getBidiStop() const {
128  return myBidiStop.lock();
129  }
130 
131  bool isLoose() const {
132  return myIsLoose;
133  }
134 
135  double getEndPos() const {
136  return myEndPos;
137  }
138 
139  const std::vector<std::string>& getLines() const {
140  return myLines;
141  }
142 
144  void mirrorX();
145 
147  bool replaceEdge(const std::string& edgeID, const std::vector<NBEdge*>& replacement);
148 
149  const std::map<std::string, std::string>& getAdditionalEdgeCandidates() const {
151  }
152  void setOrigEdgeId(const std::string& origEdgeId) {
153  myOrigEdgeId = origEdgeId;
154  }
155  void setPTStopLength(double ptStopLength) {
156  myPTStopLength = ptStopLength;
157  }
158 
159 private:
160  std::string myPTStopId;
162  std::string myEdgeId;
163  std::map<std::string, std::string> myAdditionalEdgeCandidates;
164  std::string myOrigEdgeId;
166  const std::string myName;
167  const double myParkingLength;
169  std::string myLaneId;
171 
172  double myStartPos;
173  double myEndPos;
174 
176  std::vector<std::tuple<std::string, double, double>> myAccesses;
177 
179  std::vector<std::string> myLines;
180 
181  std::weak_ptr<NBPTStop> myBidiStop;
182 
184  bool myIsLoose;
185 
188 
189  std::vector<NBPTPlatform> myPlatformCands;
191  long long int myAreaID;
193 
194 private:
197 
198 };
long long 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:92
The representation of a single pt stop.
Definition: NBPTStop.h:45
bool myIsMultipleStopPositions
Definition: NBPTStop.h:190
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), double givenStartPos=-1)
Constructor.
Definition: NBPTStop.cpp:33
std::map< std::string, std::string > myAdditionalEdgeCandidates
Definition: NBPTStop.h:163
double myStartPos
Definition: NBPTStop.h:172
void registerAdditionalEdge(std::string wayId, std::string edgeId)
Definition: NBPTStop.cpp:190
const SVCPermissions myPermissions
Definition: NBPTStop.h:170
NBPTStop & operator=(const NBPTStop &)
Invalidated assignment operator.
double myPTStopLength
Definition: NBPTStop.h:165
bool findLaneAndComputeBusStopExtent(const NBEdgeCont &ec)
Definition: NBPTStop.cpp:196
void addPlatformCand(NBPTPlatform platform)
Definition: NBPTStop.cpp:152
const std::string & getLaneId() const
Definition: NBPTStop.h:66
void clearAccess()
remove all access definitions
Definition: NBPTStop.cpp:239
std::string myLaneId
Definition: NBPTStop.h:169
void setPTStopLength(double ptStopLength)
Definition: NBPTStop.h:155
std::string myPTStopId
Definition: NBPTStop.h:160
double myGivenStartPos
Definition: NBPTStop.h:192
std::vector< NBPTPlatform > myPlatformCands
Definition: NBPTStop.h:189
double getEndPos() const
Definition: NBPTStop.h:135
std::vector< std::string > myLines
list of public transport lines (for displaying)
Definition: NBPTStop.h:179
bool setEdgeId(std::string edgeId, const NBEdgeCont &ec)
Definition: NBPTStop.cpp:183
void setOrigEdgeId(const std::string &origEdgeId)
Definition: NBPTStop.h:152
std::string getID() const
Definition: NBPTStop.cpp:56
void mirrorX()
mirror coordinates along the x-axis
Definition: NBPTStop.cpp:86
std::weak_ptr< NBPTStop > myBidiStop
Definition: NBPTStop.h:181
bool getIsMultipleStopPositions() const
Definition: NBPTStop.cpp:164
void addAccess(std::string laneID, double offset, double length)
Definition: NBPTStop.cpp:245
void write(OutputDevice &device)
Definition: NBPTStop.cpp:101
virtual ~NBPTStop()
Destructor.
Definition: NBPTStop.h:60
const std::vector< NBPTPlatform > & getPlatformCands()
Definition: NBPTStop.cpp:158
const std::string myName
Definition: NBPTStop.h:166
void setPTStopId(std::string id)
Definition: NBPTStop.h:104
bool isPlatform() const
Definition: NBPTStop.h:112
long long int getAreaID() const
Definition: NBPTStop.h:78
std::vector< std::tuple< std::string, double, double > > myAccesses
laneId, lanePos, accessLength
Definition: NBPTStop.h:176
void setIsPlatform()
Definition: NBPTStop.h:108
Position myPosition
Definition: NBPTStop.h:161
void addLine(const std::string &line)
register line that services this stop (for displaying)
Definition: NBPTStop.cpp:92
double getLength() const
Definition: NBPTStop.cpp:177
void setBidiStop(std::shared_ptr< NBPTStop > bidiStop)
Definition: NBPTStop.h:123
void reshiftPosition(const double offsetX, const double offsetY)
Definition: NBPTStop.cpp:137
double myEndPos
Definition: NBPTStop.h:173
bool replaceEdge(const std::string &edgeID, const std::vector< NBEdge * > &replacement)
replace the stop edge with the closest edge on the given edge list in all stops
Definition: NBPTStop.cpp:260
void setIsMultipleStopPositions(bool multipleStopPositions, long long int areaID)
Definition: NBPTStop.cpp:170
SVCPermissions getPermissions() const
Definition: NBPTStop.cpp:146
const std::string & getEdgeId() const
Definition: NBPTStop.cpp:68
bool myIsLoose
whether the stop was not part of the road network and must be mapped
Definition: NBPTStop.h:184
const double myParkingLength
Definition: NBPTStop.h:167
const Position & getPosition() const
Definition: NBPTStop.cpp:80
const RGBColor myColor
Definition: NBPTStop.h:168
std::shared_ptr< NBPTStop > getBidiStop() const
Definition: NBPTStop.h:127
std::string myOrigEdgeId
Definition: NBPTStop.h:164
const std::vector< std::string > & getLines() const
Definition: NBPTStop.h:139
bool isLoose() const
Definition: NBPTStop.h:131
long long int myAreaID
Definition: NBPTStop.h:191
const std::map< std::string, std::string > & getAdditionalEdgeCandidates() const
Definition: NBPTStop.h:149
const std::string getOrigEdgeId() const
Definition: NBPTStop.cpp:62
const std::string getName() const
Definition: NBPTStop.cpp:74
std::string myEdgeId
Definition: NBPTStop.h:162
bool myIsPlatform
whether this stop was build from a platform position
Definition: NBPTStop.h:187
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