Class 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-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 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
      • 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 number
        initialState - boolean; if true; the check box will be checked
        Returns:
        JCheckBox