Class Diagram
- java.lang.Object
 - 
- org.opentrafficsim.trafficcontrol.trafcod.Diagram
 
 
- 
public class Diagram extends Object
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-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
 - $Revision$, $LastChangedDate$, by $Author$, initial version Dec 1, 2016 
 - Author:
 - Alexander Verbraeck, Peter Knoppers, Wouter Schakel
 
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classDiagram.CommandCommands used in RouteStep.(package private) static classDiagram.LaneTypeTypes of lanes.(package private) classDiagram.RouteStepStep in a schematic route through the intersection.(package private) classDiagram.XYPairPack two integer coordinates in one object. 
- 
Field Summary
Fields Modifier and Type Field Description (package private) static intBICYCLEBicycle lane.(package private) static intBOUNDARYBoundary of schematic intersection.(package private) static intCAR_CENTERNo turn (center) lane(s).(package private) static intCAR_LEFTLeft turn lane(s).(package private) static intCAR_RIGHTRight turn lane(s).(package private) static intCAR_ROUNDABOUT_LEFTLeft turn area on roundabout.(package private) static intDIVIDER_1Central divider.(package private) static intDIVIDER_2Divider between center public transit and left turn lane.(package private) static intDIVIDER_3Divider between right turn lane and bicycle lane.(package private) static intDIVIDER_4Divider.(package private) static intDIVIDER_5Divider.(package private) static intDIVIDER_6Divider.(package private) static intDIVIDER_7Divider.(package private) static intPT_BICYCLE_SIDEWALKPublic transit between bicycle lane and right sidewalk.(package private) static intPT_DIV_LPublic transit between divider and left turn lane.(package private) static intPT_RIGHT_BICYCLEPublic transit between right turn lane and bicycle lane.(package private) static intPT_SIDEWALK_SHOULDERPublic transit right of right sidewalk.(package private) static intSHOULDERShoulder right of right sidewalk.(package private) static intSIDEWALKSidewalk. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanisGrass(int i)Report if object is inaccessible to all traffic.(package private) Diagram.LaneTypelaneType(int streamNumber)Return the LaneType for a stream number.static voidmain(String[] args)Test 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 voidrebuildTestPanel()Render the intersection.BufferedImagerender()Create a BufferedImage and render the schematic on it.(package private) introtatedX(Diagram.XYPair xyPair, int rotation)Return the rotated x value.(package private) introtatedY(Diagram.XYPair xyPair, int rotation)Return the rotated y value. 
 - 
 
- 
- 
Field Detail
- 
DIVIDER_1
static final int DIVIDER_1
Central divider.- See Also:
 - Constant Field Values
 
 
- 
CAR_ROUNDABOUT_LEFT
static final int CAR_ROUNDABOUT_LEFT
Left turn area on roundabout.- See Also:
 - Constant Field Values
 
 
- 
PT_DIV_L
static final int PT_DIV_L
Public transit between divider and left turn lane.- See Also:
 - Constant Field Values
 
 
- 
DIVIDER_2
static final int DIVIDER_2
Divider between center public transit and left turn lane.- See Also:
 - Constant Field Values
 
 
- 
CAR_LEFT
static final int CAR_LEFT
Left turn lane(s).- See Also:
 - Constant Field Values
 
 
- 
CAR_CENTER
static final int CAR_CENTER
No turn (center) lane(s).- See Also:
 - Constant Field Values
 
 
- 
CAR_RIGHT
static final int CAR_RIGHT
Right turn lane(s).- See Also:
 - Constant Field Values
 
 
- 
DIVIDER_3
static final int DIVIDER_3
Divider between right turn lane and bicycle lane.- See Also:
 - Constant Field Values
 
 
- 
PT_RIGHT_BICYCLE
static final int PT_RIGHT_BICYCLE
Public transit between right turn lane and bicycle lane.- See Also:
 - Constant Field Values
 
 
- 
DIVIDER_4
static final int DIVIDER_4
Divider.- See Also:
 - Constant Field Values
 
 
- 
BICYCLE
static final int BICYCLE
Bicycle lane.- See Also:
 - Constant Field Values
 
 
- 
DIVIDER_5
static final int DIVIDER_5
Divider.- See Also:
 - Constant Field Values
 
 
- 
PT_BICYCLE_SIDEWALK
static final int PT_BICYCLE_SIDEWALK
Public transit between bicycle lane and right sidewalk.- See Also:
 - Constant Field Values
 
 
- 
DIVIDER_6
static final int DIVIDER_6
Divider.- See Also:
 - Constant Field Values
 
 
- 
SIDEWALK
static final int SIDEWALK
Sidewalk.- See Also:
 - Constant Field Values
 
 
- 
DIVIDER_7
static final int DIVIDER_7
Divider.- See Also:
 - Constant Field Values
 
 
- 
PT_SIDEWALK_SHOULDER
static final int PT_SIDEWALK_SHOULDER
Public transit right of right sidewalk.- See Also:
 - Constant Field Values
 
 
- 
SHOULDER
static final int SHOULDER
Shoulder right of right sidewalk.- See Also:
 - Constant Field Values
 
 
- 
BOUNDARY
static final int BOUNDARY
Boundary of schematic intersection.- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Constructor Detail
- 
Diagram
public Diagram(Set<Short> streams) throws TrafficLightException
Construct a new diagram.- Parameters:
 streams- Set<Short>; the streams (numbered according to the Dutch standard) that cross the intersection.- Throws:
 TrafficLightException- when a route is invalid
 
 - 
 
- 
Method Detail
- 
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
final Diagram.LaneType laneType(int streamNumber)
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
final int rotatedX(Diagram.XYPair xyPair, int rotation)
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
final int rotatedY(Diagram.XYPair xyPair, int rotation)
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
public BufferedImage render()
Create a BufferedImage and render the schematic on it.- Returns:
 - BufferedImage
 
 
- 
main
public static void main(String[] args)
Test the Diagram code.- Parameters:
 args- String[]; the command line arguments (not used)
 
- 
makeCheckBox
public static JCheckBox makeCheckBox(int stream, boolean initialState)
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. 
 - 
 
 -