37 #define DEBUG_COND2(obj) (obj.isSelected()) 44 const std::vector<std::string>& lines,
46 double begPos,
double endPos,
48 double width,
double length,
double angle,
const std::string& name,
56 myReservationTime(-1),
58 myReservationMaxLength(0)
78 for (
int i = 0; i < capacity; ++i) {
84 ((double) atan2((s.
x() - f.
x()), (f.
y() - s.
y())) * (double) 180.0 / (
double)
M_PI) +
myAngle);
94 double width,
double length,
double angle) {
126 if (lsd.vehicle == &forVehicle) {
127 return lsd.myPosition;
136 if (lsd.vehicle == &forVehicle) {
137 return (lsd.myRotation - 90.) * (double)
M_PI / (
double) 180.0;
159 if (lsd.vehicle == what) {
160 lsd.vehicle =
nullptr;
174 if (lsd.vehicle ==
nullptr) {
180 lsd.myEndPos - lsd.vehicle->getVehicleType().getLength() -
NUMERICAL_EPS);
191 #ifdef DEBUG_RESERVATIONS 197 #ifdef DEBUG_RESERVATIONS 198 if (
DEBUG_COND2(forVehicle)) std::cout <<
SIMTIME <<
" pa=" <<
getID() <<
" freePosRes veh=" << forVehicle.
getID() <<
" first reservation\n";
204 if (lsd.vehicle !=
nullptr) {
211 #ifdef DEBUG_RESERVATIONS 221 #ifdef DEBUG_RESERVATIONS std::map< const SUMOVehicle *, std::pair< double, double > > myEndPositions
A map from objects (vehicles) to the areas they acquire after entering the stop.
int index
the running index
Position myPosition
The position of the vehicle when parking in this space.
int myLastFreeLot
Last free lot number (-1 no free lot)
double z() const
Returns the z-position.
A lane area vehicles can halt at.
void enter(SUMOVehicle *what, double beg, double end)
Called if a vehicle enters this stop.
double myReservationMaxLength
const double myEndPos
The end position this bus stop is located at.
const double SUMO_const_laneWidth
double y() const
Returns the y-position.
Position getVehiclePosition(const SUMOVehicle &forVehicle) const
Returns the position of parked vehicle.
double x() const
Returns the x-position.
virtual MSLane * getLane() const =0
Returns the lane the vehicle is on.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
const PositionVector & getShape() const
Returns this lane's shape.
double myLength
The length.
const std::string & getID() const
Returns the id.
double getVehicleAngle(const SUMOVehicle &forVehicle) const
Returns the angle of parked vehicle.
double getWidth() const
Returns the lane's width.
double myAngle
The default angle of each parking space.
const MSLane & myLane
The lane this bus stop is located at.
SUMOTime myReservationTime
track parking reservations from the lane for the current time step
Representation of a vehicle.
double myLastFreePos
The last free position at this stop (variable)
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.
PositionVector myShape
The roadside shape of this parkingArea.
double myLength
The default length of each parking space.
int getCapacity() const
Returns the area capacity.
std::vector< LotSpaceDefinition > mySpaceOccupancies
All the spaces in this parking area.
double getMinGap() const
Get the free space in front of vehicles of this class.
PositionVector getSubpart(double beginOffset, double endOffset) const
get subpart of a position vector
void computeLastFreePos()
Computes the last free position on this stop.
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.
bool lefthand() const
return whether the network was built for lefthand traffic
int getOccupancy() const
Returns the area occupancy.
void move2side(double amount)
move position vector to side using certain ammount
virtual 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.
const double myBegPos
The begin position this bus stop is located at.
int myCapacity
Stop area capacity.
bool myOnRoad
Whether vehicles stay on the road.
void leaveFrom(SUMOVehicle *what)
Called if a vehicle leaves this stop.
double getWidth() const
Returns the lot rectangle width.
virtual ~MSParkingArea()
Destructor.
double getLastFreePosWithReservation(SUMOTime t, const SUMOVehicle &forVehicle)
Returns the last free position on this stop including reservatiosn from the current lane and time ste...
double interpolateLanePosToGeometryPos(double lanePos) const
double getLength() const
Get vehicle's length [m].
Representation of a single lot space.
double getLastFreePos() const
double myWidth
The default width of each parking space.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
Representation of a lane in the micro simulation.
double getAngle() const
Returns the lot rectangle angle.
virtual const std::string & getID() const =0
Get the vehicle's ID.
SUMOVehicle * vehicle
The last parked vehicle or 0.
static const Position INVALID
used to indicate that a position is valid
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
double myRotation
The rotation.