org.opensourcephysics.display3d.core
Interface ElementTrail

All Superinterfaces:
Data, Element, InteractionSource
All Known Implementing Classes:
ElementTrail

public interface ElementTrail
extends Element, Data

Title: ElementTrail

Description:

A trail of 3D pixels on the screen.

This object is often used to show the path of a moving object.

Version:
March 2005
Author:
Francisco Esquembre

Nested Class Summary
static class ElementTrail.Loader
           
 
Field Summary
 
Fields inherited from interface org.opensourcephysics.display3d.core.Element
TARGET_POSITION, TARGET_SIZE
 
Method Summary
 void addPoint(double[] point)
          Adds a new double[] point to the trail.
 void addPoint(double x, double y, double z)
          Adds a new (x,y,z) point to the trail.
 void clear()
          Clears all points from the trail.
 int getMaximumPoints()
          Returns the maximum number of points allowed for the trail
 boolean isConnected()
          Gets the connected flag.
 void moveToPoint(double x, double y, double z)
          Starts a new (x,y,z) trail segment by moving to a new point without drawing.
 void setConnected(boolean connected)
          Sets the connected flag.
 void setGhostPoint(double[] point, boolean connected)
          Sets a temporary point that is displayed as the last point of the trail but is not meant to be a permanent part of the trail.
 void setMaximumPoints(int maximum)
          Sets the maximum number of points for the trail.
 void setXLabel(java.lang.String _label)
          Sets the label of the X coordinate when the data is displayed in a table
 void setYLabel(java.lang.String _label)
          Sets the label of the Y coordinate when the data is displayed in a table
 void setZLabel(java.lang.String _label)
          Sets the label of the Z coordinate when the data is displayed in a table
 
Methods inherited from interface org.opensourcephysics.display3d.core.Element
getDrawingPanel3D, getName, getSizeX, getSizeY, getSizeZ, getStyle, getTransformation, getX, getY, getZ, isVisible, loadUnmutableObjects, setName, setSizeX, setSizeXYZ, setSizeXYZ, setSizeY, setSizeZ, setTransformation, setVisible, setX, setXYZ, setXYZ, setY, setZ, toBodyFrame, toSpaceFrame
 
Methods inherited from interface org.opensourcephysics.display3d.core.interaction.InteractionSource
addInteractionListener, getInteractionTarget, removeInteractionListener
 
Methods inherited from interface org.opensourcephysics.display.Data
getColumnNames, getData2D, getData3D, getDataList, getDatasets, getFillColors, getID, getLineColors, getName, setID
 

Method Detail

addPoint

void addPoint(double x,
              double y,
              double z)
Adds a new (x,y,z) point to the trail.

Parameters:
x - double
y - double
z - double

addPoint

void addPoint(double[] point)
Adds a new double[] point to the trail.

Parameters:
point - double[] The array with the coordinates of the point. If the length of the array is 2, the coordinates are asumed to be X and Y (Z=0). If it is 3, then X, Y, and Z (as usual).

moveToPoint

void moveToPoint(double x,
                 double y,
                 double z)
Starts a new (x,y,z) trail segment by moving to a new point without drawing. (Equivalent to setting the connected flag to false and adding one singlepoint, then setting the flag back to true.)

Parameters:
x - double
y - double
z - double

setMaximumPoints

void setMaximumPoints(int maximum)
Sets the maximum number of points for the trail. Once the maximum is reached, adding a new point will cause remotion of the first one. This is useful to keep trails down to a reasonable size, since very long trails can slow down the rendering (in certain implementations). If the value is 0 (the default) the trail grows forever without discarding old points.

Parameters:
maximum - int

getMaximumPoints

int getMaximumPoints()
Returns the maximum number of points allowed for the trail

Returns:
int

setConnected

void setConnected(boolean connected)
Sets the connected flag. Successive points are connected by a segment if this flag is true. Each point is marked as a colored pixel if the trail is not connected. Setting it temporarily to false helps create discontinuous trails.

Parameters:
connected - boolean

isConnected

boolean isConnected()
Gets the connected flag.

See Also:
setConnected(boolean)

clear

void clear()
Clears all points from the trail.


setXLabel

void setXLabel(java.lang.String _label)
Sets the label of the X coordinate when the data is displayed in a table

Parameters:
_label -

setYLabel

void setYLabel(java.lang.String _label)
Sets the label of the Y coordinate when the data is displayed in a table

Parameters:
_label -

setZLabel

void setZLabel(java.lang.String _label)
Sets the label of the Z coordinate when the data is displayed in a table

Parameters:
_label -

setGhostPoint

void setGhostPoint(double[] point,
                   boolean connected)
Sets a temporary point that is displayed as the last point of the trail but is not meant to be a permanent part of the trail. The point can be changed at will and even removed (by passing a null array as point), but if not null, it is always drawn following the last effective point of the trail. This is used by MultiTrail to implement the skip parameter.

Parameters:
point - the double[3] data with the point. null if there is no such point
connected - whether this point is connected to the previous one