org.opensourcephysics.displayejs
Class InteractiveTrace

java.lang.Object
  extended by org.opensourcephysics.displayejs.AbstractInteractiveElement
      extended by org.opensourcephysics.displayejs.InteractiveTrace
All Implemented Interfaces:
Data, Drawable, Interactive, LogMeasurable, Measurable, Drawable3D, HasDataObjectInterface, InteractionSource, InteractiveElement, Measurable3D

public class InteractiveTrace
extends AbstractInteractiveElement
implements Data, LogMeasurable


Field Summary
static int AREA
           
static int BAR
           
static int ORDER_OF_APPEARANCE
           
static int POST
           
static int SHOW_ALL
           
static int X_COORDINATE
           
static int Y_COORDINATE
           
static int Z_COORDINATE
           
 
Fields inherited from class org.opensourcephysics.displayejs.AbstractInteractiveElement
SENSIBILITY
 
Fields inherited from interface org.opensourcephysics.displayejs.InteractiveElement
TARGET_POSITION, TARGET_SIZE
 
Constructor Summary
InteractiveTrace()
          Default constructor
 
Method Summary
 void addPoint(double xInput, double yInput)
           
 void addPoint(double xInput, double yInput, double zInput)
           
 void addPoints(double[] xInput, double[] yInput)
           
 void addPoints(double[] xInput, double[] yInput, double[] zInput)
           
 void clear()
           
 void copyFrom(InteractiveElement _element)
           
 void draw(DrawingPanel3D _panel, java.awt.Graphics2D _g, int _index)
          Draws a given Object3D (indicated by its index).
 void draw(DrawingPanel _panel, java.awt.Graphics _g)
          Draws a representation of an object in a drawing panel.
 Interactive findInteractive(DrawingPanel _panel, int _xpix, int _ypix)
           
 java.lang.String[] getColumnNames()
          The column names to be used in the data display tool
 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.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 getMaximumPoints()
           
 java.awt.Color getMemoryColor()
           
 int getMemoryDrivenBy()
           
 int getMemorySets()
           
 java.lang.String getName()
          The name of the data
 Object3D[] getObjects3D(DrawingPanel3D _panel)
          Returns an array of Objects3D to (sort according to its distance and) draw.
 int getSkip()
           
 double getXMax()
          Gets the maximum x needed to draw this object.
 double getXMaxLogscale()
          Gets the maximum x needed to draw this object on a log scale.
 double getXMin()
          Gets the minimum x needed to draw this object.
 double getXMinLogscale()
          Gets the minimum x needed to draw this object on a log scale.
 double getYMax()
          Gets the maximum y needed to draw this object.
 double getYMaxLogscale()
          Gets the maximum y needed to draw this object on a log scale on a log scale.
 double getYMin()
          Gets the minimum y needed to draw this object.
 double getYMinLogscale()
          Gets the minimum y needed to draw this object on a log scale.
 double getZMax()
          Gets the maximum z needed to draw this object.
 double getZMin()
          Gets the minimum z needed to draw this object.
 void initialize()
           
 void initializeMemberOfSet()
          Special initialization when used as a memeber of a Set
 boolean isActive()
           
 boolean isClearAtInput()
           
 boolean isConnected()
           
 boolean isIgnoreEqualPoints()
           
 boolean isMeasured()
          Determines if information is available to set min/max values.
 void moveToPoint(double xInput, double yInput)
           
 void moveToPoint(double xInput, double yInput, double zInput)
           
 void setActive(boolean acceptInput)
           
 void setAllowTable(boolean _allow)
           
 void setClearAtInput(boolean _clear)
           
 void setConnected(boolean connect)
           
 void setID(int id)
          Sets the ID number of this Data.
 void setIgnoreEqualPoints(boolean ignoreEqual)
           
 void setMaximumPoints(int _n)
           
 void setMemoryColor(java.awt.Color _color)
           
 void setMemoryDrivenBy(int driving)
           
 void setMemorySets(int howMany)
           
 void setName(java.lang.String _name)
           
 void setShapeSize(int _size)
          Set the size of the marker
 void setShapeType(int _type)
          Set the type of the marker
 void setSkip(int howMany)
           
 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.displayejs.AbstractInteractiveElement
addListener, canBeMeasured, drawQuickly, getControl, getDataObject, getGroup, getResolution, getSensitivity, getSet, getSetIndex, getSizeX, getSizeY, getSizeZ, getStyle, getX, getY, getZ, invokeActions, isEnabled, isEnabled, isGroupEnabled, isGroupEnabled, isVisible, needsToProject, removeAllListeners, removeListener, setControl, setDataObject, setEnabled, setEnabled, setGroup, setGroupEnabled, setGroupEnabled, setResolution, setSensitivity, setSet, setSizeX, setSizeXY, setSizeXYZ, setSizeY, setSizeZ, setVisible, setX, setXY, setXYZ, setY, setZ, toXML
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHOW_ALL

public static final int SHOW_ALL
See Also:
Constant Field Values

ORDER_OF_APPEARANCE

public static final int ORDER_OF_APPEARANCE
See Also:
Constant Field Values

X_COORDINATE

public static final int X_COORDINATE
See Also:
Constant Field Values

Y_COORDINATE

public static final int Y_COORDINATE
See Also:
Constant Field Values

Z_COORDINATE

public static final int Z_COORDINATE
See Also:
Constant Field Values

BAR

public static final int BAR
See Also:
Constant Field Values

POST

public static final int POST
See Also:
Constant Field Values

AREA

public static final int AREA
See Also:
Constant Field Values
Constructor Detail

InteractiveTrace

public InteractiveTrace()
Default constructor

Method Detail

setName

public void setName(java.lang.String _name)

getName

public java.lang.String getName()
Description copied from interface: Data
The name of the data

Specified by:
getName in interface Data
Returns:
the name

copyFrom

public void copyFrom(InteractiveElement _element)
Specified by:
copyFrom in interface InteractiveElement
Overrides:
copyFrom in class AbstractInteractiveElement

initializeMemberOfSet

public void initializeMemberOfSet()
Description copied from interface: InteractiveElement
Special initialization when used as a memeber of a Set

Specified by:
initializeMemberOfSet in interface InteractiveElement
Overrides:
initializeMemberOfSet in class AbstractInteractiveElement

setMaximumPoints

public void setMaximumPoints(int _n)

getMaximumPoints

public int getMaximumPoints()

setConnected

public void setConnected(boolean connect)

isConnected

public boolean isConnected()

setIgnoreEqualPoints

public void setIgnoreEqualPoints(boolean ignoreEqual)

isIgnoreEqualPoints

public boolean isIgnoreEqualPoints()

setActive

public void setActive(boolean acceptInput)

isActive

public boolean isActive()

setClearAtInput

public void setClearAtInput(boolean _clear)

isClearAtInput

public boolean isClearAtInput()

setSkip

public void setSkip(int howMany)

getSkip

public int getSkip()

setMemorySets

public void setMemorySets(int howMany)

getMemorySets

public int getMemorySets()

setMemoryDrivenBy

public void setMemoryDrivenBy(int driving)

getMemoryDrivenBy

public int getMemoryDrivenBy()

setMemoryColor

public void setMemoryColor(java.awt.Color _color)

getMemoryColor

public java.awt.Color getMemoryColor()

setAllowTable

public void setAllowTable(boolean _allow)

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 -

clear

public void clear()

initialize

public void initialize()

addPoint

public void addPoint(double xInput,
                     double yInput)

addPoints

public void addPoints(double[] xInput,
                      double[] yInput)

addPoint

public void addPoint(double xInput,
                     double yInput,
                     double zInput)

addPoints

public void addPoints(double[] xInput,
                      double[] yInput,
                      double[] zInput)

moveToPoint

public void moveToPoint(double xInput,
                        double yInput)

moveToPoint

public void moveToPoint(double xInput,
                        double yInput,
                        double zInput)

setShapeType

public void setShapeType(int _type)
Set the type of the marker


setShapeSize

public void setShapeSize(int _size)
Set the size of the marker


setID

public void setID(int id)
Sets the ID number of this Data.

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

getID

public int getID()
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[][]

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

findInteractive

public Interactive findInteractive(DrawingPanel _panel,
                                   int _xpix,
                                   int _ypix)
Specified by:
findInteractive in interface Interactive
Specified by:
findInteractive in class AbstractInteractiveElement

getObjects3D

public Object3D[] getObjects3D(DrawingPanel3D _panel)
Description copied from interface: Drawable3D
Returns an array of Objects3D to (sort according to its distance and) draw.

Specified by:
getObjects3D in interface Drawable3D
Specified by:
getObjects3D in class AbstractInteractiveElement

draw

public void draw(DrawingPanel3D _panel,
                 java.awt.Graphics2D _g,
                 int _index)
Description copied from interface: Drawable3D
Draws a given Object3D (indicated by its index).

Specified by:
draw in interface Drawable3D
Specified by:
draw in class AbstractInteractiveElement

draw

public void draw(DrawingPanel _panel,
                 java.awt.Graphics _g)
Description copied from interface: Drawable
Draws a representation of an object in a drawing panel.

Specified by:
draw in interface Drawable
Specified by:
draw in class AbstractInteractiveElement

getXMinLogscale

public double getXMinLogscale()
Description copied from interface: LogMeasurable
Gets the minimum x needed to draw this object on a log scale.

Specified by:
getXMinLogscale in interface LogMeasurable
Returns:
minimum

getXMaxLogscale

public double getXMaxLogscale()
Description copied from interface: LogMeasurable
Gets the maximum x needed to draw this object on a log scale.

Specified by:
getXMaxLogscale in interface LogMeasurable
Returns:
maximum

getYMinLogscale

public double getYMinLogscale()
Description copied from interface: LogMeasurable
Gets the minimum y needed to draw this object on a log scale.

Specified by:
getYMinLogscale in interface LogMeasurable
Returns:
minimum

getYMaxLogscale

public double getYMaxLogscale()
Description copied from interface: LogMeasurable
Gets the maximum y needed to draw this object on a log scale on a log scale.

Specified by:
getYMaxLogscale in interface LogMeasurable
Returns:
maximum

isMeasured

public boolean isMeasured()
Description copied from interface: Measurable
Determines if information is available to set min/max values. Objects that store data should return false if data is null.

Specified by:
isMeasured in interface Measurable
Overrides:
isMeasured in class AbstractInteractiveElement
Returns:
true if min/max values are valid

getXMin

public double getXMin()
Description copied from interface: Measurable
Gets the minimum x needed to draw this object.

Specified by:
getXMin in interface Measurable
Overrides:
getXMin in class AbstractInteractiveElement
Returns:
minimum

getXMax

public double getXMax()
Description copied from interface: Measurable
Gets the maximum x needed to draw this object.

Specified by:
getXMax in interface Measurable
Overrides:
getXMax in class AbstractInteractiveElement
Returns:
maximum

getYMin

public double getYMin()
Description copied from interface: Measurable
Gets the minimum y needed to draw this object.

Specified by:
getYMin in interface Measurable
Overrides:
getYMin in class AbstractInteractiveElement
Returns:
minimum

getYMax

public double getYMax()
Description copied from interface: Measurable
Gets the maximum y needed to draw this object.

Specified by:
getYMax in interface Measurable
Overrides:
getYMax in class AbstractInteractiveElement
Returns:
minimum

getZMin

public double getZMin()
Description copied from interface: Measurable3D
Gets the minimum z needed to draw this object.

Specified by:
getZMin in interface Measurable3D
Overrides:
getZMin in class AbstractInteractiveElement
Returns:
minimum

getZMax

public double getZMax()
Description copied from interface: Measurable3D
Gets the maximum z needed to draw this object.

Specified by:
getZMax in interface Measurable3D
Overrides:
getZMax in class AbstractInteractiveElement
Returns:
maximum