Package com.anylogic.engine.markup
- Constructor Summary
- Method Summary
- 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 Detail
- Method Detail
- showLaneConnectors
- setRoads
- setDataSource
- nCars
- getCars
- traffic
- countCars
- resetStats
- generateDefaultGuideline
- setGuideline
- getIncomingConnectionPoints
- getOutgoingConnectionPoints
- getConnectionPoint
- getConnectionPoint
- setGuideline
- getGuidelines
- getConnectionPoints
- postInitialize
- addRoad
- addConnection
- addConnection
- addConnection
- getLanesConnectors
- updateDynamicProperties
- java.lang.Object
- All Implemented Interfaces:
AggregatableAnimationElement
,HasLevel
,SVGElement
,java.io.Serializable
public class Intersection extends AbstractRoadConnectableElement
Class representing area of intersection of several (2 or more) road segments. Contains 1 or more incoming road connection points,
1 or more outgoing connection points and guidelines connecting pairs of incoming and outgoing connection points.
Each pair of incoming and outgoing connection points
cannot have more than 1 guideline. Provides functionality for automatic generation of intersection area border.
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Intersection() |
Creates a new instance of road intersection.
|
Intersection(Agent owner,
ShapeDrawMode drawMode,
boolean isPublic,
boolean showLaneConnectors,
PathEnd<Road>[] roadEnds,
RoadLanesConnector... lanes) |
Deprecated.
deprecated in version 8.4, will be removed in the future releases
|
Intersection(Agent owner,
ShapeDrawMode drawMode,
boolean isPublic,
boolean showLaneConnectors,
Road road1,
PathEndType type1,
Road road2,
PathEndType type2,
RoadLanesConnector... connectors) |
Deprecated.
deprecated in version 8.4, will be removed in the future releases
|
Constructor | Description |
---|
void |
addConnection(Road startRoad,
int startRoadLane,
Road endRoad,
int endRoadLane) |
Adds roads connection
|
void |
addConnection(Road startRoad,
int startRoadLane,
Road endRoad,
int endRoadLane,
MarkupSegment... guideLine) |
Adds roads connection
|
void |
addConnection(Road startRoad,
int startRoadLane,
Road endRoad,
int endRoadLane,
java.util.List<MarkupSegment> guideLine) |
Adds roads connection
|
void |
addRoad(Road road,
PathEndType type) |
Adds road to this intersection
|
int |
countCars(Road from,
Road to) |
Returns the total number of cars that moved through the intersection from one specified road to another specified road.
|
static java.util.List<MarkupSegment> |
generateDefaultGuideline(RoadConnectionPoint inRoadConnectionPoint,
RoadConnectionPoint outRoadConnectionPoint) |
|
java.util.List<Agent> |
getCars() |
Returns unordered list of cars located on this intersection / connection
|
RoadConnectionPoint |
getConnectionPoint(boolean isIncoming,
Road connectedWithRoadSegment,
int roadSegmentLaneIndex) |
Returns connection point that is directed at the specified direction, connected with the specified road segment and corresponds to the
specified lane index in this road segment.
|
RoadConnectionPoint |
getConnectionPoint(RoadConnectionPoint connectedPoint) |
Returns connection point that is connected to the specified point, or null if such connection
point does not exist.
|
java.util.List<RoadConnectionPoint> |
getConnectionPoints() |
Returns a list of connection points of the road element.
|
java.util.Map<Pair<RoadConnectionPoint,RoadConnectionPoint>,java.util.List<MarkupSegment>> |
getGuidelines() |
Returns map from pairs (incoming and outgoing) of road connection points to guidelines connecting the specified incoming and outgoing connection points.
|
java.util.List<RoadConnectionPoint> |
getIncomingConnectionPoints() |
Returns list of all incoming connection points of the element.
|
java.util.List<RoadLanesConnector> |
getLanesConnectors() |
Returns the list of lane connectors inside this intersection
|
java.util.List<RoadConnectionPoint> |
getOutgoingConnectionPoints() |
Returns list of all outgoing connection points of the element.
|
int |
nCars() |
Returns number of cars located on this intersection / connection
|
void |
postInitialize() |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
void |
resetStats() |
Resets counters of cars for all lane connectors on this intersection
|
void |
setDataSource(RoadBasicDataSource dataSource) |
|
void |
setGuideline(RoadConnectionPoint inRoadConnectionPoint,
RoadConnectionPoint outRoadConnectionPoint) |
Sets a guideline between the specified connection points.
|
void |
setGuideline(RoadConnectionPoint inRoadConnectionPoint,
RoadConnectionPoint outRoadConnectionPoint,
java.util.List<MarkupSegment> guideline) |
|
void |
setRoads(Road road1,
PathEndType type1,
Road road2,
PathEndType type2) |
Adds 2 roads to this markup element.
|
void |
showLaneConnectors(boolean showLaneConnectors) |
Shows or hides lane connectors
|
int |
traffic(Road from,
Road to) |
Returns the traffic of car flow from one specified road to another specified road, measured in cars per hour.
|
void |
updateDynamicProperties() |
Updates dynamic properties of this shape only (without structural contents, if any) in a given context.
Method should be overridden for shapes with dynamic properties. |
Modifier and Type | Method | Description |
---|
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, updateDynamicPropertiesStructural, updateSVGProperties
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public Intersection()
Creates a new instance of road intersection. Should not be directly called by user.
@Deprecated public Intersection(Agent owner, ShapeDrawMode drawMode, boolean isPublic, boolean showLaneConnectors, PathEnd<Road>[] roadEnds, RoadLanesConnector... lanes)
Deprecated.
deprecated in version 8.4, will be removed in the future releases
Creates a new instance of road intersection. Should not be directly called by user.
- 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.showLaneConnectors
- display or not lane connector lines on 2D animationroadEnds
- array of road ends coming to this intersectionlanes
- connectors between road ends
@Deprecated public Intersection(Agent owner, ShapeDrawMode drawMode, boolean isPublic, boolean showLaneConnectors, Road road1, PathEndType type1, Road road2, PathEndType type2, RoadLanesConnector... connectors)
Deprecated.
deprecated in version 8.4, will be removed in the future releases
Creates a new road connector that connects the specified sets of connection points of the two roads.
- 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.showLaneConnectors
- display or not lane connector lines on 2D animationroad1
- road 1type1
- eitherType#BEGIN
orType#END
of road 1road2
- road 2type2
- eitherType#BEGIN
orType#END
of road 2lanes
- connectors between road ends
public void showLaneConnectors(boolean showLaneConnectors)
Shows or hides lane connectors
- Parameters:
showLaneConnectors
- display or not lane connector lines on 2D animation
public void setRoads(Road road1, PathEndType type1, Road road2, PathEndType type2)
Adds 2 roads to this markup element.
- Parameters:
road1
- road 1type1
- eitherType#BEGIN
orType#END
of road 1road2
- road 2type2
- eitherType#BEGIN
orType#END
of road 2
@AnyLogicInternalAPI public void setDataSource(RoadBasicDataSource dataSource)
public int nCars()
Returns number of cars located on this intersection / connection
- Returns:
- number of cars
public java.util.List<Agent> getCars()
Returns unordered list of cars located on this intersection / connection
- Returns:
- list of cars, order is not guaranteed
public int traffic(Road from, Road to)
Returns the traffic of car flow from one specified road to another specified road, measured in cars per hour.
Note: the value is calculated for last five-minute interval If this intersection doesn't connect specified roads an error will occur.
Note: the value is calculated for last five-minute interval If this intersection doesn't connect specified roads an error will occur.
- Returns:
- the traffic from one specified road to another specified road, cars per hour
- See Also:
RoadLanesConnector.traffic()
public int countCars(Road from, Road to)
Returns the total number of cars that moved through the intersection from one specified road to another specified road.
Note: the
Note: the
from
road and the to
road may be the same road, if you want to count the U-turns.
If this intersection doesn't connect specified roads an error will occur.- Parameters:
from
- - the road by which the cars arrive at the intersectionto
- - the road by which the cars leave the intersection- Returns:
- the total number of cars that moved through the intersection from one specified road to another specified road
- See Also:
RoadLanesConnector.countCars()
public void resetStats()
Resets counters of cars for all lane connectors on this intersection
- See Also:
RoadLanesConnector#resetCarsCounter()
@AnyLogicInternalLibraryAPI public static java.util.List<MarkupSegment> generateDefaultGuideline(RoadConnectionPoint inRoadConnectionPoint, RoadConnectionPoint outRoadConnectionPoint)
@AnyLogicInternalLibraryAPI public void setGuideline(RoadConnectionPoint inRoadConnectionPoint, RoadConnectionPoint outRoadConnectionPoint, java.util.List<MarkupSegment> guideline)
@AnyLogicInternalLibraryAPI public java.util.List<RoadConnectionPoint> getIncomingConnectionPoints()
Returns list of all incoming connection points of the element. The order of elements in the list
is not determined, but this order is always the same.
- Returns:
- List of all incoming connection points.
@AnyLogicInternalLibraryAPI public java.util.List<RoadConnectionPoint> getOutgoingConnectionPoints()
Returns list of all outgoing connection points of the element. The order of elements in the list
is not determined, but this order is always the same.
- Returns:
- List of all outgoing connection points.
@AnyLogicInternalLibraryAPI public RoadConnectionPoint getConnectionPoint(RoadConnectionPoint connectedPoint)
Returns connection point that is connected to the specified point, or null if such connection
point does not exist.
- Parameters:
connectedPoint
- Specified connection point.- Returns:
- Connection point that is connected to the specified point, or null if such connection point does not exist.
@AnyLogicInternalLibraryAPI public RoadConnectionPoint getConnectionPoint(boolean isIncoming, Road connectedWithRoadSegment, int roadSegmentLaneIndex)
Returns connection point that is directed at the specified direction, connected with the specified road segment and corresponds to the
specified lane index in this road segment. If no such connection point exists, returns null.
- Parameters:
isIncoming
-true
for incoming direction,false
for outgoingconnectedWithRoadSegment
- Specified specified road segment.roadSegmentLaneIndex
- Specified 0-based lane index. The lane with index 0 is the outmost lane.- Returns:
- Connection point satisfying the specified criteria, or null if no such connection point exists.
@AnyLogicInternalLibraryAPI public void setGuideline(RoadConnectionPoint inRoadConnectionPoint, RoadConnectionPoint outRoadConnectionPoint)
Sets a guideline between the specified connection points. The guideline is automatically generated based on incoming and outgoing
directions according to Hermite rule. Incoming and outgoing connection points should belong to the element. If the guideline
already exists, overwrites the existing guideline.
- Parameters:
inRoadConnectionPoint
- Specified incoming road connection point.outRoadConnectionPoint
- Specified outgoing road connection point.
@AnyLogicInternalLibraryAPI public java.util.Map<Pair<RoadConnectionPoint,RoadConnectionPoint>,java.util.List<MarkupSegment>> getGuidelines()
Returns map from pairs (incoming and outgoing) of road connection points to guidelines connecting the specified incoming and outgoing connection points.
- Returns:
- Map from pairs (incoming and outgoing) of road connection points to guidelines connecting the specified incoming and outgoing connection points.
@AnyLogicInternalLibraryAPI public java.util.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 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 void addRoad(Road road, PathEndType type)
Adds road to this intersection
- Parameters:
road
- the roadtype
- eitherType#BEGIN
orType#END
of road
public void addConnection(Road startRoad, int startRoadLane, Road endRoad, int endRoadLane)
Adds roads connection
public void addConnection(Road startRoad, int startRoadLane, Road endRoad, int endRoadLane, MarkupSegment... guideLine)
Adds roads connection
public void addConnection(Road startRoad, int startRoadLane, Road endRoad, int endRoadLane, java.util.List<MarkupSegment> guideLine)
Adds roads connection
public java.util.List<RoadLanesConnector> getLanesConnectors()
Returns the list of lane connectors inside this intersection
- Returns:
- the unmodifiable list of
RoadLanesConnector
s
@AnyLogicInternalCodegenAPI public void updateDynamicProperties()
Description copied from class:
AbstractMarkup
Updates dynamic properties of this shape only (without structural contents, if any) in a given context.
Method should be overridden for shapes with dynamic properties. Note that you should call super.updateDynamicProperties() at the end of overridden method
Method should be overridden for shapes with dynamic properties. Note that you should call super.updateDynamicProperties() at the end of overridden method
- Overrides:
updateDynamicProperties
in classAbstractMarkup
-
How can we improve this article?
-