Class Diagram
java.lang.Object
org.opentrafficsim.trafficcontrol.trafcod.Diagram
Functions that can draw a schematic diagram of an intersection given the list of traffic streams. The traffic stream numbers
must follow the Dutch conventions.
Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static enum
Commands used in RouteStep.(package private) static enum
Types of lanes.(package private) class
Step in a schematic route through the intersection.(package private) class
Pack two integer coordinates in one object. -
Field Summary
Modifier and TypeFieldDescription(package private) static final int
Bicycle lane.(package private) static final int
Boundary of schematic intersection.(package private) static final int
No turn (center) lane(s).(package private) static final int
Left turn lane(s).(package private) static final int
Right turn lane(s).(package private) static final int
Left turn area on roundabout.(package private) static final int
Central divider.(package private) static final int
Divider between center public transit and left turn lane.(package private) static final int
Divider between right turn lane and bicycle lane.(package private) static final int
Divider.(package private) static final int
Divider.(package private) static final int
Divider.(package private) static final int
Divider.(package private) static final int
Public transit between bicycle lane and right sidewalk.(package private) static final int
Public transit between divider and left turn lane.(package private) static final int
Public transit between right turn lane and bicycle lane.(package private) static final int
Public transit right of right sidewalk.(package private) static final int
Shoulder right of right sidewalk.(package private) static final int
Sidewalk. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic final boolean
isGrass
(int i) Report if object is inaccessible to all traffic.(package private) final Diagram.LaneType
laneType
(int streamNumber) Return the LaneType for a stream number.static void
Test the Diagram code.static JCheckBox
makeCheckBox
(int stream, boolean initialState) Make a check box to switch a particular stream number on or off.(package private) static void
Render the intersection.render()
Create a BufferedImage and render the schematic on it.(package private) final int
rotatedX
(Diagram.XYPair xyPair, int rotation) Return the rotated x value.(package private) final int
rotatedY
(Diagram.XYPair xyPair, int rotation) Return the rotated y value.
-
Field Details
-
DIVIDER_1
static final int DIVIDER_1Central divider.- See Also:
-
CAR_ROUNDABOUT_LEFT
static final int CAR_ROUNDABOUT_LEFTLeft turn area on roundabout.- See Also:
-
PT_DIV_L
static final int PT_DIV_LPublic transit between divider and left turn lane.- See Also:
-
DIVIDER_2
static final int DIVIDER_2Divider between center public transit and left turn lane.- See Also:
-
CAR_LEFT
static final int CAR_LEFTLeft turn lane(s).- See Also:
-
CAR_CENTER
static final int CAR_CENTERNo turn (center) lane(s).- See Also:
-
CAR_RIGHT
static final int CAR_RIGHTRight turn lane(s).- See Also:
-
DIVIDER_3
static final int DIVIDER_3Divider between right turn lane and bicycle lane.- See Also:
-
PT_RIGHT_BICYCLE
static final int PT_RIGHT_BICYCLEPublic transit between right turn lane and bicycle lane.- See Also:
-
DIVIDER_4
static final int DIVIDER_4Divider.- See Also:
-
BICYCLE
static final int BICYCLEBicycle lane.- See Also:
-
DIVIDER_5
static final int DIVIDER_5Divider.- See Also:
-
PT_BICYCLE_SIDEWALK
static final int PT_BICYCLE_SIDEWALKPublic transit between bicycle lane and right sidewalk.- See Also:
-
DIVIDER_6
static final int DIVIDER_6Divider.- See Also:
-
SIDEWALK
static final int SIDEWALKSidewalk.- See Also:
-
DIVIDER_7
static final int DIVIDER_7Divider.- See Also:
-
PT_SIDEWALK_SHOULDER
static final int PT_SIDEWALK_SHOULDERPublic transit right of right sidewalk.- See Also:
-
SHOULDER
static final int SHOULDERShoulder right of right sidewalk.- See Also:
-
BOUNDARY
static final int BOUNDARYBoundary of schematic intersection.- See Also:
-
-
Constructor Details
-
Diagram
Construct a new diagram.- Parameters:
streams
- Set<Short>; the streams (numbered according to the Dutch standard) that cross the intersection.- Throws:
TrafficControlException
- when a route is invalid
-
-
Method Details
-
isGrass
public static final boolean isGrass(int i) Report if object is inaccessible to all traffic.- Parameters:
i
- int; the number of the object- Returns:
- boolean; true if the object is inaccessible to all traffic
-
laneType
Return the LaneType for a stream number.- Parameters:
streamNumber
- int; the standard Dutch traffic stream number- Returns:
- LaneType; the lane type of the stream; or null if the stream number is reserved or invalid
-
rotatedX
Return the rotated x value.- Parameters:
xyPair
- XYPair; the XYPairrotation
- int; rotation in multiples of 90 degrees- Returns:
- int; the x component of the rotated coordinates
-
rotatedY
Return the rotated y value.- Parameters:
xyPair
- XYPair; the XYPairrotation
- int; rotation in multiples of 90 degrees- Returns:
- int; the y component of the rotated coordinates
-
render
Create a BufferedImage and render the schematic on it.- Returns:
- BufferedImage
-
main
Test the Diagram code.- Parameters:
args
- String[]; the command line arguments (not used)
-
makeCheckBox
Make a check box to switch a particular stream number on or off.- Parameters:
stream
- int; the stream numberinitialState
- boolean; if true; the check box will be checked- Returns:
- JCheckBox
-
rebuildTestPanel
static void rebuildTestPanel()Render the intersection.
-