A road network is created by connecting the following Road Traffic Library markup elements:
A road network is created even if you add only a single road to the graphical editor. This is due to the fact that setting the following road properties: lane width, right or left traffic direction, road background color, and the like is time-consuming in case of a complex road network with numerous roads. Instead, AnyLogic offers to set these parameters once for all roads in the current network. Now we will describe how to do this.
To change road network parameters
- Right-click any element of the road network (for example, a road) in the graphical editor.
- Select the Select network option from the context menu.
-
Now you may proceed to the Properties view and modify the network’s parameters (for example, modify Lane width).
The changes you make in the road network properties will affect all elements of the current network. By modifying the lane width, you change the width of all parking spaces, bus stops, and lanes of all roads respectively.
- General
-
Name — The name of the road network.
Lock — If selected, the network is locked. Locked shapes do not react to mouse clicks — it is impossible to select them in the graphical editor until you unlock them.
Ignore — If selected, the network is excluded from the model.
Traffic — Specifies which side of the road bidirectional traffic should stay on. There are two options:
- Right-hand — traffic must keep to the right side of the road
- Left-hand — traffic must keep to the left side of the road
Lane width — Defines the width of network lanes in the length units you select from the drop-down menu to the right of this field. The default width of the lane is 3.5 meters.
- Appearance
-
Road color — Specifies the color of the road.
Lanes delimiting line style — The style of the lane delimiting line. From the drop-down menu, select single, single broken, double, or double broken.
Lanes delimiting line color — The color of the lane delimiting line.
Directions delimiting line style — The style of the direction delimiting line. From the drop-down menu, select single, single broken, double, or double broken.
Directions delimiting line color — The color of the direction delimiting line.
- Position and size
-
Level — The level to which this element belongs.
- Visibility and presentation
-
Visible — If selected, the network is visible during animation at model runtime.
Show in — Select whether the shape is displayed in both 2D and 3D animation, 2D only, or 3D only.
Agent presentation — If selected, the network is also visible on the upper-level agent that hosts the agent containing this network.
A model can contain several independent (not interconnected) road networks. A car can move (sent by the CarMoveTo block) only to the destination point located within the same network. However, a car can change its network using the CarExit and CarEnter blocks: for example, to model part of the car’s movement at a higher level of abstraction rather than at the detailed physical level.
AnyLogic does not support dynamic construction and adding new elements to the road network while the model is running. You can only construct a network using the appropriate Java functions before running your model. The network will be created when the model runs and you will not be able to add new elements to it.
- Road lane width
-
Function Description double getLaneWidth() Returns the lane width, measured in pixels. double getLaneWidth(LengthUnits units) Returns the lane width, measured in the given length units.
units — a length unit constantvoid setLaneWidth(double laneWidthInPixels) Sets the new lane width.
laneWidthInPixels — the lane width, measured in pixels.void setLaneWidth(double laneWidth, LengthUnits units) Sets the lane width in the given length units.
laneWidth — The lane width, measured in the given length units
units — a length unit constant - Road color
-
Function Description void setRoadBackgroundColor(Color roadBackgroundColor) Sets the road surface color.
roadBackgroundColor — the new color; if null, the surface color is not drawnvoid setRoadBackgroundColor(Paint roadBackgroundColor) Sets the road surface color (or texture).
roadBackgroundColor — the new color; if null, the surface color is not drawnColor getRoadBackgroundColor() Returns the road surface color, or null if the road has no color or if it has texture (in this case, getFillTexture() should be used instead). Texture getRoadBackgroundTexture() Returns the road surface texture, if the road has texture. - Road network elements
-
Function Description List<Road> getRoads() Returns all roads that belong to this road network. List<TrafficLight> getTrafficLights() Returns all traffic lights that belong to this road network. List<StopLine> getStopLines() Returns all stop lines that belong to this road network. List<ParkingLot> getParkingLots() Returns all parking lots that belong to this road network. List<BusStop> getBusStops() Returns all bus stops that belong to this road network. List<Intersection> getIntersections() Returns all intersections and lane merges that belong to this road network. - Driving direction
-
Function Description RoadDrivingDirection getDrivingDirection() Returns the driving direction (ROAD_RIGHT_HAND or ROAD_LEFT_HAND). setDrivingDirection(RoadDrivingDirection drivingDirection) Sets right-hand or left-hand driving direction.
drivingDirection — Driving direction, ROAD_RIGHT_HAND or ROAD_LEFT_HAND. - Visibility
-
Function Description void setVisible(boolean v) Sets the visibility of the road network.
v — the visibility of the road network. If true, the road network is visible, if false — not visible.boolean isVisible() Returns the visibility of the road network. If true, the road network is visible, if false — not visible. boolean isSignalStateAnimationVisible() Returns true when configured to animate signal states of stop lines and lane connectors. public void setSignalStateAnimationVisible(boolean visible) Sets the debug animation visibility.
visible — to animate (true) or not (false) the signal states of stop lines and lane connectors. - Direction delimiters
-
Function Description setDirectionsDelimitingLineColor(Color directionsDelimitingLineColor) Sets the color of the directions delimiting line.
directionsDelimitingLineColor — the new color; if null, the line is not drawn.setDirectionsDelimitingLineColor(Paint directionsDelimitingLineColor) Sets the color (or texture) of the directions delimiting line color.
directionsDelimitingLineColor — the new texture; if null the line is not drawn.Color getDirectionsDelimitingLineColor() Returns the color of the directions delimiting line, or null if the line has no color or has texture (in this case, getFillTexture() should be used instead). Color getDirectionsDelimitingLineColor() Returns the color of the directions delimiting line, or null if the line has no color or has texture (in this case, getFillTexture() should be used instead). Texture getDirectionsDelimitingLineTexture() Returns the texture of the directions delimiting line color, if the line color has texture. RoadLineStyle getDirectionsDelimitingLineStyle() Returns the style of the directions delimiting line. One of the following constants: - RoadLineStyle.ROAD_LINE_SINGLE
- RoadLineStyle.ROAD_LINE_SINGLE_DASHED
- RoadLineStyle.ROAD_LINE_DOUBLE
- RoadLineStyle.ROAD_LINE_DOUBLE_DASHED
setDirectionsDelimitingLineStyle(RoadLineStyle directionsDelimitingLineStyle) Sets the style of the directions delimiting line.
directionsDelimitingLineStyle — the line style, one of the following constants:- RoadLineStyle.ROAD_LINE_SINGLE
- RoadLineStyle.ROAD_LINE_SINGLE_DASHED
- RoadLineStyle.ROAD_LINE_DOUBLE
- RoadLineStyle.ROAD_LINE_DOUBLE_DASHED
- Lane delimiters
-
Function Description setLanesDelimitingLineColor(Color lanesDelimitingLineColor) Sets the color of the road lanes delimiting line.
lanesDelimitingLineColor — the new color; if null, the line is not drawn.setLanesDelimitingLineColor(Paint lanesDelimitingLineColor) Sets the color (or texture) of the road lanes delimiting line.
lanesDelimitingLineColor — the new texture; if null, the line is not drawn.Color getLanesDelimitingLineColor() Returns the color of the road lanes delimiting line, or null if the line has no color or has texture (in this case, getFillTexture() should be used instead). Texture getLanesDelimitingLineTexture() Returns the texture of the road lanes delimiting line, if the line has texture. RoadLineStyle getLanesDelimitingLineStyle() Returns the style of the road lanes delimiting line. One of the following constants: - RoadLineStyle.ROAD_LINE_SINGLE
- RoadLineStyle.ROAD_LINE_SINGLE_DASHED
- RoadLineStyle.ROAD_LINE_DOUBLE
- RoadLineStyle.ROAD_LINE_DOUBLE_DASHED
setLanesDelimitingLineStyle(RoadLineStyle lanesDelimitingLineStyle) Sets the style of the road lanes delimiting line.
lanesDelimitingLineStyle — The line style. One of the following constants:- RoadLineStyle.ROAD_LINE_SINGLE
- RoadLineStyle.ROAD_LINE_SINGLE_DASHED
- RoadLineStyle.ROAD_LINE_DOUBLE
- RoadLineStyle.ROAD_LINE_DOUBLE_DASHED
- Level
-
Function Description Level getLevel() Returns the level on which this road network is located.
-
How can we improve this article?
-