This package implements the utility classes commonly used by the traffic 3D visualizer. It consists of the “TrafficCursorType” and “TrafficInputMode” classes.
1. Implementing the “TrafficCursorType” class
The “TrafficCursorType” class describes the types of mouse cursors used in the 3D traffic visualizer. To implement this class:
-
- Inside the package “edu.utdallas.mavs.traffic.visualization.vis3D.common”, create a class named “TrafficCursorType” that extends the class “CursorType” defined in the package “edu.utdallas.mavs.divas.visualization.vis3D.common”.
- In this example, we use the full set of mouse cursor types provided by DIVAs.
- The following code provides the full implementation of this class:
package edu.utdallas.mavs.traffic.visualization.vis3D.common; import edu.utdallas.mavs.divas.visualization.vis3D.common.CursorType; /** * The specifying type of the mouse cursor. */ public class TrafficCursorType { /** * Bomb cursor, depicted by a black bomb */ public static final CursorType BOMB = CursorType.create("BOMB"); /** * Smoke bomb cursor, depicted by a gray bomb */ public static final CursorType SMOKE_BOMB = CursorType.create("SMOKE_BOMB"); /** * Treasure cursor, depicted by a treasure coffin */ public static final CursorType TREASURE = CursorType.create("TREASURE"); /** * Fireworks cursor */ public static final CursorType FIREWORKS = CursorType.create("FIREWORKS"); /** * Drums cursor */ public static final CursorType DRUMS = CursorType.create("DRUMS"); /** * Grill cursor */ public static final CursorType GRILL = CursorType.create("GRILL"); /** * Spotlight cursor */ public static final CursorType SPOTLIGHT = CursorType.create("SPOTLIGHT"); }
2. Implementing the “TrafficInputMode” class
The “TrafficInputMode” class specifies the type of events that can be triggered by the user of the simulation by interacting with the simulation using the 3D visualizer. To implement this class:
- Inside the package “edu.utdallas.mavs.traffic.visualization.vis3D.common”, create a class named “TrafficInputMode”.
- In this example, we create an “InputMode” for each environment event type.
The following code provides the full implementation of this class:
package edu.utdallas.mavs.traffic.visualization.vis3D.common; import edu.utdallas.mavs.divas.visualization.vis3D.common.InputMode; public class TrafficInputMode { public static final InputMode ADD_EXPLOSION = InputMode.create("Add Smoke Explosion"); /** * Adds fireworks to the location pointed by the user upon a mouse left-button click. */ public static final InputMode ADD_FIREWORKS = InputMode.create("Add Fireworks"); /** * Adds an explosion without smoke to the location pointed by the user upon a mouse left-button click. */ public static final InputMode ADD_EXPLOSION_NO_SMOKE = InputMode.create("Add Explosion"); /** * Adds a treasure to the location pointed by the user upon a mouse left-button click. */ public static final InputMode ADD_TREASURE = InputMode.create("Add Treasure"); /** * Adds a grill to the location pointed by the user upon a mouse left-button click. */ public static final InputMode ADD_GRILL = InputMode.create("Add Grill"); /** * Adds drums to the location pointed by the user upon a mouse left-button click. */ public static final InputMode ADD_DRUMS = InputMode.create("Add Drums"); /** * Adds a spotlight to the location pointed by the user upon a mouse left-button click. */ public static final InputMode ADD_SPOTLIGHT = InputMode.create("Add Spotlight"); }