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-2018 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 
101  int getOccupancy() const;
102 
103 
115  void enter(SUMOVehicle* what, double beg, double end);
116 
117 
127  void leaveFrom(SUMOVehicle* what);
128 
129 
134  double getLastFreePos(const SUMOVehicle& forVehicle) const;
135 
136 
142  double getLastFreePosWithReservation(SUMOTime t, const SUMOVehicle& forVehicle);
143 
144 
149  Position getVehiclePosition(const SUMOVehicle& forVehicle) const;
150 
151 
156  double getVehicleAngle(const SUMOVehicle& forVehicle) const;
157 
158 
169  virtual void addLotEntry(double x, double y, double z,
170  double width, double length, double angle);
171 
172 
177  double getWidth() const;
178 
179 
184  double getLength() const;
185 
186 
191  double getAngle() const;
192 
193 protected:
194 
200  int index;
206  double myRotation;
208  double myWidth;
210  double myLength;
212  double myEndPos;
213  };
214 
215 
222  void computeLastFreePos();
223 
226 
229 
231  bool myOnRoad;
232 
234  double myWidth;
235 
237  double myLength;
238 
240  double myAngle;
241 
242 
244  std::vector<LotSpaceDefinition> mySpaceOccupancies;
245 
248 
253 
254 private:
255 
258 
261 
262 };
263 
264 
265 #endif
266 
267 /****************************************************************************/
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:36
A lane area vehicles can halt at.
void enter(SUMOVehicle *what, double beg, double end)
Called if a vehicle enters this stop.
double myReservationMaxLength
Position getVehiclePosition(const SUMOVehicle &forVehicle) const
Returns the position of parked vehicle.
MSParkingArea & operator=(const MSParkingArea &)
Invalidated assignment operator.
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:60
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.
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
double myWidth
The default width of each parking space.
Representation of a lane in the micro simulation.
Definition: MSLane.h:78
double getAngle() const
Returns the lot rectangle angle.
SUMOVehicle * vehicle
The last parked vehicle or 0.
double myRotation
The rotation.