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-2023 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
Nested ClassesModifier and TypeClassDescription(package private) static enumCommands used in RouteStep.(package private) static enumTypes of lanes.(package private) classStep in a schematic route through the intersection.(package private) classPack two integer coordinates in one object. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final intBicycle lane.(package private) static final intBoundary of schematic intersection.(package private) static final intNo turn (center) lane(s).(package private) static final intLeft turn lane(s).(package private) static final intRight turn lane(s).(package private) static final intLeft turn area on roundabout.(package private) static final intCentral divider.(package private) static final intDivider between center public transit and left turn lane.(package private) static final intDivider between right turn lane and bicycle lane.(package private) static final intDivider.(package private) static final intDivider.(package private) static final intDivider.(package private) static final intDivider.(package private) static final intPublic transit between bicycle lane and right sidewalk.(package private) static final intPublic transit between divider and left turn lane.(package private) static final intPublic transit between right turn lane and bicycle lane.(package private) static final intPublic transit right of right sidewalk.(package private) static final intShoulder right of right sidewalk.(package private) static final intSidewalk. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final booleanisGrass(int i) Report if object is inaccessible to all traffic.(package private) final Diagram.LaneTypelaneType(int streamNumber) Return the LaneType for a stream number.static voidTest the Diagram code.static JCheckBoxmakeCheckBox(int stream, boolean initialState) Make a check box to switch a particular stream number on or off.(package private) static voidRender the intersection.render()Create a BufferedImage and render the schematic on it.(package private) final introtatedX(Diagram.XYPair xyPair, int rotation) Return the rotated x value.(package private) final introtatedY(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.
-