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  SUMOReal begPos, SUMOReal endPos, unsigned int capacity,
85  SUMOReal width, SUMOReal length, SUMOReal angle);
86 
88  virtual ~MSParkingArea();
89 
90 
95  int getCapacity() const;
96 
97 
102  int getOccupancy() const;
103 
104 
116  void enter(SUMOVehicle* what, SUMOReal beg, SUMOReal end);
117 
118 
128  void leaveFrom(SUMOVehicle* what);
129 
130 
135  SUMOReal getLastFreePos(const SUMOVehicle& forVehicle) const;
136 
137 
142  Position getVehiclePosition(const SUMOVehicle& forVehicle);
143 
144 
149  SUMOReal getVehicleAngle(const SUMOVehicle& forVehicle);
150 
151 
156  SUMOReal getSpaceDim() const;
157 
158 
169  void addLotEntry(SUMOReal x, SUMOReal y, SUMOReal z,
170  SUMOReal width, SUMOReal length, SUMOReal angle);
171 
172 
177  SUMOReal getWidth() const;
178 
179 
184  SUMOReal getLength() const;
185 
186 
191  SUMOReal getAngle() const;
192 
193 protected:
194 
200  unsigned int index;
213  };
214 
215 
222  void computeLastFreePos();
223 
226 
229 
232 
235 
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
int getCapacity() const
Returns the area capacity.
int getOccupancy() const
Returns the area occupancy.
SUMOReal myEndPos
The position along the lane that the vehicle needs to reach for entering this lot.
Position myPosition
The position of the vehicle when parking in this space.
int myLastFreeLot
Last free lot number (0 no free lot)
SUMOReal getSpaceDim() const
Returns the space dimension.
A lane area vehicles can halt at.
unsigned int index
the running index
void enter(SUMOVehicle *what, SUMOReal beg, SUMOReal end)
Called if a vehicle enters this stop.
MSParkingArea & operator=(const MSParkingArea &)
Invalidated assignment operator.
MSParkingArea(const std::string &id, const std::vector< std::string > &lines, MSLane &lane, SUMOReal begPos, SUMOReal endPos, unsigned int capacity, SUMOReal width, SUMOReal length, SUMOReal angle)
Constructor.
SUMOReal getVehicleAngle(const SUMOVehicle &forVehicle)
Returns the angle of parked vehicle.
Representation of a vehicle.
Definition: SUMOVehicle.h:67
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.
SUMOReal myLength
The default length of each parking space.
SUMOReal getAngle() const
Returns the lot rectangle angle.
void computeLastFreePos()
Computes the last free position on this stop.
SUMOReal getLastFreePos(const SUMOVehicle &forVehicle) const
Returns the last free position on this stop.
SUMOReal getLength() const
Returns the lot rectangle length.
SUMOReal myAngle
The default angle of each parking space.
int myCapacity
Stop area capacity.
void leaveFrom(SUMOVehicle *what)
Called if a vehicle leaves this stop.
SUMOReal getWidth() const
Returns the lot rectangle width.
SUMOReal myRotation
The rotation.
virtual ~MSParkingArea()
Destructor.
void addLotEntry(SUMOReal x, SUMOReal y, SUMOReal z, SUMOReal width, SUMOReal length, SUMOReal angle)
Add a lot entry to parking area.
SUMOReal myWidth
The default width of each parking space.
#define SUMOReal
Definition: config.h:208
Representation of a single lot space.
Position getVehiclePosition(const SUMOVehicle &forVehicle)
Returns the position of parked vehicle.
std::map< unsigned int, LotSpaceDefinition > mySpaceOccupancies
A map from objects (vehicles) to the areas they acquire after entering the stop.
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
SUMOVehicle * vehicle
The last parked vehicle or 0.