Class ElementTrail
java.lang.Object
org.opensourcephysics.display3d.simple3d.Element
org.opensourcephysics.display3d.simple3d.ElementTrail
- All Implemented Interfaces:
Data,Element,ElementTrail,InteractionSource
Title: ElementSegment
Description: A Segment using the painter's algorithm
- Version:
- March 2005
- Author:
- Francisco Esquembre
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected ArrayList<org.opensourcephysics.display3d.simple3d.ElementTrail.TrailPoint>Fields inherited from class org.opensourcephysics.display3d.simple3d.Element
targetPosition, targetSizeFields inherited from interface org.opensourcephysics.display3d.core.Element
TARGET_POSITION, TARGET_SIZE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPoint(double[] point) Adds a new double[] point to the trail.voidaddPoint(double x, double y, double z) Adds a new (x,y,z) point to the trail.voidclear()Clears all points from the trail.String[]The column names to be used in the data display tooldouble[][]Gets a 2D array of data.double[][][]Gets a 3D array of data.Some Data objects (e.g., a Group) do not contain data, but a list of Data objects which do.Gets a list of OSP Datasets.voidgetExtrema(double[] min, double[] max) Color[]Fill color to use for this dataintgetID()Returns a unique identifier for this DataColor[]Line color to use for this datastatic XML.ObjectLoaderReturns an XML.ObjectLoader to save and load object data.intReturns the maximum number of points allowed for the trailintbooleanGets the connected flag.voidmoveToPoint(double x, double y, double z) Starts a new (x,y,z) trail segment by moving to a new point without drawing.voidsetConnected(boolean connected) Sets the connected flag.voidsetGhostPoint(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.voidsetID(int id) Sets the ID number of this DatavoidsetMaximumPoints(int maximum) Sets the maximum number of points for the trail.voidSets the label of the X coordinate when the data is displayed in a tablevoidSets the label of the Y coordinate when the data is displayed in a tablevoidSets the label of the Z coordinate when the data is displayed in a tableMethods inherited from class org.opensourcephysics.display3d.simple3d.Element
addInteractionListener, getAxesMode, getDrawingPanel3D, getHotSpotBodyCoordinates, getInteractionTarget, getName, getSizeX, getSizeY, getSizeZ, getStyle, getTargetHit, getTransformation, getX, getY, getZ, isReallyVisible, isVisible, loadUnmutableObjects, removeInteractionListener, setName, setSizeX, setSizeXYZ, setSizeXYZ, setSizeY, setSizeZ, setTransformation, setVisible, setX, setXYZ, setXYZ, setY, setZ, toBodyFrame, toSpaceFrameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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, toSpaceFrameMethods inherited from interface org.opensourcephysics.display3d.core.interaction.InteractionSource
addInteractionListener, getInteractionTarget, removeInteractionListener
-
Field Details
-
list
-
datasetID
protected int datasetID
-
-
Constructor Details
-
ElementTrail
public ElementTrail()
-
-
Method Details
-
addPoint
public void addPoint(double x, double y, double z) Description copied from interface:ElementTrailAdds a new (x,y,z) point to the trail.- Specified by:
addPointin interfaceElementTrail- Parameters:
x- doubley- doublez- double
-
addPoint
public void addPoint(double[] point) Description copied from interface:ElementTrailAdds a new double[] point to the trail.- Specified by:
addPointin interfaceElementTrail- 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
public void moveToPoint(double x, double y, double z) Description copied from interface:ElementTrailStarts 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.)- Specified by:
moveToPointin interfaceElementTrail- Parameters:
x- doubley- doublez- double
-
setMaximumPoints
public void setMaximumPoints(int maximum) Description copied from interface:ElementTrailSets 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.- Specified by:
setMaximumPointsin interfaceElementTrail- Parameters:
maximum- int
-
getMaximumPoints
public int getMaximumPoints()Description copied from interface:ElementTrailReturns the maximum number of points allowed for the trail- Specified by:
getMaximumPointsin interfaceElementTrail- Returns:
- int
-
setConnected
public void setConnected(boolean connected) Description copied from interface:ElementTrailSets 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.- Specified by:
setConnectedin interfaceElementTrail- Parameters:
connected- boolean
-
isConnected
public boolean isConnected()Description copied from interface:ElementTrailGets the connected flag.- Specified by:
isConnectedin interfaceElementTrail- See Also:
-
clear
public void clear()Description copied from interface:ElementTrailClears all points from the trail.- Specified by:
clearin interfaceElementTrail
-
setXLabel
Description copied from interface:ElementTrailSets the label of the X coordinate when the data is displayed in a table- Specified by:
setXLabelin interfaceElementTrail
-
setYLabel
Description copied from interface:ElementTrailSets the label of the Y coordinate when the data is displayed in a table- Specified by:
setYLabelin interfaceElementTrail
-
setZLabel
Description copied from interface:ElementTrailSets the label of the Z coordinate when the data is displayed in a table- Specified by:
setZLabelin interfaceElementTrail
-
getNumberOfPoints
public int getNumberOfPoints() -
setGhostPoint
public void setGhostPoint(double[] _point, boolean _connected) Description copied from interface:ElementTrailSets 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.- Specified by:
setGhostPointin interfaceElementTrail- 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
-
getExtrema
public void getExtrema(double[] min, double[] max) -
setID
public void setID(int id) Description copied from interface:DataSets the ID number of this Data -
getID
public int getID()Description copied from interface:DataReturns a unique identifier for this Data -
getData2D
public double[][] getData2D()Description copied from interface:DataGets 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. -
getData3D
public double[][][] getData3D()Description copied from interface:DataGets a 3D array of data. May return null if data not yet generated or object does not support 3D data. -
getColumnNames
Description copied from interface:DataThe column names to be used in the data display tool- Specified by:
getColumnNamesin interfaceData- Returns:
- an array of names
-
getLineColors
Description copied from interface:DataLine color to use for this data- Specified by:
getLineColorsin interfaceData- Returns:
- a color
-
getFillColors
Description copied from interface:DataFill color to use for this data- Specified by:
getFillColorsin interfaceData- Returns:
- a color
-
getDataList
Description copied from interface:DataSome 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:
getDataListin interfaceData- Returns:
- a list of Data objects, or null if this object contains data
-
getDatasets
Description copied from interface:DataGets a list of OSP Datasets. May return null if data not yet generated or object does not support Datasets.- Specified by:
getDatasetsin interfaceData- Returns:
- list of Datasets
-
getLoader
Returns an XML.ObjectLoader to save and load object data.- Returns:
- the XML.ObjectLoader
-