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-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 /****************************************************************************/
17 // A area where vehicles can park next to the road
18 /****************************************************************************/
19 #ifndef MSParkingArea_h
20 #define MSParkingArea_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <vector>
33 #include <algorithm>
34 #include <map>
35 #include <string>
37 #include <utils/common/Named.h>
38 #include "MSStoppingPlace.h"
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class MSLane;
45 class SUMOVehicle;
46 class MSTransportable;
47 class Position;
48 
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
66 public:
67 
81  MSParkingArea(const std::string& id,
82  const std::vector<std::string>& lines, MSLane& lane,
83  double begPos, double endPos, unsigned int capacity,
84  double width, double length, double angle);
85 
87  virtual ~MSParkingArea();
88 
89 
94  int getCapacity() const;
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 
141  Position getVehiclePosition(const SUMOVehicle& forVehicle);
142 
143 
148  double getVehicleAngle(const SUMOVehicle& forVehicle);
149 
150 
155  double getSpaceDim() const;
156 
157 
168  void addLotEntry(double x, double y, double z,
169  double width, double length, double angle);
170 
171 
176  double getWidth() const;
177 
178 
183  double getLength() const;
184 
185 
190  double getAngle() const;
191 
192 protected:
193 
199  unsigned int index;
205  double myRotation;
207  double myWidth;
209  double myLength;
211  double myEndPos;
212  };
213 
214 
221  void computeLastFreePos();
222 
225 
228 
230  double myWidth;
231 
233  double myLength;
234 
236  double myAngle;
237 
238 
240  std::map<unsigned int, LotSpaceDefinition > mySpaceOccupancies;
241 
244 
245 private:
246 
249 
252 
253 };
254 
255 
256 #endif
257 
258 /****************************************************************************/
A lane area vehicles can halt at.
Definition: MSParkingArea.h:65
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.
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)
Constructor.
double getVehicleAngle(const SUMOVehicle &forVehicle)
Returns the angle of parked vehicle.
Representation of a vehicle.
Definition: SUMOVehicle.h:66
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:45
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.
Representation of a single lot space.
Position getVehiclePosition(const SUMOVehicle &forVehicle)
Returns the position of parked vehicle.
double getLastFreePos(const SUMOVehicle &forVehicle) const
Returns the last free position on this stop.
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:77
double getAngle() const
Returns the lot rectangle angle.
SUMOVehicle * vehicle
The last parked vehicle or 0.
double myRotation
The rotation.