AnyLogic
Expand
Font size
All Implemented Interfaces:
AggregatableAnimationElement, HasLevel, SVGElement, UsdElement, Serializable

public class ParkingLot
extends AbstractRoadSidePart
Class representing a set of parking spaces along border of a road segment. Parallel and perpendicular parking types are supported. Parking lot belongs to some road segment. One road segment can contain several parking lots.
Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
Serialized Form

Field Summary

Fields inherited from interface com.anylogic.engine.presentation.UsdElement

ID_NOT_SET

Constructor Summary

ConstructorDescription
ParkingLot() 
ParkingLot(Road road, ShapeDrawMode drawMode, boolean isPublic, boolean isOnForwardSide, double offset, ParkingLotType type, int parkingSpacesCount, double parkingSpaceWidthInMeters, double parkingSpaceLengthInMeters, int parkingAngle, boolean forceLeavingEnabled, double forceLeavingTimeoutInSeconds)
Deprecated.
deprecated in version 8.4, will be removed in the future releases

Method Summary

Modifier and TypeMethodDescription
AgentgetCarOnSpace(int spaceIndex)
Returns car located in the parking space with the given index, or null if this space is free
List<Agent>getCars()
Returns ordered list of cars located on this parking lot.
intgetDiagonalParkingAngle()
Returns parking angle value.
doublegetForceLeavingTimeout()
Returns the delay time after which cars leaving will be forced (i.e.
doublegetForceLeavingTimeout(TimeUnits units)
Returns the delay time after which cars leaving will be forced (i.e.
int[]getFreeSpaceIndexes()
Returns array of indexes of free parking spaces
doublegetLength() 
intgetParkingSpaceIndex(Agent car)
Returns the index of the parking space where the given car is located.
doublegetParkingSpaceLength()
Returns the length of parking space
doublegetParkingSpaceLength(LengthUnits units)
Returns the length of parking space
doublegetParkingSpaceWidth()
Returns the width of parking space
doublegetParkingSpaceWidth(LengthUnits units)
Returns the width of parking space
ParkingLotTypegetParkingType()
Returns parking type of the parking lot, parallel or perpendicular (diagonal)
booleanisForceLeaving()
Returns true if car will leave the parking lot forcibly after timeout (if specified) (i.e.
intnCars()
Returns number of cars located on this parking lot
intnFree()
Returns the number of free parking spaces in this parking lot
intnSpaces()
Returns the total number of spaces in this parking lot
voidpostInitialize()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
intrandomFreeSpaceIndex()
Returns the index of randomly chosen free parking space
voidsetDataSource(ParkingLotDataSource dataSource) 
voidsetDiagonalParkingAngle(int diagonalParkingAngle)
Sets diagonal angle of the parking lot spaces.
voidsetForceLeavingEnabled(boolean forceLeavingEnabled)
Switches the forced parking leaving mode on or off according to the given value.
voidsetForceLeavingTimeout(double timeout)
Sets the force parking leaving timeout value in model time units.
voidsetForceLeavingTimeout(double timeout, TimeUnits units)
Sets the force parking leaving timeout value in specified time units.
voidsetNSpaces(int parkingSpacesCount)
Sets number of parking spaces in parking lot.
voidsetParkingSpaceLength(double parkingSpaceLengthInPixels)
Deprecated.
this method is deprecated and may be removed in the next release.
voidsetParkingSpaceLength(double parkingSpaceLength, LengthUnits units)
Sets the length of parking space
voidsetParkingSpaceWidth(double parkingSpaceWidthInPixels)
Deprecated.
this method is deprecated and may be removed in the next release.
voidsetParkingSpaceWidth(double parkingSpaceWidth, LengthUnits units)
Sets the width of parking space
voidsetParkingType(ParkingLotType parkingType)
Sets parking type of the parking lot.

Methods inherited from class com.anylogic.engine.markup.AbstractRoadSidePart

isOnForwardSide, setOnForwardSide

Methods inherited from class com.anylogic.engine.markup.AbstractRoadPart

getOffset, getOffset, getRoad, setOffset, setOffset, setRoad

Methods inherited from class com.anylogic.engine.markup.AbstractRoadMarkup

contains, getLevel, getRoadNetwork, setDebugInfoVisible, setRoadNetwork

Methods inherited from class com.anylogic.engine.markup.MarkupShape

error, getDrawMode, getFullName, getOutsideLevelZ, getPresentable, getSpace, initialize, isClickHandled, isPublic, onClick, remove, setDrawMode, setOwner

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

ParkingLot

public ParkingLot()

ParkingLot

@Deprecated
public ParkingLot(Road road,
 ShapeDrawMode drawMode,
 boolean isPublic,
 boolean isOnForwardSide,
 double offset,
 ParkingLotType type,
 int parkingSpacesCount,
 double parkingSpaceWidthInMeters,
 double parkingSpaceLengthInMeters,
 int parkingAngle,
 boolean forceLeavingEnabled,
 double forceLeavingTimeoutInSeconds)
Deprecated.
deprecated in version 8.4, will be removed in the future releases
Creates parking lot with specified number of parking spaces along the specified side (forward or backward) of the specified road segment at the specified offset.
Parameters:
road - Road segment on which the parking lot is created.
drawMode - Where to draw this space markup shape: 2D, 3D or 2D+3D.
ispublic - If true, the markup shape is visible on container's presentation.
isOnForwardSide - Flag specifying whether the parking lot is created on forward or backward side of road segment.
offset - Offset (measured by guideline of lane adjacent to parking lot) from beginning of road axis to beginning of parking lot, in pixels.
type - Parking type, parallel, perpendicular or diagonal.
parkingSpacesCount - Count of parking spaces to be created.
parkingSpaceWidthInMeters - the width of parking space, measured in meters
parkingSpaceLengthInMeters - the length of parking space, measured in meters
parkingAngle - the angle of diagonal parking, measured in degrees
forceLeavingEnabled - if true then car will force parking leaving after some timeout
forceLeavingTimeoutInSeconds - the force parking leaving timeout value

Method Details

setDataSource

@AnyLogicInternalAPI
public void setDataSource(ParkingLotDataSource dataSource)

getParkingSpaceIndex

public int getParkingSpaceIndex(Agent car)
Returns the index of the parking space where the given car is located.
Returns:
parking space index for specified car (0, 1, 2,..)
Throws:
exception - if there is no specified car in the parking lot.

nFree

public int nFree()
Returns the number of free parking spaces in this parking lot
Returns:
the number of free parking spaces

getForceLeavingTimeout

public double getForceLeavingTimeout()
Returns the delay time after which cars leaving will be forced (i.e. leaving cars will have a bigger priority than cars in the basic road lane).
Returns:
delay in model time units before the forcing of car leaving.

getForceLeavingTimeout

public double getForceLeavingTimeout(TimeUnits units)
Returns the delay time after which cars leaving will be forced (i.e. leaving cars will have a bigger priority than cars in the basic road lane).
Returns:
delay before the forcing of car leaving.

isForceLeaving

public boolean isForceLeaving()
Returns true if car will leave the parking lot forcibly after timeout (if specified) (i.e. leaving cars will have a bigger priority than cars in the basic road lane).
Returns:
true is car will force parking leaving after some timeout.

randomFreeSpaceIndex

public int randomFreeSpaceIndex()
Returns the index of randomly chosen free parking space
Returns:
free parking space index (0, 1, 2,..)

getCarOnSpace

public Agent getCarOnSpace(int spaceIndex)
Returns car located in the parking space with the given index, or null if this space is free
Parameters:
spaceIndex - index of parking space
Returns:
agent (car) or null

nCars

public int nCars()
Returns number of cars located on this parking lot
Returns:
number of cars

getCars

public List<Agent> getCars()
Returns ordered list of cars located on this parking lot. The first car in the list is the nearest one to the exit point from parking lot (is the first one to exit the parking lot).
Returns:
ordered list of cars

getFreeSpaceIndexes

public int[] getFreeSpaceIndexes()
Returns array of indexes of free parking spaces
Returns:
ordered array of indexes of free parking spaces (0-based)
See Also:
randomFreeSpaceIndex()

postInitialize

@AnyLogicInternalAPI
public void postInitialize()
Description copied from interface: AggregatableAnimationElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.

getParkingType

public ParkingLotType getParkingType()
Returns parking type of the parking lot, parallel or perpendicular (diagonal)
Returns:
Parking type of the parking lot, parallel or perpendicular (diagonal)

getDiagonalParkingAngle

public int getDiagonalParkingAngle()
Returns parking angle value. It is 0 for parallel parking and belongs to [1..90] for perpendicular ones.
Returns:
diagonal angle of all parking spaces of the parking lot.

setDiagonalParkingAngle

public void setDiagonalParkingAngle(int diagonalParkingAngle)
Sets diagonal angle of the parking lot spaces. Must be integer value between 1 and 90.
Parameters:
parkingAngle - is the parking angle value in degrees.

setParkingType

public void setParkingType(ParkingLotType parkingType)
Sets parking type of the parking lot.
Parameters:
parkingType - type of the parking lot, parallel or perpendicular.

nSpaces

public int nSpaces()
Returns the total number of spaces in this parking lot
Returns:

setNSpaces

public void setNSpaces(int parkingSpacesCount)
Sets number of parking spaces in parking lot.
Parameters:
parkingSpacesCount - number of parking spaces in the parking lot.

setForceLeavingEnabled

public void setForceLeavingEnabled(boolean forceLeavingEnabled)
Switches the forced parking leaving mode on or off according to the given value.
Parameters:
forceLeavingEnabled - forced parking leaving mode

setForceLeavingTimeout

public void setForceLeavingTimeout(double timeout,
 TimeUnits units)
Sets the force parking leaving timeout value in specified time units.
Parameters:
timeout - the force parking leaving timeout value (in specified time units).
units - timeout's time units

setForceLeavingTimeout

public void setForceLeavingTimeout(double timeout)
Sets the force parking leaving timeout value in model time units.
Parameters:
timeout - the force parking leaving timeout value (in model time units).

getParkingSpaceLength

public double getParkingSpaceLength()
Returns the length of parking space
Returns:
the length of parking space in XY-projection, measured in pixels (using scale of the agent which acts as 'Space')

getParkingSpaceLength

public double getParkingSpaceLength(LengthUnits units)
Returns the length of parking space
Parameters:
units - length units
Returns:
the length of parking space in XY-projection, measured in the given units

setParkingSpaceLength

@Deprecated
public void setParkingSpaceLength(double parkingSpaceLengthInPixels)
Deprecated.
this method is deprecated and may be removed in the next release. Please use method with units argument instead.
Sets the length of parking space
Parameters:
parkingSpaceLengthInPixels - the length of parking space in XY-projection, measured in pixels

setParkingSpaceLength

public void setParkingSpaceLength(double parkingSpaceLength,
 LengthUnits units)
Sets the length of parking space
Parameters:
parkingSpaceLength - the length of parking space in XY-projection, measured in the given units
units - length units

getParkingSpaceWidth

public double getParkingSpaceWidth()
Returns the width of parking space
Returns:
the width of parking space in XY-projection, measured in pixels (using scale of the agent which acts as 'Space')

getParkingSpaceWidth

public double getParkingSpaceWidth(LengthUnits units)
Returns the width of parking space
Parameters:
units - length units
Returns:
the width of parking space in XY-projection, measured in the given units

setParkingSpaceWidth

@Deprecated
public void setParkingSpaceWidth(double parkingSpaceWidthInPixels)
Deprecated.
this method is deprecated and may be removed in the next release. Please use method with units argument instead.
Sets the width of parking space
Parameters:
parkingSpaceWidthInPixels - the width of parking space in XY-projection, measured in pixels

setParkingSpaceWidth

public void setParkingSpaceWidth(double parkingSpaceWidth,
 LengthUnits units)
Sets the width of parking space
Parameters:
parkingSpaceWidth - the width of parking space in XY-projection, measured in the given units
units - length units

getLength

@AnyLogicInternalLibraryAPI
public double getLength()
Specified by:
getLength in class AbstractRoadSidePart