org.opensourcephysics.drawing3d
Class MultiTrail

java.lang.Object
  extended by org.opensourcephysics.drawing3d.Element
      extended by org.opensourcephysics.drawing3d.Group
          extended by org.opensourcephysics.drawing3d.MultiTrail
All Implemented Interfaces:
Data, InteractionSource

public class MultiTrail
extends Group

Title: MultiTrail

Description: MultiTrail is a class that uses a group of ElementTrails to create a more sophisticated trail with segments

Version:
August 2009
Author:
Francisco Esquembre, Carlos Jara Bravo (CJB)

Field Summary
 
Fields inherited from class org.opensourcephysics.drawing3d.Element
CHANGE_COLOR, CHANGE_GROUP, CHANGE_INTERACTION_POINTS, CHANGE_NONE, CHANGE_POSITION, CHANGE_POSITION_AND_SIZE, CHANGE_PROJECTION, CHANGE_RESOLUTION, CHANGE_SHAPE, CHANGE_SIZE, CHANGE_TRANSFORMATION, CHANGE_VISIBILITY, STD_CENTERED_END, STD_CENTERED_ORIGIN, STD_END, STD_ORIGIN, TARGET_POSITION, TARGET_SIZE, TO_RADIANS, X_UNIT_VECTOR, Y_UNIT_VECTOR, Z_UNIT_VECTOR
 
Constructor Summary
MultiTrail()
           
 
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 point to the trail.
 void addPoints(double[][] input)
          Adds an array of new double[] points to the trail.
 void addPoints(double[] xInput, double[] yInput, double[] zInput)
          Adds an array of points to the trail.
 void clear()
          Clears all points from all segments of the trail.
 int getConnectionType()
          Gets the connection type.
 int getMaximumPoints()
          Returns the maximum number of points allowed for the trail
 int getSkipPoints()
          Returns the skip parameter of the trail.
 Style getStyle()
          Gets the style of the element.
 void initialize()
          Clears all points from the last segment of the trail, respecting previous segments.
 boolean isActive()
          Whether the trail is in active mode.
 boolean isClearAtInput()
          Whether the trail is in clear at input mode.
 boolean isNoRepeat()
          Whether the trail is in no repeat mode.
 void moveToPoint(double[] point)
          Moves to the new point without drawing.
 void moveToPoint(double x, double y, double z)
          Moves to the new point without drawing.
 void newSegment()
          Creates a new segment of the trail.
 void setActive(boolean _active)
          Set/unset the active state of the trail.
 void setClearAtInput(boolean _clear)
          Sets the trail to clear existing points when receiving a new point or array of points.
 void setConnectionType(int type)
          Sets the type of connection for the next point.
 void setMaximumPoints(int maximum)
          Sets the maximum number of points for the trail.
 void setNoRepeat(boolean _noRepeat)
          Sets the no repeat state of the trail.
 void setSkipPoints(int _skip)
          Sets the skip parameter.
 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 class org.opensourcephysics.drawing3d.Group
addElement, addElementAtIndex, addElements, getCanBeMeasured, getColumnNames, getData2D, getData3D, getDataList, getDatasets, getDiagonalSize, getElement, getElements, getExtrema, getFillColors, getID, getInteractedIndex, getLineColors, getNumberOfElements, getTargetHit, hasChanged, processChanges, removeAllElements, removeElement, removePanel, setID, setPanel
 
Methods inherited from class org.opensourcephysics.drawing3d.Element
addChange, addInteractionListener, addSecondaryTransformation, addSecondaryTransformation, addSecondaryTransformations, getDataObject, getGroup, getHotSpot, getImplementingObject, getInteractionTarget, getName, getPanel, getPosition, getPreviousImplementingObject, getScaledPosition, getScaledSize, getSecondaryTransformations, getSize, getSizeX, getSizeY, getSizeZ, getTransformation, getX, getY, getZ, isEnabled, isVisible, removeAllSecondaryTransformations, removeInteractionListener, removeSecondaryTransformation, setCanBeMeasured, setDataObject, setEnabled, setName, setPosition, setSize, setSizeX, setSizeXYZ, setSizeY, setSizeZ, setTransformation, setVisible, setX, setXYZ, setY, setZ, sizeAndToSpaceFrame, styleChanged, toBodyFrame, toSpaceFrame
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensourcephysics.display.Data
getName
 

Constructor Detail

MultiTrail

public MultiTrail()
Method Detail

getStyle

public Style getStyle()
Description copied from class: Element
Gets the style of the element. The style object can not be changed. But it can be customized.

Overrides:
getStyle in class Element
Returns:
Style
See Also:
Style

setActive

public void setActive(boolean _active)
Set/unset the active state of the trail. The trail does not use this state, but just keeps an internal value that programs can consult in order not to add data to the trail. In other words, a trail will always honor an addPoint() command. But programs can consult this internal value to decide whether or not to send data to a trail. Default value is true.

Parameters:
_active -

isActive

public boolean isActive()
Whether the trail is in active mode.

Returns:
boolean

setNoRepeat

public void setNoRepeat(boolean _noRepeat)
Sets the no repeat state of the trail. When set, a trail will ignore (x,y) points which equal the last added point.

Parameters:
_noRepeat -

isNoRepeat

public boolean isNoRepeat()
Whether the trail is in no repeat mode. Default value is false.

Returns:
boolean

setClearAtInput

public void setClearAtInput(boolean _clear)
Sets the trail to clear existing points when receiving a new point or array of points.

Parameters:
_clear -

isClearAtInput

public boolean isClearAtInput()
Whether the trail is in clear at input mode.

Returns:
boolean

setSkipPoints

public void setSkipPoints(int _skip)
Sets the skip parameter. When the skip parameter is larger than zero, the trail only considers one of every 'skip' points. That is, if skip is 3, the trail will consider only every third point sent to it. The default is zero, meaning all points must be considered.

Parameters:
_skip -

getSkipPoints

public int getSkipPoints()
Returns the skip parameter of the trail.

Returns:
int

setXLabel

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

Parameters:
_label -

setYLabel

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

Parameters:
_label -

setZLabel

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

Parameters:
_label -

addPoint

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

Parameters:
x - double The X coordinate of the point.
y - double The Y coordinate of the point.

addPoint

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

Parameters:
point - double[] The double[2] array with the coordinates of the point.

moveToPoint

public void moveToPoint(double x,
                        double y,
                        double z)
Moves to the new point without drawing.

Parameters:
x - double The X coordinate of the point.
y - double The Y coordinate of the point.

moveToPoint

public void moveToPoint(double[] point)
Moves to the new point without drawing. (Equivalent to setting the connection type to NO_CONNECTION and adding one single point, then setting the type back to its previous value.)

Parameters:
point - double[] The double[2] array with the coordinates of the point.

addPoints

public void addPoints(double[][] input)
Adds an array of new double[] points to the trail.

Parameters:
input - double[][] The double[nPoints][2] array with the coordinates of the points.

addPoints

public void addPoints(double[] xInput,
                      double[] yInput,
                      double[] zInput)
Adds an array of points to the trail.

Parameters:
xInput - double The double[] array with the X coordinates of the points.
yInput - double The double[] array with the Y coordinates of the points.

setMaximumPoints

public 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

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

Returns:
int

setConnectionType

public void setConnectionType(int type)
Sets the type of connection for the next point.

Parameters:
type - int

getConnectionType

public int getConnectionType()
Gets the connection type.

See Also:
setConnectionType(int)

clear

public void clear()
Clears all points from all segments of the trail.

Overrides:
clear in class Group

initialize

public void initialize()
Clears all points from the last segment of the trail, respecting previous segments.

Overrides:
initialize in class Group

newSegment

public void newSegment()
Creates a new segment of the trail.