...
- When the track is unpowered and clicked, the track will be powered to move in travel direction (120)
- When the track is clicked again, the power is changed to be against the main travel direction (-120)
- The third click will unpower the track (0).
...
An SVG file has been created, in which the elements that are animated have a unique Id. The Model Railway Track Layout svg SVG has been choosen for this task, because it shows a more detailed view of the railway, in contrast to the Model Railway Track Scheme.
...
File | Description | References |
---|---|---|
EnvironmentVisualization.ftl | The top level template for the environment visualization. Has animations for the trains, based on their exact position from the environment (track, branch, pos). | BasicVisualization.ftl |
ControllerVisualization.ftl | The top level template for the controller visualization. Has animations for the trains, based on the track position, that is assumed by the controller. | BasicVisualization.ftl |
BasicVisualization.ftl | Has animations and interactions that can be used by both, the environment and controller. Furthermore the power of the tracks is animated and can be changed with a click on the corresponding track. | Constants.ftl Util.ftl |
Constants.ftl | Defines railway constants, mostely mostly taken from the wagon.sctx Furthermore the file contains classification of the tracks, to calculate with these. For instance, there are lists with all tracks, only with tracks that have branches, or which branches belong to which tracks. | |
Util.ftl | Simple utility macros and functions. |
Constants.ftl
This file contains constant assignmets to various variables such that they can be used in other templates.
...
What follows is the animation for the red, yellow and green circles of the signal. The naming scheme of the SVG file has to be considered, to animate the correct element (see Model Railway Layout SVG).
The array with the states of all signals is calld signals and is two dimensional (see Interface). The first dimension is for the track, the second is for the direction (0: first in main travel direction, 1: second in main travel direction). Thus ${track?eval} will evaluate the name of the current track (e.g. KH_LN_7) to find an associated value. As all track constants are defined in Constants.ftl, this statement will result in the index of the track that the current iteration is for.
...