SUMO - Simulation of Urban MObility
MSParkingArea.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // A area where vehicles can park next to the road
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2015-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 #ifndef MSParkingArea_h
21 #define MSParkingArea_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <vector>
34 #include <algorithm>
35 #include <map>
36 #include <string>
38 #include <utils/common/Named.h>
39 #include "MSStoppingPlace.h"
40 
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
45 class MSLane;
46 class SUMOVehicle;
47 class MSTransportable;
48 class Position;
49 
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
67 public:
68 
82  MSParkingArea(const std::string& id,
83  const std::vector<std::string>& lines, MSLane& lane,
84  double begPos, double endPos, unsigned int capacity,
85  double width, double length, double angle);
86 
88  virtual ~MSParkingArea();
89 
90 
95  int getCapacity() const;
96 
97 
102  int getOccupancy() const;
103 
104 
116  void enter(SUMOVehicle* what, double beg, double end);
117 
118 
128  void leaveFrom(SUMOVehicle* what);
129 
130 
135  double getLastFreePos(const SUMOVehicle& forVehicle) const;
136 
137 
142  Position getVehiclePosition(const SUMOVehicle& forVehicle);
143 
144 
149  double getVehicleAngle(const SUMOVehicle& forVehicle);
150 
151 
156  double getSpaceDim() const;
157 
158 
169  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  unsigned int index;
206  double myRotation;
208  double myWidth;
210  double myLength;
212  double myEndPos;
213  };
214 
215 
222  void computeLastFreePos();
223 
226 
229 
231  double myWidth;
232 
234  double myLength;
235 
237  double myAngle;
238 
239 
241  std::map<unsigned int, LotSpaceDefinition > mySpaceOccupancies;
242 
245 
246 private:
247 
250 
253 
254 };
255 
256 
257 #endif
258 
259 /****************************************************************************/
A lane area vehicles can halt at.
Definition: MSParkingArea.h:66
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:67
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:46
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:79
double getAngle() const
Returns the lot rectangle angle.
SUMOVehicle * vehicle
The last parked vehicle or 0.
double myRotation
The rotation.