AnyLogic
Expand
Font size
All Implemented Interfaces:
AggregatableAnimationElement, HasLevel, SVGElement, 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

Constructor Summary

ConstructorDescription
ParkingLot() 
ParkingLot(Road road, ShapeDrawMode drawMode, boolean isPublic, boolean isOnForwardSide, double offset, ParkingLotType type, int parkingSpacesCount, double parkingSpaceWidthInMeters, double parkingSpaceLengthInMeters)
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.
int[]getFreeSpaceIndexes()
Returns array of indexes of free parking spaces
doublegetLength() 
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.
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) 
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)
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 or perpendicular.
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

Method Details

setDataSource

@AnyLogicInternalAPI
public void setDataSource(ParkingLotDataSource dataSource)

nFree

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

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.
Returns:
Parking type of the parking lot, parallel or perpendicular.

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.

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