SUMO - Simulation of Urban MObility
MSStoppingPlace.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2005-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // A lane area vehicles can halt at
19 /****************************************************************************/
20 #ifndef MSStoppingPlace_h
21 #define MSStoppingPlace_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <vector>
34 #include <algorithm>
35 #include <map>
36 #include <string>
37 #include <utils/common/Named.h>
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class MSLane;
44 class MSEdge;
45 class SUMOVehicle;
46 class MSTransportable;
47 class Position;
48 
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
65 class MSStoppingPlace : public Named {
66 public:
76  MSStoppingPlace(const std::string& id,
77  const std::vector<std::string>& lines, MSLane& lane,
78  double begPos, double endPos, const std::string name = "");
79 
80 
82  virtual ~MSStoppingPlace();
83 
84 
89  const MSLane& getLane() const;
90 
91 
96  double getBeginLanePosition() const;
97 
98 
103  double getEndLanePosition() const;
104 
105 
117  void enter(SUMOVehicle* what, double beg, double end);
118 
119 
129  void leaveFrom(SUMOVehicle* what);
130 
131 
136  double getLastFreePos(const SUMOVehicle& forVehicle) const;
137 
138 
143  Position getWaitPosition() const;
144 
149  double getWaitingPositionOnLane() const {
150  return myWaitingPos;
151  }
152 
153 
158  double getStoppingPosition(const SUMOVehicle* veh) const;
159 
163  return (int)myWaitingTransportables.size();
164  }
165 
168 
171 
173  virtual void addAccess(MSLane* lane, const double pos) {
174  myAccessPos.insert(std::make_pair(lane, pos));
175  }
176 
178  const std::multimap<MSLane*, double>& getAllAccessPos() const {
179  return myAccessPos;
180  }
181 
183  double getAccessPos(const MSEdge* edge) const;
184 
186  bool hasAccess(const MSEdge* edge) const;
187 
188 protected:
195  void computeLastFreePos();
196 
197 
198 protected:
200  std::vector<std::string> myLines;
201 
203  std::map<const SUMOVehicle*, std::pair<double, double> > myEndPositions;
204 
206  const MSLane& myLane;
207 
209  const double myBegPos;
210 
212  const double myEndPos;
213 
216 
218  double myWaitingPos;
219 
221  const std::string myName;
222 public:
223  const std::string& getMyName() const;
224 protected:
225 
227  std::vector<MSTransportable*> myWaitingTransportables;
228 
230  std::multimap<MSLane*, double> myAccessPos;
231 
232 private:
235 
238 
239 
240 };
241 
242 
243 #endif
244 
245 /****************************************************************************/
246 
Position getWaitPosition() const
Returns the next free waiting place for pedestrians / containers.
std::map< const SUMOVehicle *, std::pair< double, double > > myEndPositions
A map from objects (vehicles) to the areas they acquire after entering the stop.
double getAccessPos(const MSEdge *edge) const
the position on the given edge which is connected to this stop, -1 on failure
MSStoppingPlace(const std::string &id, const std::vector< std::string > &lines, MSLane &lane, double begPos, double endPos, const std::string name="")
Constructor.
double getBeginLanePosition() const
Returns the begin position of this stop.
std::vector< MSTransportable * > myWaitingTransportables
Persons waiting at this stop.
double getWaitingPositionOnLane() const
Returns the lane position corresponding to getWaitPosition()
A lane area vehicles can halt at.
bool hasAccess(const MSEdge *edge) const
checks whether this stop provides access to the given edge
const double myEndPos
The end position this bus stop is located at.
virtual void addAccess(MSLane *lane, const double pos)
adds an access point to this stop
void enter(SUMOVehicle *what, double beg, double end)
Called if a vehicle enters this stop.
double getLastFreePos(const SUMOVehicle &forVehicle) const
Returns the last free position on this stop.
int getTransportableNumber() const
Returns the number of transportables waiting on this stop.
const std::string & getMyName() const
void addTransportable(MSTransportable *p)
adds a transportable to this stop
virtual ~MSStoppingPlace()
Destructor.
std::multimap< MSLane *, double > myAccessPos
lanes and positions connected to this stop
const std::multimap< MSLane *, double > & getAllAccessPos() const
lanes and positions connected to this stop
A road/street connecting two junctions.
Definition: MSEdge.h:80
const MSLane & myLane
The lane this bus stop is located at.
double getEndLanePosition() const
Returns the end position of this stop.
MSStoppingPlace & operator=(const MSStoppingPlace &)
Invalidated assignment operator.
Representation of a vehicle.
Definition: SUMOVehicle.h:66
double myLastFreePos
The last free position at this stop (variable)
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
void removeTransportable(MSTransportable *p)
Removes a transportable from this stop.
Base class for objects which have an id.
Definition: Named.h:45
void leaveFrom(SUMOVehicle *what)
Called if a vehicle leaves this stop.
const std::string myName
The name of the stopping place.
const double myBegPos
The begin position this bus stop is located at.
void computeLastFreePos()
Computes the last free position on this stop.
double myWaitingPos
The next free position for persons / containers.
const MSLane & getLane() const
Returns the lane this stop is located at.
std::vector< std::string > myLines
The list of lines that are assigned to this stop.
double getStoppingPosition(const SUMOVehicle *veh) const
For vehicles at the stop this gives the the actual stopping position of the vehicle. For all others the last free stopping position.
Representation of a lane in the micro simulation.
Definition: MSLane.h:77