Eclipse SUMO - Simulation of Urban MObility
MSParkingArea.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2015-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 // A area where vehicles can park next to the road
16 /****************************************************************************/
17 #ifndef MSParkingArea_h
18 #define MSParkingArea_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <vector>
27 #include <algorithm>
28 #include <map>
29 #include <string>
31 #include <utils/common/Named.h>
32 #include "MSStoppingPlace.h"
33 
34 
35 // ===========================================================================
36 // class declarations
37 // ===========================================================================
38 class MSLane;
39 class SUMOVehicle;
40 class MSTransportable;
41 class Position;
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
60 public:
61 
75  MSParkingArea(const std::string& id,
76  const std::vector<std::string>& lines, MSLane& lane,
77  double begPos, double endPos, int capacity,
78  double width, double length, double angle, const std::string& name,
79  bool onRoad);
80 
82  virtual ~MSParkingArea();
83 
84 
89  int getCapacity() const;
90 
92  bool parkOnRoad() const {
93  return myOnRoad;
94  }
95 
96 
103  int getOccupancy() const;
104 
109  int getOccupancyIncludingBlocked() const;
110 
111 
123  void enter(SUMOVehicle* what, double beg, double end);
124 
125 
135  void leaveFrom(SUMOVehicle* what);
136 
137 
142  double getLastFreePos(const SUMOVehicle& forVehicle) const;
143 
144 
150  double getLastFreePosWithReservation(SUMOTime t, const SUMOVehicle& forVehicle);
151 
152 
157  Position getVehiclePosition(const SUMOVehicle& forVehicle) const;
158 
163  double getInsertionPosition(const SUMOVehicle& forVehicle) const;
164 
165 
170  double getVehicleAngle(const SUMOVehicle& forVehicle) const;
171 
172 
183  virtual void addLotEntry(double x, double y, double z,
184  double width, double length, double angle);
185 
186 
191  double getWidth() const;
192 
193 
198  double getLength() const;
199 
200 
205  double getAngle() const;
206 
207 
209  void notifyEgressBlocked();
210 
211  void setNumAlternatives(int alternatives) {
212  myNumAlternatives = MAX2(myNumAlternatives, alternatives);
213  }
214 
215  int getNumAlternatives() const {
216  return myNumAlternatives;
217  }
218 
219 protected:
220 
226  int index;
232  double myRotation;
234  double myWidth;
236  double myLength;
238  double myEndPos;
239  };
240 
241 
248  void computeLastFreePos();
249 
252 
255 
257  bool myOnRoad;
258 
260  double myWidth;
261 
263  double myLength;
264 
266  double myAngle;
267 
268 
270  std::vector<LotSpaceDefinition> mySpaceOccupancies;
271 
274 
277 
282 
285 
286 private:
287 
290 
293 
294 };
295 
296 
297 #endif
298 
299 /****************************************************************************/
A lane area vehicles can halt at.
Definition: MSParkingArea.h:59
Position myPosition
The position of the vehicle when parking in this space.
int myLastFreeLot
Last free lot number (-1 no free lot)
long long int SUMOTime
Definition: SUMOTime.h:35
void notifyEgressBlocked()
update state so that vehicles wishing to enter cooperate with exiting vehicles
A lane area vehicles can halt at.
void enter(SUMOVehicle *what, double beg, double end)
Called if a vehicle enters this stop.
double myReservationMaxLength
double getInsertionPosition(const SUMOVehicle &forVehicle) const
Returns the insertion position of a parked vehicle.
Position getVehiclePosition(const SUMOVehicle &forVehicle) const
Returns the position of parked vehicle.
MSParkingArea & operator=(const MSParkingArea &)
Invalidated assignment operator.
int getNumAlternatives() const
T MAX2(T a, T b)
Definition: StdDefs.h:80
double getVehicleAngle(const SUMOVehicle &forVehicle) const
Returns the angle of parked vehicle.
double myAngle
The default angle of each parking space.
SUMOTime myReservationTime
track parking reservations from the lane for the current time step
Representation of a vehicle.
Definition: SUMOVehicle.h:61
double myEndPos
The position along the lane that the vehicle needs to reach for entering this lot.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
A list of positions.
PositionVector myShape
The roadside shape of this parkingArea.
double myLength
The default length of each parking space.
int getCapacity() const
Returns the area capacity.
std::vector< LotSpaceDefinition > mySpaceOccupancies
All the spaces in this parking area.
void computeLastFreePos()
Computes the last free position on this stop.
bool parkOnRoad() const
whether vehicles park on the road
Definition: MSParkingArea.h:92
MSParkingArea(const std::string &id, const std::vector< std::string > &lines, MSLane &lane, double begPos, double endPos, int capacity, double width, double length, double angle, const std::string &name, bool onRoad)
Constructor.
int getOccupancy() const
Returns the area occupancy.
virtual void addLotEntry(double x, double y, double z, double width, double length, double angle)
Add a lot entry to parking area.
double getLength() const
Returns the lot rectangle length.
int myCapacity
Stop area capacity.
bool myOnRoad
Whether vehicles stay on the road.
void leaveFrom(SUMOVehicle *what)
Called if a vehicle leaves this stop.
int getOccupancyIncludingBlocked() const
Returns the area occupancy.
double getWidth() const
Returns the lot rectangle width.
virtual ~MSParkingArea()
Destructor.
double getLastFreePosWithReservation(SUMOTime t, const SUMOVehicle &forVehicle)
Returns the last free position on this stop including reservatiosn from the current lane and time ste...
Representation of a single lot space.
double getLastFreePos() const
int myNumAlternatives
the number of alternative parkingAreas that are assigned to parkingAreaRerouter
bool myEgressBlocked
whether a vehicle wants to exit but is blocked
double myWidth
The default width of each parking space.
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
double getAngle() const
Returns the lot rectangle angle.
void setNumAlternatives(int alternatives)
SUMOVehicle * vehicle
The last parked vehicle or 0.
double myRotation
The rotation.