org.opensourcephysics.displayejs
Class InteractivePoligon

java.lang.Object
  extended by org.opensourcephysics.displayejs.AbstractInteractiveElement
      extended by org.opensourcephysics.displayejs.InteractivePoligon
All Implemented Interfaces:
Data, Drawable, Interactive, Measurable, Drawable3D, HasDataObjectInterface, InteractionSource, InteractiveElement, Measurable3D
Direct Known Subclasses:
Pipe

public class InteractivePoligon
extends AbstractInteractiveElement
implements Data


Field Summary
static int ARROW
           
static int CIRCLE
           
static int DIAMOND
           
static int FILLED_ARROW
           
static int FILLED_CIRCLE
           
static int FILLED_DIAMOND
           
static int FILLED_SQUARE
           
static int LINE
           
static int PLAIN
           
static int SQUARE
           
 
Fields inherited from class org.opensourcephysics.displayejs.AbstractInteractiveElement
SENSIBILITY
 
Fields inherited from interface org.opensourcephysics.displayejs.InteractiveElement
TARGET_POSITION, TARGET_SIZE
 
Constructor Summary
InteractivePoligon()
           
 
Method Summary
 void copyFrom(InteractiveElement _element)
           
 void draw(DrawingPanel3D _panel, java.awt.Graphics2D _g2, 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[][] getData()
          Be warned! Data is stored as coordinates[3][numPoints] or coordinates[2][numPoints]
 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.
 double getEndSize()
           
 int getEndType()
           
 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
 java.lang.String getName()
          The name of the data
 int getNumberOfPoints()
           
 Object3D[] getObjects3D(DrawingPanel3D _panel)
          Returns an array of Objects3D to (sort according to its distance and) draw.
 double[] getPoint(int _index)
           
 double getStartSize()
           
 int getStartType()
           
 double getXMax()
          Gets the maximum x needed to draw this object.
 double getXMin()
          Gets the minimum x needed to draw this object.
 double getYMax()
          Gets the maximum y needed to draw this object.
 double getYMin()
          Gets the minimum y needed to draw this object.
 double getZMax()
          Gets the maximum z needed to draw this object.
 double getZMin()
          Gets the minimum z needed to draw this object.
 boolean isClosed()
           
 boolean isMeasured()
          Determines if information is available to set min/max values.
 void setAllowTable(boolean _allow)
           
 void setClosed(boolean _closed)
           
 void setColors(java.awt.Color[] _c)
          Sets the color of each individual line of the polygon Notice that setting the colors to a non-null array masks the style edge color.
 void setConnected(int _index, boolean _c)
           
 void setConnections(boolean[] _c)
           
 void setData(double[][] _data)
           
 void setEndSize(double _size)
           
 void setEndType(int _type)
           
 void setID(int id)
          Sets the ID number of this Data.
 void setName(java.lang.String _name)
           
 void setNeumatic(double _dash)
           
 void setNumberOfPoints(int _n)
           
 void setPointSizeEnabled(int _index, boolean _enabled)
           
 void setPointSizeEnableds(boolean[] _enabled)
           
 void setShapesEdgeColor(java.awt.Color _c)
           
 void setShapesEdgeColor(java.lang.Object[] _c)
           
 void setShapesFillColor(java.awt.Color _c)
           
 void setShapesFillColor(java.lang.Object[] _c)
           
 void setShapesSize(int _c)
           
 void setShapesSize(int[] _c)
           
 void setShapesType(int _c)
           
 void setShapesType(int[] _c)
           
 void setStartSize(double _size)
           
 void setStartType(int _type)
           
 void setXs(double _data)
           
 void setXs(double[] _data)
           
 void setYs(double _data)
           
 void setYs(double[] _data)
           
 void setZs(double _data)
           
 void setZs(double[] _data)
           
 
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, initializeMemberOfSet, 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

PLAIN

public static final int PLAIN
See Also:
Constant Field Values

CIRCLE

public static final int CIRCLE
See Also:
Constant Field Values

DIAMOND

public static final int DIAMOND
See Also:
Constant Field Values

SQUARE

public static final int SQUARE
See Also:
Constant Field Values

ARROW

public static final int ARROW
See Also:
Constant Field Values

LINE

public static final int LINE
See Also:
Constant Field Values

FILLED_CIRCLE

public static final int FILLED_CIRCLE
See Also:
Constant Field Values

FILLED_DIAMOND

public static final int FILLED_DIAMOND
See Also:
Constant Field Values

FILLED_SQUARE

public static final int FILLED_SQUARE
See Also:
Constant Field Values

FILLED_ARROW

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

InteractivePoligon

public InteractivePoligon()
Method Detail

copyFrom

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

setNumberOfPoints

public void setNumberOfPoints(int _n)

getNumberOfPoints

public int getNumberOfPoints()

setStartType

public void setStartType(int _type)

getStartType

public int getStartType()

setStartSize

public void setStartSize(double _size)

getStartSize

public double getStartSize()

setEndType

public void setEndType(int _type)

getEndType

public int getEndType()

setEndSize

public void setEndSize(double _size)

getEndSize

public double getEndSize()

setNeumatic

public void setNeumatic(double _dash)

setClosed

public void setClosed(boolean _closed)

isClosed

public boolean isClosed()

setAllowTable

public void setAllowTable(boolean _allow)

setData

public void setData(double[][] _data)

getData

public double[][] getData()
Be warned! Data is stored as coordinates[3][numPoints] or coordinates[2][numPoints]

Returns:
double[][]

getPoint

public double[] getPoint(int _index)

setXs

public void setXs(double[] _data)

setXs

public void setXs(double _data)

setYs

public void setYs(double[] _data)

setYs

public void setYs(double _data)

setZs

public void setZs(double[] _data)

setZs

public void setZs(double _data)

setConnections

public void setConnections(boolean[] _c)

setConnected

public void setConnected(int _index,
                         boolean _c)

setPointSizeEnableds

public void setPointSizeEnableds(boolean[] _enabled)

setPointSizeEnabled

public void setPointSizeEnabled(int _index,
                                boolean _enabled)

setColors

public void setColors(java.awt.Color[] _c)
Sets the color of each individual line of the polygon Notice that setting the colors to a non-null array masks the style edge color. Setting the colors to a null array makes the element use the style edge color.

Parameters:
_c - Color[]

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

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

setShapesType

public void setShapesType(int[] _c)

setShapesType

public void setShapesType(int _c)

setShapesSize

public void setShapesSize(int[] _c)

setShapesSize

public void setShapesSize(int _c)

setShapesEdgeColor

public void setShapesEdgeColor(java.lang.Object[] _c)

setShapesEdgeColor

public void setShapesEdgeColor(java.awt.Color _c)

setShapesFillColor

public void setShapesFillColor(java.lang.Object[] _c)

setShapesFillColor

public void setShapesFillColor(java.awt.Color _c)

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 _g2,
                 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

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