Package com.anylogic.engine.markup
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- showLaneConnectors
- setRoads
- setDataSource
- nCars
- getCars
- traffic
- countCars
- resetStats
- generateDefaultGuideline
- setGuideline
- getIncomingConnectionPoints
- getOutgoingConnectionPoints
- getConnectionPoint
- getConnectionPoint
- setGuideline
- getGuidelines
- getConnectionPoints
- postInitialize
- addRoad
- addConnection
- addConnection
- addConnection
- getLanesConnectors
- updateDynamicProperties
- All Implemented Interfaces:
AggregatableAnimationElement
,HasLevel
,SVGElement
,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
Constructor | Description |
---|---|
Intersection() |
Creates a new instance of road intersection.
|
Intersection |
Deprecated.
deprecated in version 8.4, will be removed in the future releases
|
Intersection |
Deprecated.
deprecated in version 8.4, will be removed in the future releases
|
Modifier and Type | Method | Description |
---|---|---|
void | addConnection |
Adds roads connection
|
void | addConnection |
Adds roads connection
|
void | addConnection |
Adds roads connection
|
void | addRoad |
Adds road to this intersection
|
int | countCars |
Returns the total number of cars that moved through the intersection from one specified road to another specified road.
|
static List<MarkupSegment> | generateDefaultGuideline | |
List<Agent> | getCars() |
Returns unordered list of cars located on this intersection / connection
|
RoadConnectionPoint | getConnectionPoint |
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 |
Returns connection point that is connected to the specified point, or null if such connection
point does not exist.
|
List<RoadConnectionPoint> | getConnectionPoints() |
Returns a list of connection points of the road element.
|
Map<Pair<RoadConnectionPoint, | getGuidelines() |
Returns map from pairs (incoming and outgoing) of road connection points to guidelines connecting the specified incoming and outgoing connection points.
|
List<RoadConnectionPoint> | getIncomingConnectionPoints() |
Returns list of all incoming connection points of the element.
|
List<RoadLanesConnector> | getLanesConnectors() |
Returns the list of lane connectors inside this intersection
|
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 | |
void | setGuideline |
Sets a guideline between the specified connection points.
|
void | setGuideline | |
void | setRoads |
Adds 2 roads to this markup element.
|
void | showLaneConnectors |
Shows or hides lane connectors
|
int | traffic |
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. |
error, getDrawMode, getFullName, getOutsideLevelZ, getPresentable, getSpace, initialize, isClickHandled, isPublic, onClick, remove, setDrawMode, setOwner
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 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 List<MarkupSegment> generateDefaultGuideline(RoadConnectionPoint inRoadConnectionPoint, RoadConnectionPoint outRoadConnectionPoint)
@AnyLogicInternalLibraryAPI public void setGuideline(RoadConnectionPoint inRoadConnectionPoint, RoadConnectionPoint outRoadConnectionPoint, List<MarkupSegment> guideline)
@AnyLogicInternalLibraryAPI public 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 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 Map<Pair<RoadConnectionPoint,RoadConnectionPoint>, getGuidelines()List<MarkupSegment>>
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 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, List<MarkupSegment> guideLine)
Adds roads connection
public 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