Road network is created by connecting the following Road Traffic Library markup elements:
Road network is created even if you add just one single road to the graphical editor. It is accounted for by the fact that setting the following road properties: lane width, right-hand or left-hand traffic direction, road background color, etc. will be time consuming in case of a complex road network including numerous roads. Instead of this AnyLogic offers to once set these parameters in the road network properties for all the roads of the current network. Now we will describe how to do it.
To change road network parameters
- Click on any element of the road network (e.g. click on a road) in the graphical editor. The first click selects the element itself.
- Click on this element again to select the entire road network the element belongs to.
-
Now you may proceed to the Properties view and modify the network’s parameters (e.g. 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.
Ignore — If selected, the network is excluded from the model.
Visible on upper agent — If selected, the network is also visible on the upper agent where this agent lives.
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.
Visible — Here you specify whether the network shapes are visible on animation at model runtime, or not. Using the control, choose yes or no.
Traffic — Specifies the side of the road bidirectional traffic should keep to. There are two options:
- Right-hand — traffic is required to keep to the right side of the road
- Left-hand — traffic is required to keep to the left side of the road
Lane width — Defines the width of network lanes in the length units that you choose in the drop down menu to the right of this field. The default width of the lane is 3.5 meters.
- Appearance
-
Road color — Here you can define the color of the road.
Lanes delimiting line style — Here you can choose the style of the lane delimiting line from the drop-down menu (single, single broken, double, double broken).
Lanes delimiting line color — Here you can define the color of the lane delimiting line.
Directions delimiting line style — Here you can choose the style of the direction delimiting line from the drop-down menu (single, single broken, double, double broken).
Directions delimiting line color — Here you can define the color of the direction delimiting line.
- Advanced
-
Show in — Here you can choose whether you want the shape to be shown both in 2D and 3D animation, or in 2D only, or in 3D only.
Show name — If selected, the element’s name is displayed on the graphical diagram.
Show lane connectors of intersections — If selected, lane connectors of intersections will be shown in 2D animation at the model runtime.
Animate signal states of stop lines and lanes connectors — If selected, animation of stop lines and lane connectors of intersections is shown in 2D animation at model runtime. The color of each stop line and lane connector controlled by a traffic light will correspond to the color of the current traffic light signal (red, yellow, or green).
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. A car, however, can switch its network (e.g. to model part of the car movement on a higher abstraction level and not on the detailed physical level) with the help of the CarExit and CarEnter blocks.
AnyLogic does not support dynamic construction and adding new elements to the road network when the model is running. You can construct a network with the help of the corresponding Java functions only before running your model. Network will be created on running the model and you won’t be able to add new elements to it anymore.
- Road lane width
-
Function Description double getLaneWidth() Returns lane width, measured in pixels. double getLaneWidth(LengthUnits units) Returns lane width, measured in the given length units.
units — length unit constantvoid setLaneWidth(double laneWidthInPixels) Sets new lane width.
laneWidthInPixels — Lane width, measured in pixels.void setLaneWidth(double laneWidth, LengthUnits units) Sets lane width in the given length units.
laneWidth — Lane width, measured in the given length units
units — length unit constant - Road color
-
Function Description void setRoadBackgroundColor(Color roadBackgroundColor) Sets the road surface color.
roadBackgroundColor — The new color, if null surface color is not drawnvoid setRoadBackgroundColor(Paint roadBackgroundColor) Sets the road surface color (or texture).
roadBackgroundColor — The new color, if null 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 belonging to this road network. List<TrafficLight> getTrafficLights() Returns all traffic lights belonging to this road network. List<StopLine> getStopLines() Returns all stop lines belonging to this road network. List<ParkingLot> getParkingLots() Returns all parking lots belonging to this road network. List<BusStop> getBusStops() Returns all bus stops belonging 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 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 — visibility of the road network. If true, road network is visible, if false — not visible.boolean isVisible() Returns the visibility of the road network. If it returns true, the road network is visible, if false — not visible. boolean isSignalStateAnimationVisible() Returns true, if configured to animate signal states of stop lines and lane connectors. public void setSignalStateAnimationVisible(boolean visible) Sets debug animation visibility.
visible — to animate (true) or not (false) 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 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 style of the directions delimiting line.
directionsDelimitingLineStyle — 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 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 style of the road lanes delimiting line.
lanesDelimitingLineStyle — 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, where this road network is located.
-
How can we improve this article?
-