Package com.anylogic.engine.markup
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- setDataSource
- averageSpeed
- averageSpeed
- nCars
- nCarsOnLane
- getCars
- setForwardLanesCount
- setBackwardLanesCount
- setMedianStripWidth
- setMedianStripWidth
- addSegment
- getSegmentCount
- getSegment
- iterator
- postInitialize
- getWidth
- getWidth
- getIncomingConnectionPoints
- getOutgoingConnectionPoints
- getBeginConnectionPoints
- getEndConnectionPoints
- getLaneIndex
- getForwardIncomingConnectionPoint
- isConnectionPointOnForwardDirection
- getForwardOutgoingConnectionPoint
- getBackwardIncomingConnectionPoint
- setMedianStripColor
- setMedianStripColor
- getMedianStripColor
- getMedianStripTexture
- getBackwardOutgoingConnectionPoint
- getForwardLanesCount
- getBackwardLanesCount
- getForwardLaneMarkupSegments
- getBackwardLaneMarkupSegments
- getAxisMarkupSegments
- getMedianStripWidth
- getMedianStripWidth
- getConnectionPoints
- getBoundingRectangle
- getStopLines
- getParkingLots
- getBusStops
- All Implemented Interfaces:
AggregatableAnimationElement
,HasLevel
,SVGElement
,UsdElement
,Serializable
public class Road extends AbstractRoadConnectableElement
Class representing a road segment with several forward and backward lanes. Road segment should have at least 1 forward or backward lane.
Road segment can have a median strip of the specified width that separates forward and backward directions. Road segment has incoming and
outgoing connection points at ends. Each lane has 1 incoming connection point, 1 outgoing connection point and a guideline connecting them.
Lanes of each direction are numbered starting from 0 from outmost to inmost, so the lane closest to the central line has the greatest index.
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Modifier and Type | Field | Description |
---|---|---|
static final float[] | DOUBLE_DASH | |
static final float[] | SINGLE_DASH |
Constructor | Description |
---|---|
Road() |
Creates a new road segments.
|
Road |
Deprecated.
deprecated in version 8.4, will be removed in the future releases
|
Modifier and Type | Method | Description |
---|---|---|
void | addSegment |
Adds segment to this markup element
|
double | averageSpeed |
Returns the average speed (in meters per second) on the given road direction near the
specified offset
|
double | averageSpeed |
Returns the average speed (in the given units) on the given road direction near the
specified offset
|
List<MarkupSegment> | getAxisMarkupSegments() |
Returns list of markup segments representing road axis (the middle of median strip).
This method is internal and shouldn't be called by user. it may be removed/renamed in future. |
RoadConnectionPoint | getBackwardIncomingConnectionPoint |
Returns incoming connection point located at the beginning of backward lane with the specified index.
|
List<MarkupSegment> | getBackwardLaneMarkupSegments |
Returns list of markup segments representing guideline of backward lane with the specified lane index.
|
int | getBackwardLanesCount() |
Returns count of backward lanes.
|
RoadConnectionPoint | getBackwardOutgoingConnectionPoint |
Returns outgoing connection point located at the end of backward lane with the specified index.
|
List<RoadConnectionPoint> | getBeginConnectionPoints() |
Returns list of all connection points located at the beginning of road segment.
|
BoundingRectangle | getBoundingRectangle() | |
List<BusStop> | getBusStops() |
Returns all bus stops contained in this road
|
List<Agent> | getCars |
Returns ordered list of cars located on the given direction.
|
List<RoadConnectionPoint> | getConnectionPoints() |
Returns a list of connection points of the road element.
|
List<RoadConnectionPoint> | getEndConnectionPoints() |
Returns list of all connection points located at end of road segment.
|
RoadConnectionPoint | getForwardIncomingConnectionPoint |
Returns incoming connection point located at the beginning of forward lane with the specified index.
|
List<MarkupSegment> | getForwardLaneMarkupSegments |
Returns list of markup segments representing guideline of forward lane with the specified lane index.
|
int | getForwardLanesCount() |
Returns count of forward lanes.
|
RoadConnectionPoint | getForwardOutgoingConnectionPoint |
Returns outgoing connection point located at the end of forward lane with the specified index.
|
List<RoadConnectionPoint> | getIncomingConnectionPoints |
Returns list of incoming connection points located at the beginning of road segment.
|
int | getLaneIndex |
Returns zero-based index of lane to which the specified connection point belongs to.
|
Color | getMedianStripColor() |
Returns the color of the median strip, or
null if median strip has
no fill or has texture (in this case getMedianStripTexture() should be used instead) |
Texture | getMedianStripTexture() |
Returns the texture of the median strip color, if the median strip has texture
|
double | getMedianStripWidth() |
Returns median strip width, in pixels.
|
double | getMedianStripWidth |
Returns median strip width measured in the given units.
|
List<RoadConnectionPoint> | getOutgoingConnectionPoints |
Returns list of outgoing connection points located at the beginning of road segment.
|
List<ParkingLot> | getParkingLots() |
Returns all parking lots contained in this road
|
MarkupSegment | getSegment |
Returns the segment by its index
|
int | getSegmentCount() |
Returns the number of segments
|
List<StopLine> | getStopLines() |
Returns all stop lines contained in this road
|
double | getWidth() |
Returns the total width of road segment which consists of width of all forward lanes,
width of all backward lanes and width of median strip.
|
double | getWidth |
Returns the total width of road segment which consists of width of all forward lanes,
width of all backward lanes and width of median strip.
|
boolean | isConnectionPointOnForwardDirection |
Checks if the specified road connection point is located on forward direction of the road segment.
|
Iterator<MarkupSegment> | iterator() |
Creates and returns read-only iterator over segments
|
int | nCars |
Returns number of cars located on the given direction.
|
int | nCarsOnLane |
Returns number of cars located on located in the specified lane.
|
void | postInitialize() |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
void | setBackwardLanesCount |
Sets number of backward lanes
|
void | setDataSource | |
void | setForwardLanesCount |
Sets number of forward lanes
|
void | setMedianStripColor |
Sets the color of the median strip color.
|
void | setMedianStripColor |
Sets the color (or
Texture ) of the median strip color. |
void | setMedianStripWidth |
Deprecated.
this method is deprecated and may be removed in the next release.
|
void | setMedianStripWidth |
Sets median strip width measured in the given units
|
error, getDrawMode, getFullName, getOutsideLevelZ, getPresentable, getSpace, initialize, isClickHandled, isPublic, onClick, remove, setDrawMode, setOwner
discardOwner, executeUserAction, findSVGElement, getName, getOrGenerateUSDId, getSVGId, initializeInternal, isVisible, onAggregatorInitialized, onAggregatorVisibilityChanged, removeSVGFromOwner, resetSVGState, setVisible, updateDynamicProperties, updateDynamicPropertiesStructural, updateSVGProperties
public static final float[] DOUBLE_DASH
public static final float[] SINGLE_DASH
public Road()
Creates a new road segments.
@Deprecated public Road(Agent owner, ShapeDrawMode drawMode, boolean isPublic, int forwardLanesCount, int backwardLanesCount, double medianStripWidthInMeters, Paint medianStripColor, MarkupSegment... axisSegments)
Deprecated.
deprecated in version 8.4, will be removed in the future releases
Creates a new road segments along the specified path with specified count of forward and backward lanes and specified width
of median strip between driving directions. Axis path specifies the middle line of delimiter. If the road network uses
right-hand driving, all forward lanes will be created to the right of axis path and all backward lanes will be created
to the left of the axis path. Vice versa for left-hand driving.
- Parameters:
owner
- Agent to which the created road intersection belongs to.drawMode
- Where to draw this space markup shape: 2D, 3D or 2D+3D.ispublic
- Iftrue
, the markup shape is visible on container's presentation.forwardLanesCount
- Count of forward lanes.backwardLanesCount
- Count of backward lanes.medianStripWidthInMeters
- Width of median strip in meters.axisSegments
- Path specifying the line delimiting driving directions.
@AnyLogicInternalAPI public void setDataSource(RoadDataSource dataSource)
public double averageSpeed(boolean isOnForwardSide, double offset, SpeedUnits units)
Returns the average speed (in the given units) on the given road direction near the
specified offset
- Parameters:
isOnForwardSide
-true
if direction is along road axis line,false
otherwiseoffset
- offset from the beginning of road axis lineunits
- speed units- Returns:
- average speed value
public double averageSpeed(boolean isOnForwardSide, double offset)
Returns the average speed (in meters per second) on the given road direction near the
specified offset
- Parameters:
isOnForwardSide
-true
if direction is along road axis line,false
otherwiseoffset
- offset from the beginning of road axis line- Returns:
- average speed value, meters per second
public int nCars(boolean isOnForwardSide)
Returns number of cars located on the given direction.
- Parameters:
isOnForwardSide
-true
if direction is along road axis line,false
otherwise- Returns:
- number of cars
public int nCarsOnLane(boolean isOnForwardSide, int laneIndex)
Returns number of cars located on located in the specified lane.
- Parameters:
isOnForwardSide
-true
if direction is along road axis line,false
otherwiselaneIndex
- zero-based index of lane. Lanes are numbered from outmost (that has index 0) to inmost- Returns:
- number of cars located in the specified lane
public List<Agent> getCars(boolean isOnForwardSide)
Returns ordered list of cars located on the given direction.
The first car in the list is the nearest one to the exit point from road
(seems to be the first one to exit the road, if there is no
acceleration)
- Parameters:
isOnForwardSide
-true
if direction is along road axis line,false
otherwise- Returns:
- ordered list of cars
public void setForwardLanesCount(int forwardLanesCount)
Sets number of forward lanes
- Parameters:
forwardLanesCount
-
public void setBackwardLanesCount(int backwardLanesCount)
Sets number of backward lanes
- Parameters:
backwardLanesCount
-
@Deprecated public void setMedianStripWidth(double medianStripWidthInPixels)
Deprecated.
this method is deprecated and may be removed in the next release. Please use method with units argument instead.
Sets median strip width
- Parameters:
medianStripWidthInPixels
- median strip width measured in pixels
public void setMedianStripWidth(double medianStripWidth, LengthUnits units)
Sets median strip width measured in the given units
- Parameters:
medianStripWidth
- median strip widthunits
- length units
public void addSegment(MarkupSegment segment)
Adds segment to this markup element
- Parameters:
segment
- the segment, should be initialized if was created using no-argument constructor
public int getSegmentCount()
Returns the number of segments
- Returns:
- the number of segments
public MarkupSegment getSegment(int index)
Returns the segment by its index
- Parameters:
index
- the segment index, [0 ..getSegmentCount()
- 1]- Returns:
- the segment
public Iterator<MarkupSegment> iterator()
Creates and returns read-only iterator over segments
@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.
- Specified by:
postInitialize
in interfaceAggregatableAnimationElement
public double getWidth()
Returns the total width of road segment which consists of width of all forward lanes,
width of all backward lanes and width of median strip.
- Returns:
- Total width of road segment in pixels.
public double getWidth(LengthUnits units)
Returns the total width of road segment which consists of width of all forward lanes,
width of all backward lanes and width of median strip.
- Returns:
- Total width of road segment, measured in the given units.
@AnyLogicInternalLibraryAPI public List<RoadConnectionPoint> getIncomingConnectionPoints(PathEndType type)
Returns list of incoming connection points located at the beginning of road segment. Connection points
are ordered the same way as lanes: from outmost to inmost.
- Parameters:
type
- one ofRoadEnd.Type.BEGIN
orRoadEnd.Type.END
- Returns:
- List of incoming connection points located at the beginning of road segment.
@AnyLogicInternalLibraryAPI public List<RoadConnectionPoint> getOutgoingConnectionPoints(PathEndType type)
Returns list of outgoing connection points located at the beginning of road segment. Connection points
are ordered the same way as lanes: from outmost to inmost.
- Parameters:
type
- one ofRoadEnd.Type.BEGIN
orRoadEnd.Type.END
- Returns:
- List of outgoing connection points located at the beginning of road segment.
@AnyLogicInternalLibraryAPI public List<RoadConnectionPoint> getBeginConnectionPoints()
Returns list of all connection points located at the beginning of road segment. Connection points are ordered
in the following way:
- First, outgoing connection points from outmost to inmost,
- Second, incoming connection points from inmost to outmost.
- Returns:
- List of all connection points located at the beginning of road segment.
@AnyLogicInternalLibraryAPI public List<RoadConnectionPoint> getEndConnectionPoints()
Returns list of all connection points located at end of road segment. Connection points are ordered
in the following way:
- First, outgoing connection points from outmost to inmost,
- Second, incoming connection points from inmost to outmost.
- Returns:
- List of all connection points located at end of road segment.
@AnyLogicInternalLibraryAPI public int getLaneIndex(RoadConnectionPoint connectionPoint)
Returns zero-based index of lane to which the specified connection point belongs to.
- Parameters:
connectionPoint
- Specified connection point.- Returns:
- zero-based index of lane to which the specified connection point belongs or -1 if specified connection point does not belong to the road segment.
@AnyLogicInternalLibraryAPI public RoadConnectionPoint getForwardIncomingConnectionPoint(int forwardLaneIndex)
Returns incoming connection point located at the beginning of forward lane with the specified index.
- Parameters:
forwardLaneIndex
- Specified index of forward lane.- Returns:
- Incoming connection point located at the beginning of forward lane with the specified index or null if no lane with the specified index exists.
@AnyLogicInternalLibraryAPI public boolean isConnectionPointOnForwardDirection(RoadConnectionPoint connectionPoint)
Checks if the specified road connection point is located on forward direction of the road segment.
- Parameters:
connectionPoint
- Specified connection point.- Returns:
- True if the specified road connection point is located on forward direction, false otherwise.
@AnyLogicInternalLibraryAPI public RoadConnectionPoint getForwardOutgoingConnectionPoint(int forwardLaneIndex)
Returns outgoing connection point located at the end of forward lane with the specified index.
- Parameters:
forwardLaneIndex
- Specified index of forward lane.- Returns:
- Outgoing connection point located at the end of forward lane with the specified index or null if no lane with the specified index exists.
@AnyLogicInternalLibraryAPI public RoadConnectionPoint getBackwardIncomingConnectionPoint(int backwardLaneIndex)
Returns incoming connection point located at the beginning of backward lane with the specified index.
- Parameters:
backwardLaneIndex
- Specified index of backward lane.- Returns:
- Incoming connection point located at the beginning of backward lane with the specified index or null if no lane with the specified index exists.
public void setMedianStripColor(Color color)
Sets the color of the median strip color.
- Parameters:
color
- the new color, null = do not draw the median strip color
public void setMedianStripColor(Paint color)
Sets the color (or
Texture
) of the median strip color.- Parameters:
color
- the new color, null = do not draw the median strip color
public Color getMedianStripColor()
Returns the color of the median strip, or
null
if median strip has
no fill or has texture (in this case getMedianStripTexture()
should be used instead)- Returns:
- the color of the median strip color
public Texture getMedianStripTexture()
Returns the texture of the median strip color, if the median strip has texture
- Returns:
- the texture of the median strip color
@AnyLogicInternalLibraryAPI public RoadConnectionPoint getBackwardOutgoingConnectionPoint(int backwardLaneIndex)
Returns outgoing connection point located at the end of backward lane with the specified index.
- Parameters:
backwardLaneIndex
- Specified index of backward lane.- Returns:
- Outgoing connection point located at the end of backward lane with the specified index or null if no lane with the specified index exists.
public int getForwardLanesCount()
Returns count of forward lanes.
- Returns:
- Count of forward lanes.
public int getBackwardLanesCount()
Returns count of backward lanes.
- Returns:
- Count of backward lanes.
@AnyLogicInternalLibraryAPI public List<MarkupSegment> getForwardLaneMarkupSegments(int forwardLaneIndex)
Returns list of markup segments representing guideline of forward lane with the specified lane index.
- Parameters:
forwardLaneIndex
- Specified index of forward lane.- Returns:
- List of markup segments representing guideline of forward lane with the specified lane index, empty list if no forward lanes exist.
@AnyLogicInternalLibraryAPI public List<MarkupSegment> getBackwardLaneMarkupSegments(int backwardLaneIndex)
Returns list of markup segments representing guideline of backward lane with the specified lane index.
- Parameters:
backwardLaneIndex
- Specified index of backward lane.- Returns:
- List of markup segments representing guideline of backward lane with the specified lane index, empty list if no backward lanes exist.
@AnyLogicInternalLibraryAPI public List<MarkupSegment> getAxisMarkupSegments()
Returns list of markup segments representing road axis (the middle of median strip).
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
public double getMedianStripWidth()
Returns median strip width, in pixels.
- Returns:
- median strip width, in pixels.
public double getMedianStripWidth(LengthUnits units)
Returns median strip width measured in the given units.
- Parameters:
units
- length units- Returns:
- median strip width, in the given units.
@AnyLogicInternalLibraryAPI public List<RoadConnectionPoint> getConnectionPoints()
Description copied from class:
AbstractRoadConnectableElement
Returns a list of connection points of the road element. The elements of list can be sorted in any order, but this order
is the same during lifetime of the element.
- Specified by:
getConnectionPoints
in classAbstractRoadConnectableElement
- Returns:
- List of connection points of the road element.
@AnyLogicInternalAPI public BoundingRectangle getBoundingRectangle()
public List<StopLine> getStopLines()
Returns all stop lines contained in this road
- Returns:
- unmodifiable list of stop lines, ordered in 'forward' direction
public List<ParkingLot> getParkingLots()
Returns all parking lots contained in this road
- Returns:
- unmodifiable list of parking lots, ordered in 'forward' direction
public List<BusStop> getBusStops()
Returns all bus stops contained in this road
- Returns:
- unmodifiable list of bus stops, ordered in 'forward' direction