Maven artifactId: rinsim-ui

The user interface module provides a set of standard UI components which can be used for configuring a graphical user interface. By adding the View to the simulator as follows, the Simulator will, when start() is called, launch the UI instead of starting the simulation.

Simulator.builder()
         .addModel(
           View.builder()
               .with(..) // add renderers 
         )

The View class provides a basic view that takes over the control of the simulator but it doesn’t render anything itself. The UI is modularized using the notion of a Renderer. A Renderer renders (i.e. draws) on the screen. The View defines a canvas on which can be drawn, and UI components can be placed around the canvas. To facilitate this distinction, there are two types of renderers:

  • CanvasRenderer, allows to draw on the canvas.
  • PanelRenderer, allows to define a panel that is placed alongside the canvas, can be used to show additional information, buttons, etc.

Since Renderers are also Models, dependencies can be requested similarly to regular models.

Available renderers

Renderer What is rendered Example usage
AGVRenderer Renders vehicles as AGVs. AGV example
CommRenderer Draws CommDevices as dots, with a circle to indicate max range. Communication example
GraphRoadModelRenderer Draws the graph as black lines. Taxi example
PDPModelRenderer Renders the different PDP objects. Gradient field example
PlaneRoadModelRenderer Draws the plane as a white square. Simple example
RoadUserRenderer Allows to customize visualization of each RoadUser. Simple example
WarehouseRenderer Advanced graph visualization that draws a corridor for each connection. AGV example

Additional renderers and panels are defined in the PDPTW module.

Each of these renderers can be added using their respective builder. Many of them also have several options for changing the visualization, the best way to explore all options is to use the auto-complete feature of your favorite IDE. For example, Eclipse shows this:

RinSim ticks

Auto-complete options as shown by Eclipse for WarehouseRenderer.

Shortcuts

The menu defines some shortcuts, for example for play/pause of the simulator (CTRL-P/CMD-P). If a French keyboard layout is detected, different short cuts are used. However, if the detection does not work, or if you want to customize the shortcuts, you can use the following code:

View.builder()
  .withAccelerators(MenuItems.AZERTY_ACCELERATORS)