org.opensourcephysics.drawing3d
Class ElementTrail

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

public class ElementTrail
extends Element
implements Data

Title: ElementTrail

Description: A single (and simple) trail of 3D points

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

Nested Class Summary
static class ElementTrail.TrailPoint
           
 
Field Summary
static int LINE_CONNECTION
          The next point will be connected to the previous one by a segment
static int NO_CONNECTION
          The next point will not be connected to the previous one
 
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
ElementTrail()
           
 
Method Summary
 void addPoint(double[] _point)
           
 void addPoint(double _x, double _y, double _z)
           
 void addPoint(double _x, double _y, double _z, int _type)
          Adds a new point to the trace
 void addPoint(ElementTrail.TrailPoint trailPoint)
           
 void clear()
          Clears all points from the trail.
 void closeTrail(int _type)
          Closes the trail by adding the ghost point, if not null
 java.lang.String[] getColumnNames()
          The column names to be used in the data display tool
 double[] getData1D()
           
 double[][] getData2D()
          Gets a 2D array of data.
 double[][][] getData3D()
          Gets a 3D array of data.
 java.util.List<Data> getDataList()
          Some Data objects (e.g., a Group) do not contain data, but a list of Data objects which do.
 java.util.ArrayList<Dataset> getDatasets()
          Gets a list of OSP Datasets.
 java.util.List<ElementTrail.TrailPoint> getDisplayPoints()
          Returns the actual display points, including the ghost point, if any.
 void getExtrema(double[] min, double[] max)
          Returns the extreme points of a box that contains the element.
 java.awt.Color[] getFillColors()
          Fill color to use for this data
 int getID()
          Returns a unique identifier for this Data
 java.awt.Color[] getLineColors()
          Line color to use for this data
 int getMaximum()
           
 void processChanges(int _cummulativeChange)
          Process all the changes (usually prior to use them) Usually, visible elements will be asked to process changes
 void setGhostPoint(ElementTrail.TrailPoint _point)
          Sets a temporary point used only for display, but that is not meant to stay in the trail
 void setID(int id)
          Sets the ID number of this Data
 void setLabels(java.lang.String[] _labels)
           
 void setMaximumPoints(int maximum)
          Sets the maximum number of points for the trail.
 void setXLabel(java.lang.String _label)
           
 void setYLabel(java.lang.String _label)
           
 void setZLabel(java.lang.String _label)
           
 
Methods inherited from class org.opensourcephysics.drawing3d.Element
addChange, addInteractionListener, addSecondaryTransformation, addSecondaryTransformation, addSecondaryTransformations, getCanBeMeasured, getDataObject, getDiagonalSize, getGroup, getHotSpot, getImplementingObject, getInteractionTarget, getName, getPanel, getPosition, getPreviousImplementingObject, getScaledPosition, getScaledSize, getSecondaryTransformations, getSize, getSizeX, getSizeY, getSizeZ, getStyle, getTransformation, getX, getY, getZ, hasChanged, isEnabled, isVisible, removeAllSecondaryTransformations, removeInteractionListener, removePanel, removeSecondaryTransformation, setCanBeMeasured, setDataObject, setEnabled, setName, setPanel, 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
 

Field Detail

NO_CONNECTION

public static final int NO_CONNECTION
The next point will not be connected to the previous one

See Also:
Constant Field Values

LINE_CONNECTION

public static final int LINE_CONNECTION
The next point will be connected to the previous one by a segment

See Also:
Constant Field Values
Constructor Detail

ElementTrail

public ElementTrail()
Method Detail

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

clear

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


setLabels

public void setLabels(java.lang.String[] _labels)

setXLabel

public void setXLabel(java.lang.String _label)

setYLabel

public void setYLabel(java.lang.String _label)

setZLabel

public void setZLabel(java.lang.String _label)

addPoint

public void addPoint(double _x,
                     double _y,
                     double _z,
                     int _type)
Adds a new point to the trace

Parameters:
_x - double The X coordinate of the new point
_y - double The Y coordinate of the new point
_z - double The Z coordinate of the new point
_type - int The type of connection. One of:
  • LINE_CONNECTION : for a connected trail point
  • NO_CONNECTION : for a disconected trail point

addPoint

public void addPoint(double _x,
                     double _y,
                     double _z)

addPoint

public void addPoint(double[] _point)

addPoint

public void addPoint(ElementTrail.TrailPoint trailPoint)

setGhostPoint

public void setGhostPoint(ElementTrail.TrailPoint _point)
Sets a temporary point used only for display, but that is not meant to stay in the trail

Parameters:
_point -

closeTrail

public void closeTrail(int _type)
Closes the trail by adding the ghost point, if not null


processChanges

public void processChanges(int _cummulativeChange)
Description copied from class: Element
Process all the changes (usually prior to use them) Usually, visible elements will be asked to process changes

Overrides:
processChanges in class Element
Parameters:
_cummulativeChange - int the cummulativeChange produced by changes in parent groups

getExtrema

public void getExtrema(double[] min,
                       double[] max)
Description copied from class: Element
Returns the extreme points of a box that contains the element.

Parameters:
min - double[] A previously allocated double[3] array that will hold the minimum point
max - double[] A previously allocated double[3] array that will hold the maximum point

getDisplayPoints

public java.util.List<ElementTrail.TrailPoint> getDisplayPoints()
Returns the actual display points, including the ghost point, if any.

Returns:
java.util.List

setID

public void setID(int id)
Description copied from interface: Data
Sets the ID number of this Data

Specified by:
setID in interface Data
Parameters:
id - the ID number

getID

public int getID()
Description copied from interface: Data
Returns a unique identifier for this Data

Specified by:
getID in interface Data
Returns:
the ID number

getData2D

public double[][] getData2D()
Description copied from interface: Data
Gets a 2D array of data. The first column, double[0][] often contains x-values; Remaining columns often contain y values. May return null if data not yet generated or object does not support 2D data.

Specified by:
getData2D in interface Data
Returns:
double[][]

getData1D

public double[] getData1D()

getData3D

public double[][][] getData3D()
Description copied from interface: Data
Gets a 3D array of data. May return null if data not yet generated or object does not support 3D data.

Specified by:
getData3D in interface Data
Returns:
double[][][]

getColumnNames

public java.lang.String[] getColumnNames()
Description copied from interface: Data
The column names to be used in the data display tool

Specified by:
getColumnNames in interface Data
Returns:
an array of names

getLineColors

public java.awt.Color[] getLineColors()
Description copied from interface: Data
Line color to use for this data

Specified by:
getLineColors in interface Data
Returns:
a color

getFillColors

public java.awt.Color[] getFillColors()
Description copied from interface: Data
Fill color to use for this data

Specified by:
getFillColors in interface Data
Returns:
a color

getDataList

public java.util.List<Data> getDataList()
Description copied from interface: Data
Some Data objects (e.g., a Group) do not contain data, but a list of Data objects which do. This method is used by Data displaying tools to create as many pages as needed.

Specified by:
getDataList in interface Data
Returns:
a list of Data objects, or null if this object contains data

getDatasets

public java.util.ArrayList<Dataset> getDatasets()
Description copied from interface: Data
Gets a list of OSP Datasets. May return null if data not yet generated or object does not support Datasets.

Specified by:
getDatasets in interface Data
Returns:
list of Datasets

getMaximum

public int getMaximum()