Element: Trace.

Icon:   

Text: A sequence of points.

Description: A Trace is a drawing element that displays a sequence of points at given coordinates of the parent drawing panel. The points to be displayed are added sequentially, one after the other, and can be visualized using markers or connecting them with segments (or both).


Two traces with no markers and connected

The trace can be instructed to display a maximum number of points, in which case, it will discard old values to accomodate new ones. However, if the property "No Repeat" is set to true, and the new value is identical to the last one, this new value will be ignored. The reception of data can also be (usually temporarily) disabled. Finally, the trace can be instructed to accept only one out of a certain number of points received. This is useful in case the model generates too many data points.

Traces can have memory. This means that they can remember and display data that was generated in a previous run of the simulation. This can be very useful to allow the user to compare diferent trajectories for different initial values of a system. The number of data sets a trace can display, the way it displays them and the color it uses are governed by the memory properties. Data in memory is respected by a call to _initialize(), but is lost by a call to _reset() or _resetView().

Traces respond to user interaction on their position coordinates (which can be different to the coordinates of the points received), changing their position and invoking up to three different actions. 

Table of properties

Name Description Values accepted
Input
X The X coordinate of the new point to add to the sequence. Any constant or variable of type double or int.
Y The Y coordinate of the new point to add to the sequence. Any constant or variable of type double or int.
Z The Z coordinate of the new point to add to the sequence. Any constant or variable of type double or int.
Position 
Position X The X coordinate of the element as a whole. Any constant or variable of type double or int.
Position Y The Y coordinate of the element as a whole. Any constant or variable of type double or int.
Position Z The Z coordinate of the element as a whole. Any constant or variable of type double or int.

Configuration

Points Maximum number of points to display. The special value 0 indicates that there is no such maximum. Any constant or variable of type int.
Skip The number of points to receive before accepting one. Any constant or variable of type int.
Active Whether the trace accepts points. A boolean variable or one of the constants true or false.
No Repeat Whether to ignore an input point identical to the last one. A boolean variable or one of the constants true or false.
Connected Whether to connect input points with a segment. A boolean variable or one of the constants true or false.

Visibility and Interaction

Visible The visibility of the element. A boolean variable or one of the constants true or false.
Enabled Whether the element responds to user interaction. A boolean variable or one of the constants true or false.

Actions

On Press The action to invoke when the element is pressed. The Java code to invoke for the action. 
On Drag The action to invoke when the element is moved. The Java code to invoke for the action. 
On Release The action to invoke when the element is released. The Java code to invoke for the action. 
On Enter The action to invoke when the pointer enters the element. The Java code to invoke for the action. 
On Exit The action to invoke when the pointer leaves the element. The Java code to invoke for the action. 
Graphical Aspect
Line Color The color used for the lines of the element. An Object variable of the class java.awt.Color or one of the predefined colors: black, blue, cyan, darkGray, gray, green, lightGray, magenta, orange, pink, red, white, yellow.

A color can also be specified providing its integer RGB coordinates (between 0 and 255), plus an optional transparency coordinate.

The default value is decided by the system.

Stroke The thickness for the lines of the element. Any constant or variable of type double or int. The default value is 1.

Object variables of the class  java.awt.Stroke are also accepted.

Marker Shape The graphical shape for the markers. One of the following constants:
  • NONE. A single dot is drawn. (Equivalent integer: 0)
  • ELLIPSE. (Equivalent integer: 1)
  • RECTANGLE. (Equivalent integer: 2)
  • ROUND_RECTANGLE. (Equivalent integer: 3)
  • WHEEL. An ellipse with its coordinate axes. (Equivalent integer: 4)

Integer constants and variables are also accepted, using any of the values indicated in the parentheses above. This allows changing the shape in run-time.

Marker Size The size of the markers in pixels. Any constant or variable of type int
Marker Color The color for the markers. See the values for the Line Color property.
Position The exact drawing position of the markers relative to the input point. One of the following constants:
  • CENTERED. The shape is drawn with its center point on the point's coordinates. (Equivalent integer: 0).
  • NORTH. The shape is drawn with its top middle point on the point's coordinates. (Equivalent integer: 1).
  • SOUTH. The shape is drawn with its bottom middle point on the point's coordinates.  (Equivalent integer: 2).
  • EAST. The shape is drawn with its middle right point on the point's coordinates. (Equivalent integer: 3).
  • WEST. The shape is drawn with its middle left point on the point's coordinates.(Equivalent integer: 4).
  • NORTH_EAST. The shape is drawn with its top right point on the point's coordinates. (Equivalent integer: 5).
  • NORTH_WEST. The shape is drawn with its top left point on the point's coordinates. (Equivalent integer: 6).
  • SOUTH_EAST. The shape is drawn with its bottom right point on the point's coordinates. (Equivalent integer: 7).
  • SOUTH_WEST. The shape is drawn with its bottom left point on the point's coordinates. (Equivalent integer: 8).

Integer constants and variables are also accepted, using any of the values indicated in the parentheses above. This allows changing the position in run-time.

Rotate The (counter-clockwise) rotation angle to apply to the markers. A constant or variable of type double for an angle in radians, or a constant or variable of type int for an angle in degrees.
Memory This is an integer that indicates how many data sets should the trace remember. 0 : It displays all data sets until a call to _resetView() is done.
1: It displays only the current data set (default).
2 or more: It displays as many data set as indicated. Subsequent runs cause the oldes data to be discarded.
Mem Display How old data is displayed. One of the following constants:
  • SHOW_ALL. Old data  is shown complete. (Equivalent integer: 0).
  • AS_ADDED. Old data  is shown at the same time the new data is added. (Equivalent integer: 1).
  • X_ORDER. All old points with an X coordinate smaller or equal to the X coordinate of the last new point is displayed. (Equivalent integer: 2).
  • Y_ORDER. Similar to X_ORDER.(Equivalent integer: 3).
  • Z_ORDER. Similar to X_ORDER.(Equivalent integer: 4).

Integer constants and variables are also accepted, using any of the values indicated in the parentheses above. This allows changing the display mode in run-time.

 

Mem Color The color used to display the old data. See the values for the Line Color property.