SUMO - Simulation of Urban MObility
MSStoppingPlace.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // A lane area vehicles can halt at
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef MSStoppingPlace_h
22 #define MSStoppingPlace_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <vector>
35 #include <algorithm>
36 #include <map>
37 #include <string>
38 #include <utils/common/Named.h>
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class MSLane;
45 class MSEdge;
46 class SUMOVehicle;
47 class MSTransportable;
48 class Position;
49 
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
66 class MSStoppingPlace : public Named {
67 public:
77  MSStoppingPlace(const std::string& id,
78  const std::vector<std::string>& lines, MSLane& lane,
79  double begPos, double endPos, const std::string name = "");
80 
81 
83  virtual ~MSStoppingPlace();
84 
85 
90  const MSLane& getLane() const;
91 
92 
97  double getBeginLanePosition() const;
98 
99 
104  double getEndLanePosition() const;
105 
106 
118  void enter(SUMOVehicle* what, double beg, double end);
119 
120 
130  void leaveFrom(SUMOVehicle* what);
131 
132 
137  double getLastFreePos(const SUMOVehicle& forVehicle) const;
138 
139 
144  Position getWaitPosition() const;
145 
146 
151  double getStoppingPosition(const SUMOVehicle* veh) const;
152 
156  return (int)myWaitingTransportables.size();
157  }
158 
161 
164 
166  virtual void addAccess(MSLane* lane, const double pos) {
167  myAccessPos.insert(std::make_pair(lane, pos));
168  }
169 
171  bool hasAccess(const MSEdge* edge) const;
172 
173 protected:
180  void computeLastFreePos();
181 
182 
183 protected:
185  std::vector<std::string> myLines;
186 
188  std::map<const SUMOVehicle*, std::pair<double, double> > myEndPositions;
189 
191  const MSLane& myLane;
192 
194  const double myBegPos;
195 
197  const double myEndPos;
198 
201 
203  double myWaitingPos;
204 
206  const std::string myName;
207 public:
208  const std::string& getMyName() const;
209 protected:
210 
212  std::vector<MSTransportable*> myWaitingTransportables;
213 
215  std::multimap<MSLane*, double> myAccessPos;
216 
217 private:
220 
223 
224 
225 };
226 
227 
228 #endif
229 
230 /****************************************************************************/
231 
std::map< const SUMOVehicle *, std::pair< double, double > > myEndPositions
A map from objects (vehicles) to the areas they acquire after entering the stop.
MSStoppingPlace(const std::string &id, const std::vector< std::string > &lines, MSLane &lane, double begPos, double endPos, const std::string name="")
Constructor.
std::vector< MSTransportable * > myWaitingTransportables
Persons waiting at this stop.
A lane area vehicles can halt at.
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 getEndLanePosition() const
Returns the end position of this stop.
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
A road/street connecting two junctions.
Definition: MSEdge.h:81
const MSLane & myLane
The lane this bus stop is located at.
const MSLane & getLane() const
Returns the lane this stop is located at.
double getLastFreePos(const SUMOVehicle &forVehicle) const
Returns the last free position on this stop.
MSStoppingPlace & operator=(const MSStoppingPlace &)
Invalidated assignment operator.
Representation of a vehicle.
Definition: SUMOVehicle.h:67
double myLastFreePos
The last free position at this stop (variable)
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
bool hasAccess(const MSEdge *edge) const
checks whether this stop provides access to the given edge
void removeTransportable(MSTransportable *p)
Removes a transportable from this stop.
Position getWaitPosition() const
Returns the next free waiting place for pedestrians / containers.
Base class for objects which have an id.
Definition: Named.h:46
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.
const std::string & getMyName() const
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.
int getTransportableNumber() const
Returns the number of transportables waiting on this stop.
double getBeginLanePosition() const
Returns the begin position of this stop.
void computeLastFreePos()
Computes the last free position on this stop.
double myWaitingPos
The next free position for persons / containers.
std::vector< std::string > myLines
The list of lines that are assigned to this stop.
Representation of a lane in the micro simulation.
Definition: MSLane.h:79