|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opensourcephysics.drawing2d.Element org.opensourcephysics.drawing2d.ElementTrail
public class ElementTrail
Title: ElementTrail
Description:A trail of points on the screen.
This object is often used to show the path of a moving object. Points are added to a trail either with addPoint() or moveToPoint(). Trails can have many segments. A segment is a section of a Trail that has a starting point, a stopping point, and a color. The clear method removes all segments from the trail whereas the initialize method only removes data from the current segment.
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.drawing2d.Element |
---|
TARGET_POSITION, TARGET_SIZE |
Constructor Summary | |
---|---|
ElementTrail()
|
Method Summary | |
---|---|
void |
addPoint(double[] point)
Adds a new double[] point to the trail. |
void |
addPoint(double x,
double y)
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)
Adds an array of points to the trail. |
void |
clear()
Clears all points from all segments of the trail. |
void |
draw(DrawingPanel _panel,
java.awt.Graphics _g)
Draws the element on a given Graphics2D. |
Interactive |
findInteractive(DrawingPanel _panel,
int _xpix,
int _ypix)
Gets the target that is under the (x,y) position of the screen. |
java.lang.String[] |
getColumnNames()
The column names to be used in the data display tool |
int |
getConnectionType()
Gets the connection type. |
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()
Returns the maximum number of points allowed for the trail |
int |
getSkipPoints()
Returns the skip parameter of the trail. |
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 |
isMeasured()
Determines if information is available to set min/max values. |
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)
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 |
setID(int id)
Sets the ID number of this Data |
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 |
Methods inherited from class org.opensourcephysics.drawing2d.Element |
---|
addInteractionListener, getCanBeMeasured, getDataObject, getInteractionTarget, getName, getPanel, getPosition, getSize, getSizeX, getSizeY, getStyle, getTransformation, getX, getXMax, getXMaxLogscale, getXMin, getXMinLogscale, getY, getYMax, getYMaxLogscale, getYMin, getYMinLogscale, hasChanged, invokeActions, isEnabled, isVisible, removeInteractionListener, setCanBeMeasured, setDataObject, setElementChanged, setEnabled, setName, setNeedToProject, setPanel, setPosition, setSize, setSizeX, setSizeXY, setSizeY, setTransformation, setVisible, setX, setXY, setY, toBodyFrame, toSpaceFrame, updateHotSpot |
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 |
---|
public static final int NO_CONNECTION
public static final int LINE_CONNECTION
Constructor Detail |
---|
public ElementTrail()
Method Detail |
---|
public void setActive(boolean _active)
_active
- public boolean isActive()
public void setNoRepeat(boolean _noRepeat)
_noRepeat
- public boolean isNoRepeat()
public void setClearAtInput(boolean _clear)
_clear
- public boolean isClearAtInput()
public void setSkipPoints(int _skip)
_skip
- public int getSkipPoints()
public void setXLabel(java.lang.String _label)
_label
- public void setYLabel(java.lang.String _label)
_label
- public void addPoint(double x, double y)
x
- double The X coordinate of the point.y
- double The Y coordinate of the point.public void addPoint(double[] point)
point
- double[] The double[2] array with the coordinates of the point.public void moveToPoint(double x, double y)
x
- double The X coordinate of the point.y
- double The Y coordinate of the point.public void moveToPoint(double[] point)
point
- double[] The double[2] array with the coordinates of the point.public void addPoints(double[][] input)
point
- double[][] The double[nPoints][2] array with the coordinates of the points.input
- public void addPoints(double[] xInput, double[] yInput)
xInput
- double The double[] array with the X coordinates of the points.yInput
- double The double[] array with the Y coordinates of the points.public void setMaximumPoints(int maximum)
maximum
- intpublic int getMaximumPoints()
public void setConnectionType(int type)
type
- intpublic int getConnectionType()
setConnectionType(int)
public void clear()
public void initialize()
public void newSegment()
public void setID(int id)
Data
setID
in interface Data
id
- the ID numberpublic int getID()
Data
getID
in interface Data
public double[][] getData2D()
Data
getData2D
in interface Data
public double[][][] getData3D()
Data
getData3D
in interface Data
public java.lang.String[] getColumnNames()
Data
getColumnNames
in interface Data
public java.awt.Color[] getLineColors()
Data
getLineColors
in interface Data
public java.awt.Color[] getFillColors()
Data
getFillColors
in interface Data
public java.util.List<Data> getDataList()
Data
getDataList
in interface Data
public java.util.ArrayList<Dataset> getDatasets()
Data
getDatasets
in interface Data
public void draw(DrawingPanel _panel, java.awt.Graphics _g)
Element
draw
in interface Drawable
draw
in class Element
public Interactive findInteractive(DrawingPanel _panel, int _xpix, int _ypix)
Element
findInteractive
in interface Interactive
findInteractive
in class Element
_panel
- org.opensourcephysics.display.DrawingPanel The drawing panel which originated the call_xpix
- int_ypix
- int
public boolean isMeasured()
Measurable
isMeasured
in interface Measurable
isMeasured
in class Element
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |