Class Diagram
java.lang.Object
org.opentrafficsim.trafficcontrol.trafcod.Diagram
public class Diagram
extends java.lang.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-2020 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
-
Constructor Summary
Constructors Constructor Description Diagram(java.util.Set<java.lang.Short> streams)
Construct a new diagram. -
Method Summary
Modifier and Type Method Description static boolean
isGrass(int i)
Report if object is inaccessible to all traffic.static void
main(java.lang.String[] args)
Test the Diagram code.static javax.swing.JCheckBox
makeCheckBox(int stream, boolean initialState)
Make a check box to switch a particular stream number on or off.java.awt.image.BufferedImage
render()
Create a BufferedImage and render the schematic on it.
-
Constructor Details
-
Diagram
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 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
-
render
public java.awt.image.BufferedImage render()Create a BufferedImage and render the schematic on it.- Returns:
- BufferedImage
-
main
public static void main(java.lang.String[] args)Test the Diagram code.- Parameters:
args
- String[]; the command line arguments (not used)
-
makeCheckBox
public static javax.swing.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
-