Eclipse 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-2019 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 
103  int getOccupancy() const;
104 
109  int getOccupancyIncludingBlocked() const;
110 
111 
123  void enter(SUMOVehicle* what, double beg, double end);
124 
125 
135  void leaveFrom(SUMOVehicle* what);
136 
137 
142  double getLastFreePos(const SUMOVehicle& forVehicle) const;
143 
144 
150  double getLastFreePosWithReservation(SUMOTime t, const SUMOVehicle& forVehicle);
151 
152 
157  Position getVehiclePosition(const SUMOVehicle& forVehicle) const;
158 
163  double getInsertionPosition(const SUMOVehicle& forVehicle) const;
164 
165 
170  double getVehicleAngle(const SUMOVehicle& forVehicle) const;
171 
172 
183  virtual void addLotEntry(double x, double y, double z,
184  double width, double length, double angle);
185 
186 
191  double getWidth() const;
192 
193 
198  double getLength() const;
199 
200 
205  double getAngle() const;
206 
207 
209  void notifyEgressBlocked();
210 
211  void setNumAlternatives(int alternatives) {
212  myNumAlternatives = MAX2(myNumAlternatives, alternatives);
213  }
214 
215  int getNumAlternatives() const {
216  return myNumAlternatives;
217  }
218 
219 protected:
220 
226  int index;
232  double myRotation;
234  double myWidth;
236  double myLength;
238  double myEndPos;
239  };
240 
241 
248  void computeLastFreePos();
249 
252 
255 
257  bool myOnRoad;
258 
260  double myWidth;
261 
263  double myLength;
264 
266  double myAngle;
267 
268 
270  std::vector<LotSpaceDefinition> mySpaceOccupancies;
271 
274 
277 
282 
285 
286 private:
287 
290 
293 
294 };
295 
296 
297 #endif
298 
299 /****************************************************************************/
MSParkingArea::setNumAlternatives
void setNumAlternatives(int alternatives)
Definition: MSParkingArea.h:211
MSParkingArea::LotSpaceDefinition::myRotation
double myRotation
The rotation.
Definition: MSParkingArea.h:232
MSStoppingPlace
A lane area vehicles can halt at.
Definition: MSStoppingPlace.h:60
MSParkingArea
A lane area vehicles can halt at.
Definition: MSParkingArea.h:59
MSParkingArea::enter
void enter(SUMOVehicle *what, double beg, double end)
Called if a vehicle enters this stop.
Definition: MSParkingArea.cpp:158
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
MSParkingArea::myLastFreeLot
int myLastFreeLot
Last free lot number (-1 no free lot)
Definition: MSParkingArea.h:251
MSParkingArea::myReservationMaxLength
double myReservationMaxLength
Definition: MSParkingArea.h:281
MSParkingArea::notifyEgressBlocked
void notifyEgressBlocked()
update state so that vehicles wishing to enter cooperate with exiting vehicles
Definition: MSParkingArea.cpp:305
MSParkingArea::LotSpaceDefinition::myWidth
double myWidth
The width.
Definition: MSParkingArea.h:234
MSParkingArea::myReservations
int myReservations
Definition: MSParkingArea.h:280
MSParkingArea::operator=
MSParkingArea & operator=(const MSParkingArea &)
Invalidated assignment operator.
MSParkingArea::getNumAlternatives
int getNumAlternatives() const
Definition: MSParkingArea.h:215
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
SUMOVehicle
Representation of a vehicle.
Definition: SUMOVehicle.h:61
MSParkingArea::LotSpaceDefinition::myPosition
Position myPosition
The position of the vehicle when parking in this space.
Definition: MSParkingArea.h:230
MSParkingArea::LotSpaceDefinition::index
int index
the running index
Definition: MSParkingArea.h:226
MSParkingArea::getInsertionPosition
double getInsertionPosition(const SUMOVehicle &forVehicle) const
Returns the insertion position of a parked vehicle.
Definition: MSParkingArea.cpp:136
MSParkingArea::getVehiclePosition
Position getVehiclePosition(const SUMOVehicle &forVehicle) const
Returns the position of parked vehicle.
Definition: MSParkingArea.cpp:125
MSParkingArea::getVehicleAngle
double getVehicleAngle(const SUMOVehicle &forVehicle) const
Returns the angle of parked vehicle.
Definition: MSParkingArea.cpp:147
MSTransportable
Definition: MSTransportable.h:59
PositionVector
A list of positions.
Definition: PositionVector.h:46
MSParkingArea::myAngle
double myAngle
The default angle of each parking space.
Definition: MSParkingArea.h:266
MSParkingArea::LotSpaceDefinition::myLength
double myLength
The length.
Definition: MSParkingArea.h:236
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:80
MSParkingArea::myReservationTime
SUMOTime myReservationTime
track parking reservations from the lane for the current time step
Definition: MSParkingArea.h:279
Named.h
MSParkingArea::myShape
PositionVector myShape
The roadside shape of this parkingArea.
Definition: MSParkingArea.h:273
MSParkingArea::getCapacity
int getCapacity() const
Returns the area capacity.
Definition: MSParkingArea.cpp:288
MSParkingArea::LotSpaceDefinition::myEndPos
double myEndPos
The position along the lane that the vehicle needs to reach for entering this lot.
Definition: MSParkingArea.h:238
MSParkingArea::mySpaceOccupancies
std::vector< LotSpaceDefinition > mySpaceOccupancies
All the spaces in this parking area.
Definition: MSParkingArea.h:270
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
MSParkingArea::MSParkingArea
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.
Definition: MSParkingArea.cpp:43
MSParkingArea::parkOnRoad
bool parkOnRoad() const
whether vehicles park on the road
Definition: MSParkingArea.h:92
MSParkingArea::myLength
double myLength
The default length of each parking space.
Definition: MSParkingArea.h:263
MSParkingArea::addLotEntry
virtual void addLotEntry(double x, double y, double z, double width, double length, double angle)
Add a lot entry to parking area.
Definition: MSParkingArea.cpp:94
MSParkingArea::LotSpaceDefinition
Representation of a single lot space.
Definition: MSParkingArea.h:224
MSParkingArea::getLength
double getLength() const
Returns the lot rectangle length.
Definition: MSParkingArea.cpp:276
MSParkingArea::myCapacity
int myCapacity
Stop area capacity.
Definition: MSParkingArea.h:254
MSParkingArea::leaveFrom
void leaveFrom(SUMOVehicle *what)
Called if a vehicle leaves this stop.
Definition: MSParkingArea.cpp:168
MSParkingArea::computeLastFreePos
void computeLastFreePos()
Computes the last free position on this stop.
Definition: MSParkingArea.cpp:182
MSParkingArea::myOnRoad
bool myOnRoad
Whether vehicles stay on the road.
Definition: MSParkingArea.h:257
MSParkingArea::getOccupancy
int getOccupancy() const
Returns the area occupancy.
Definition: MSParkingArea.cpp:294
MSParkingArea::getWidth
double getWidth() const
Returns the lot rectangle width.
Definition: MSParkingArea.cpp:270
MSParkingArea::getLastFreePosWithReservation
double getLastFreePosWithReservation(SUMOTime t, const SUMOVehicle &forVehicle)
Returns the last free position on this stop including reservatiosn from the current lane and time ste...
Definition: MSParkingArea.cpp:210
MSParkingArea::getOccupancyIncludingBlocked
int getOccupancyIncludingBlocked() const
Returns the area occupancy.
Definition: MSParkingArea.cpp:300
MSParkingArea::~MSParkingArea
virtual ~MSParkingArea()
Destructor.
Definition: MSParkingArea.cpp:91
MSStoppingPlace::getLastFreePos
double getLastFreePos() const
Definition: MSStoppingPlace.h:173
config.h
MSParkingArea::myNumAlternatives
int myNumAlternatives
the number of alternative parkingAreas that are assigned to parkingAreaRerouter
Definition: MSParkingArea.h:284
MSParkingArea::LotSpaceDefinition::vehicle
SUMOVehicle * vehicle
The last parked vehicle or 0.
Definition: MSParkingArea.h:228
MSParkingArea::getAngle
double getAngle() const
Returns the lot rectangle angle.
Definition: MSParkingArea.cpp:282
MSStoppingPlace.h
PositionVector.h
MSParkingArea::myEgressBlocked
bool myEgressBlocked
whether a vehicle wants to exit but is blocked
Definition: MSParkingArea.h:276
MSParkingArea::myWidth
double myWidth
The default width of each parking space.
Definition: MSParkingArea.h:260