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, unsigned int capacity,
78  double width, double length, double angle, const std::string& name);
79 
81  virtual ~MSParkingArea();
82 
83 
88  int getCapacity() const;
89 
90 
95  int getOccupancy() const;
96 
97 
109  void enter(SUMOVehicle* what, double beg, double end);
110 
111 
121  void leaveFrom(SUMOVehicle* what);
122 
123 
128  double getLastFreePos(const SUMOVehicle& forVehicle) const;
129 
130 
135  Position getVehiclePosition(const SUMOVehicle& forVehicle);
136 
137 
142  double getVehicleAngle(const SUMOVehicle& forVehicle);
143 
144 
149  double getSpaceDim() const;
150 
151 
162  void addLotEntry(double x, double y, double z,
163  double width, double length, double angle);
164 
165 
170  double getWidth() const;
171 
172 
177  double getLength() const;
178 
179 
184  double getAngle() const;
185 
186 protected:
187 
193  unsigned int index;
199  double myRotation;
201  double myWidth;
203  double myLength;
205  double myEndPos;
206  };
207 
208 
215  void computeLastFreePos();
216 
219 
222 
224  double myWidth;
225 
227  double myLength;
228 
230  double myAngle;
231 
232 
234  std::map<unsigned int, LotSpaceDefinition > mySpaceOccupancies;
235 
238 
239 private:
240 
243 
246 
247 };
248 
249 
250 #endif
251 
252 /****************************************************************************/
A lane area vehicles can halt at.
Definition: MSParkingArea.h:59
double getSpaceDim() const
Returns the space dimension.
Position myPosition
The position of the vehicle when parking in this space.
int myLastFreeLot
Last free lot number (0 no free lot)
A lane area vehicles can halt at.
void enter(SUMOVehicle *what, double beg, double end)
Called if a vehicle enters this stop.
unsigned int index
the running index
MSParkingArea & operator=(const MSParkingArea &)
Invalidated assignment operator.
double myAngle
The default angle of each parking space.
double getVehicleAngle(const SUMOVehicle &forVehicle)
Returns the angle of parked vehicle.
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.
void computeLastFreePos()
Computes the last free position on this stop.
int getOccupancy() const
Returns the area occupancy.
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.
void leaveFrom(SUMOVehicle *what)
Called if a vehicle leaves this stop.
double getWidth() const
Returns the lot rectangle width.
virtual ~MSParkingArea()
Destructor.
MSParkingArea(const std::string &id, const std::vector< std::string > &lines, MSLane &lane, double begPos, double endPos, unsigned int capacity, double width, double length, double angle, const std::string &name)
Constructor.
Representation of a single lot space.
Position getVehiclePosition(const SUMOVehicle &forVehicle)
Returns the position of parked vehicle.
double getLastFreePos() const
std::map< unsigned int, LotSpaceDefinition > mySpaceOccupancies
A map from objects (vehicles) to the areas they acquire after entering the stop.
double myWidth
The default width of each parking space.
Representation of a lane in the micro simulation.
Definition: MSLane.h:71
double getAngle() const
Returns the lot rectangle angle.
SUMOVehicle * vehicle
The last parked vehicle or 0.
double myRotation
The rotation.