Position on Track

Position on Track is a graphical element that is used to define the exact position on the railway track.

To define the position on railway track

  1. Drag the Position on Track element from the Space Markup section of the Rail Library palette to the agent diagram.
  2. When moving the mouse over the agent diagram, you will see that only railway tracks are shown, other shapes and elements are temporarily hidden.
  3. Place the mouse over the railway track just where you want to place it and release the mouse button.
  4. You will see the element being put on the track.
  5. You can change its position on the track by dragging it with the mouse.

Properties

General

Name – The name of this position on track. The name is used to identify and access this element from code and flowchart blocks properties.

Ignore – If selected, the position on track is excluded from the model.

Visible on upper agent – If selected, the position on track is also visible on the upper agent where this agent lives.

Visible – Here you specify whether the shape is visible on animation at model runtime, or not. Using the control, choose yes or no.

Actions

On train enter – Here you can type Java code that will be executed when the first car of the train reaches the position on track.

On train exit – Here you can type Java code that will be executed when the last car of the train leaves the position on track.

Functions

Location

Function

Description

RailwayTrack getTrack()

Returns the railway track this element belongs to.

RailwayNetwork getRailYard()

Returns the railway network this element belongs to, or null if this element is not a part of a railway network.

double getOffset()

Returns the offset of this element from the start point of the railway track, measured in pixels.

double getOffset(LengthUnits units)

Returns the offset of this element from the start point of the railway track, measured in given length units.

Parameter:
units
- a constant defining the length units

double getX()

Returns the X-coordinate of this element.

double getY()

Returns the Y-coordinate of this element.

Level getLevel()

Returns the level where this position on track is located.


Visibility

Function

Description

boolean isVisible()

Returns true if this element is visible; returns false otherwise.

void setVisible(boolean v)

Sets the visibility of this element.

Parameter:
v - visibility. If v is true - this element is set to be visible, if it is false - not visible.


Appearance

Function

Description

Paint getColor()

Returns the color (or texture) of this element.

void setColor(Paint color)

Sets the color (or texture) of this element.

Parameter:
color - the color (or texture) of this element


Removal

Function

Description

void remove()

Removes this element from the presentation. If the element is not a part of presentation, the function does nothing. Note, that removal from the presentation does not necessarily mean removing from the model logic, since logical networks and routes may have been created before the removal and survive it.



Related topics

Railway track

Railway switch

Railway network

Rail Library

API reference: PositionOnTrack class