Package com.anylogic.engine.markup
- Constructor Summary
- Method Summary
- Methods inherited from class com.anylogic.engine.markup.AbstractRoadSidePart
- Methods inherited from class com.anylogic.engine.markup.AbstractRoadPart
- Methods inherited from class com.anylogic.engine.markup.AbstractRoadMarkup
- Methods inherited from class com.anylogic.engine.markup.MarkupShape
- Methods inherited from class com.anylogic.engine.markup.AbstractMarkup
- Methods inherited from class java.lang.Object
- Constructor Details
- Method Details
- setDataSource
- nFree
- randomFreeSpaceIndex
- getCarOnSpace
- nCars
- getCars
- getFreeSpaceIndexes
- postInitialize
- getParkingType
- setParkingType
- nSpaces
- setNSpaces
- getParkingSpaceLength
- getParkingSpaceLength
- setParkingSpaceLength
- setParkingSpaceLength
- getParkingSpaceWidth
- getParkingSpaceWidth
- setParkingSpaceWidth
- setParkingSpaceWidth
- getLength
- 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 | Description |
---|---|
ParkingLot() | |
ParkingLot |
Deprecated.
deprecated in version 8.4, will be removed in the future releases
|
Modifier and Type | Method | Description |
---|---|---|
Agent | getCarOnSpace |
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
|
double | getLength() | |
double | getParkingSpaceLength() |
Returns the length of parking space
|
double | getParkingSpaceLength |
Returns the length of parking space
|
double | getParkingSpaceWidth() |
Returns the width of parking space
|
double | getParkingSpaceWidth |
Returns the width of parking space
|
ParkingLotType | getParkingType() |
Returns parking type of the parking lot, parallel or perpendicular.
|
int | nCars() |
Returns number of cars located on this parking lot
|
int | nFree() |
Returns the number of free parking spaces in this parking lot
|
int | nSpaces() |
Returns the total number of spaces in this parking lot
|
void | postInitialize() |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
int | randomFreeSpaceIndex() |
Returns the index of randomly chosen free parking space
|
void | setDataSource | |
void | setNSpaces |
Sets number of parking spaces in parking lot.
|
void | setParkingSpaceLength |
Deprecated.
this method is deprecated and may be removed in the next release.
|
void | setParkingSpaceLength |
Sets the length of parking space
|
void | setParkingSpaceWidth |
Deprecated.
this method is deprecated and may be removed in the next release.
|
void | setParkingSpaceWidth |
Sets the width of parking space
|
void | setParkingType |
Sets parking type of the parking lot.
|
error, getDrawMode, getFullName, getOutsideLevelZ, getPresentable, getSpace, initialize, isClickHandled, isPublic, onClick, remove, setDrawMode, setOwner
public 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
- Iftrue
, 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 metersparkingSpaceLengthInMeters
- the length of parking space, measured in meters
@AnyLogicInternalAPI public void setDataSource(ParkingLotDataSource dataSource)
public int nFree()
Returns the number of free parking spaces in this parking lot
- Returns:
- the number of free parking spaces
public int randomFreeSpaceIndex()
Returns the index of randomly chosen free parking space
- Returns:
- free parking space index (0, 1, 2,..)
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
public int nCars()
Returns number of cars located on this parking lot
- Returns:
- number of cars
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
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()
@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.
it may be removed/renamed in future.
public ParkingLotType getParkingType()
Returns parking type of the parking lot, parallel or perpendicular.
- Returns:
- Parking type of the parking lot, parallel or perpendicular.
public void setParkingType(ParkingLotType parkingType)
Sets parking type of the parking lot.
- Parameters:
parkingType
- type of the parking lot, parallel or perpendicular.
public int nSpaces()
Returns the total number of spaces in this parking lot
- Returns:
public void setNSpaces(int parkingSpacesCount)
Sets number of parking spaces in parking lot.
- Parameters:
parkingSpacesCount
- number of parking spaces in the parking lot.
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')
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
@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
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 unitsunits
- length units
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')
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
@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
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 unitsunits
- length units
@AnyLogicInternalLibraryAPI public double getLength()
- Specified by:
getLength
in classAbstractRoadSidePart