public class Road extends AbstractRoadConnectableElement
Modifier and Type | Field and Description |
---|---|
static float[] |
DOUBLE_DASH |
static float[] |
SINGLE_DASH |
Constructor and Description |
---|
Road()
Creates a new road segments.
|
Road(Agent owner,
ShapeDrawMode drawMode,
boolean isPublic,
int forwardLanesCount,
int backwardLanesCount,
double medianStripWidthInMeters,
java.awt.Paint medianStripColor,
MarkupSegment... axisSegments)
Deprecated.
deprecated in version 8.4, will be removed in the future releases
|
Modifier and Type | Method and Description |
---|---|
void |
addSegment(MarkupSegment segment)
Adds segment to this markup element
|
double |
averageSpeed(boolean isOnForwardSide,
double offset)
Returns the average speed (in meters per second) on the given road direction near the
specified offset
|
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
|
java.util.List<MarkupSegment> |
getAxisMarkupSegments()
Returns list of markup segments representing road axis (the middle of median strip).
|
RoadConnectionPoint |
getBackwardIncomingConnectionPoint(int backwardLaneIndex)
Returns incoming connection point located at the beginning of backward lane with the specified index.
|
java.util.List<MarkupSegment> |
getBackwardLaneMarkupSegments(int backwardLaneIndex)
Returns list of markup segments representing guideline of backward lane with the specified lane index.
|
int |
getBackwardLanesCount()
Returns count of backward lanes.
|
RoadConnectionPoint |
getBackwardOutgoingConnectionPoint(int backwardLaneIndex)
Returns outgoing connection point located at the end of backward lane with the specified index.
|
java.util.List<RoadConnectionPoint> |
getBeginConnectionPoints()
Returns list of all connection points located at the beginning of road segment.
|
BoundingRectangle |
getBoundingRectangle() |
java.util.List<BusStop> |
getBusStops()
Returns all bus stops contained in this road
|
java.util.List<Agent> |
getCars(boolean isOnForwardSide)
Returns ordered list of cars located on the given direction.
|
java.util.List<RoadConnectionPoint> |
getConnectionPoints()
Returns a list of connection points of the road element.
|
java.util.List<RoadConnectionPoint> |
getEndConnectionPoints()
Returns list of all connection points located at end of road segment.
|
RoadConnectionPoint |
getForwardIncomingConnectionPoint(int forwardLaneIndex)
Returns incoming connection point located at the beginning of forward lane with the specified index.
|
java.util.List<MarkupSegment> |
getForwardLaneMarkupSegments(int forwardLaneIndex)
Returns list of markup segments representing guideline of forward lane with the specified lane index.
|
int |
getForwardLanesCount()
Returns count of forward lanes.
|
RoadConnectionPoint |
getForwardOutgoingConnectionPoint(int forwardLaneIndex)
Returns outgoing connection point located at the end of forward lane with the specified index.
|
java.util.List<RoadConnectionPoint> |
getIncomingConnectionPoints(PathEndType type)
Returns list of incoming connection points located at the beginning of road segment.
|
int |
getLaneIndex(RoadConnectionPoint connectionPoint)
Returns zero-based index of lane to which the specified connection point belongs to.
|
java.awt.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(LengthUnits units)
Returns median strip width measured in the given units.
|
java.util.List<RoadConnectionPoint> |
getOutgoingConnectionPoints(PathEndType type)
Returns list of outgoing connection points located at the beginning of road segment.
|
java.util.List<ParkingLot> |
getParkingLots()
Returns all parking lots contained in this road
|
MarkupSegment |
getSegment(int index)
Returns the segment by its index
|
int |
getSegmentCount()
Returns the number of segments
|
java.util.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(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.
|
boolean |
isConnectionPointOnForwardDirection(RoadConnectionPoint connectionPoint)
Checks if the specified road connection point is located on forward direction of the road segment.
|
java.util.Iterator<MarkupSegment> |
iterator()
Creates and returns read-only iterator over segments
|
int |
nCars(boolean isOnForwardSide)
Returns number of cars located on the given direction.
|
int |
nCarsOnLane(boolean isOnForwardSide,
int laneIndex)
Returns number of cars located on located in the specified lane.
|
void |
postInitialize()
This method is internal and shouldn't be called by user.
|
void |
setBackwardLanesCount(int backwardLanesCount)
Sets number of backward lanes
|
void |
setDataSource(RoadDataSource dataSource) |
void |
setForwardLanesCount(int forwardLanesCount)
Sets number of forward lanes
|
void |
setMedianStripColor(java.awt.Color color)
Sets the color of the median strip color.
|
void |
setMedianStripColor(java.awt.Paint color)
Sets the color (or
Texture ) of the median strip color. |
void |
setMedianStripWidth(double medianStripWidthInPixels)
Deprecated.
this method is deprecated and may be removed in the next release. Please use method with units argument instead.
|
void |
setMedianStripWidth(double medianStripWidth,
LengthUnits units)
Sets median strip width measured in the given units
|
contains, getLevel, getRoadNetwork, setDebugInfoVisible, setRoadNetwork
error, getDrawMode, getFullName, getOutsideLevelZ, getPresentable, getSpace, initialize, isClickHandled, isPublic, onClick, remove, setDrawMode, setOwner
discardOwner, executeUserAction, findSVGElement, getName, 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()
@Deprecated public Road(Agent owner, ShapeDrawMode drawMode, boolean isPublic, int forwardLanesCount, int backwardLanesCount, double medianStripWidthInMeters, java.awt.Paint medianStripColor, MarkupSegment... axisSegments)
owner
- Agent to which the created road intersection belongs to.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.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)
isOnForwardSide
- true
if direction is along
road axis line, false
otherwiseoffset
- offset from the beginning of road axis lineunits
- speed unitspublic double averageSpeed(boolean isOnForwardSide, double offset)
isOnForwardSide
- true
if direction is along
road axis line, false
otherwiseoffset
- offset from the beginning of road axis linepublic int nCars(boolean isOnForwardSide)
isOnForwardSide
- true
if direction is along
road axis line, false
otherwisepublic int nCarsOnLane(boolean isOnForwardSide, int laneIndex)
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 inmostpublic java.util.List<Agent> getCars(boolean isOnForwardSide)
isOnForwardSide
- true
if direction is along
road axis line, false
otherwisepublic void setForwardLanesCount(int forwardLanesCount)
forwardLanesCount
- public void setBackwardLanesCount(int backwardLanesCount)
backwardLanesCount
- @Deprecated public void setMedianStripWidth(double medianStripWidthInPixels)
medianStripWidthInPixels
- median strip width measured in pixelspublic void setMedianStripWidth(double medianStripWidth, LengthUnits units)
medianStripWidth
- median strip widthunits
- length unitspublic void addSegment(MarkupSegment segment)
segment
- the segment, should be initialized if was created using no-argument constructorpublic int getSegmentCount()
public MarkupSegment getSegment(int index)
index
- the segment index, [0 .. getSegmentCount()
- 1]public java.util.Iterator<MarkupSegment> iterator()
@AnyLogicInternalAPI public void postInitialize()
AggregatableAnimationElement
postInitialize
in interface AggregatableAnimationElement
public double getWidth()
public double getWidth(LengthUnits units)
@AnyLogicInternalLibraryAPI public java.util.List<RoadConnectionPoint> getIncomingConnectionPoints(PathEndType type)
type
- one of RoadEnd.Type.BEGIN
or RoadEnd.Type.END
@AnyLogicInternalLibraryAPI public java.util.List<RoadConnectionPoint> getOutgoingConnectionPoints(PathEndType type)
type
- one of RoadEnd.Type.BEGIN
or RoadEnd.Type.END
@AnyLogicInternalLibraryAPI public java.util.List<RoadConnectionPoint> getBeginConnectionPoints()
@AnyLogicInternalLibraryAPI public java.util.List<RoadConnectionPoint> getEndConnectionPoints()
@AnyLogicInternalLibraryAPI public int getLaneIndex(RoadConnectionPoint connectionPoint)
connectionPoint
- Specified connection point.@AnyLogicInternalLibraryAPI public RoadConnectionPoint getForwardIncomingConnectionPoint(int forwardLaneIndex)
forwardLaneIndex
- Specified index of forward lane.@AnyLogicInternalLibraryAPI public boolean isConnectionPointOnForwardDirection(RoadConnectionPoint connectionPoint)
connectionPoint
- Specified connection point.@AnyLogicInternalLibraryAPI public RoadConnectionPoint getForwardOutgoingConnectionPoint(int forwardLaneIndex)
forwardLaneIndex
- Specified index of forward lane.@AnyLogicInternalLibraryAPI public RoadConnectionPoint getBackwardIncomingConnectionPoint(int backwardLaneIndex)
backwardLaneIndex
- Specified index of backward lane.public void setMedianStripColor(java.awt.Color color)
color
- the new color, null = do not draw the median strip colorpublic void setMedianStripColor(java.awt.Paint color)
Texture
) of the median strip color.color
- the new color, null = do not draw the median strip colorpublic java.awt.Color getMedianStripColor()
null
if median strip has
no fill or has texture (in this case getMedianStripTexture()
should be used instead)public Texture getMedianStripTexture()
@AnyLogicInternalLibraryAPI public RoadConnectionPoint getBackwardOutgoingConnectionPoint(int backwardLaneIndex)
backwardLaneIndex
- Specified index of backward lane.public int getForwardLanesCount()
public int getBackwardLanesCount()
@AnyLogicInternalLibraryAPI public java.util.List<MarkupSegment> getForwardLaneMarkupSegments(int forwardLaneIndex)
forwardLaneIndex
- Specified index of forward lane.@AnyLogicInternalLibraryAPI public java.util.List<MarkupSegment> getBackwardLaneMarkupSegments(int backwardLaneIndex)
backwardLaneIndex
- Specified index of backward lane.@AnyLogicInternalLibraryAPI public java.util.List<MarkupSegment> getAxisMarkupSegments()
public double getMedianStripWidth()
public double getMedianStripWidth(LengthUnits units)
units
- length units@AnyLogicInternalLibraryAPI public java.util.List<RoadConnectionPoint> getConnectionPoints()
AbstractRoadConnectableElement
getConnectionPoints
in class AbstractRoadConnectableElement
@AnyLogicInternalAPI public BoundingRectangle getBoundingRectangle()
public java.util.List<StopLine> getStopLines()
public java.util.List<ParkingLot> getParkingLots()
public java.util.List<BusStop> getBusStops()
Copyright © AnyLogic North America, LLC. All Rights Reserved.