org.opensourcephysics.displayejs
Class InteractiveArrow

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

public class InteractiveArrow
extends AbstractInteractiveElement
implements Body


Field Summary
static int ARROW
           
static int BOX
           
static int SEGMENT
           
 
Fields inherited from class org.opensourcephysics.displayejs.AbstractInteractiveElement
SENSIBILITY
 
Fields inherited from interface org.opensourcephysics.displayejs.InteractiveElement
TARGET_POSITION, TARGET_SIZE
 
Constructor Summary
InteractiveArrow()
          Default constructor
InteractiveArrow(int _type)
          Constructor for a given type.
 
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.
 void drawQuickly(DrawingPanel3D _panel, java.awt.Graphics2D _g2)
          Sketches the drawable
 Interactive findInteractive(DrawingPanel _panel, int _xpix, int _ypix)
           
 Object3D[] getObjects3D(DrawingPanel3D _panel)
          Returns an array of Objects3D to (sort according to its distance and) draw.
 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.
 void setArrowType(int _type)
          Set the type of decoration at the head of the arrow.
 void setOrigin(double ox, double oy, double oz, boolean relativeToSize)
          Sets the origin of the body's own coordinate system.
 void setTransformation(Transformation transformation)
          Sets the internal transformation of the element, that is, the transformation that takes the standard XYZ axes to the body's internal reference axes.
 void toBodyFrame(double[] vector)
          This method converts a double[3] vector from the space's frame to the body's frame.
 void toSpaceFrame(double[] vector)
          This method converts a double[3] vector from the body's frame to the space's frame.
 
Methods inherited from class org.opensourcephysics.displayejs.AbstractInteractiveElement
addListener, canBeMeasured, getControl, getDataObject, getGroup, getResolution, getSensitivity, getSet, getSetIndex, getSizeX, getSizeY, getSizeZ, getStyle, getX, getY, getZ, initializeMemberOfSet, invokeActions, isEnabled, isEnabled, isGroupEnabled, isGroupEnabled, isMeasured, 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

ARROW

public static final int ARROW
See Also:
Constant Field Values

SEGMENT

public static final int SEGMENT
See Also:
Constant Field Values

BOX

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

InteractiveArrow

public InteractiveArrow()
Default constructor


InteractiveArrow

public InteractiveArrow(int _type)
Constructor for a given type. Either ARROW, SEGMENT or BOX

Method Detail

copyFrom

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

setArrowType

public void setArrowType(int _type)
Set the type of decoration at the head of the arrow. Either ARROW, SEGMENT (none) or BOX


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

drawQuickly

public void drawQuickly(DrawingPanel3D _panel,
                        java.awt.Graphics2D _g2)
Description copied from interface: Drawable3D
Sketches the drawable

Specified by:
drawQuickly in interface Drawable3D
Overrides:
drawQuickly 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

setOrigin

public void setOrigin(double ox,
                      double oy,
                      double oz,
                      boolean relativeToSize)
Description copied from interface: Body
Sets the origin of the body's own coordinate system. This implies that: The point can be specified either relative to the body's dimension (sizex,sizey,sizez) or in absolute coordinates. If relative, the point is computed as (x+ox*sizex,y+oy*sizey,z+oz*sizez). If absolute, as (x+ox,y+oy,z+oz). Specifying the point relatively is useful so that the body will automatically make the neccesary adjustments if it is subsequently resized.

Notice that nothing forces the origin point to be inside the body. If the relative position are not within the 0-1 range, or the absolute position are not within the corresponding 0-size range, the reference point will lie outside of the body.

Specified by:
setOrigin in interface Body

setTransformation

public void setTransformation(Transformation transformation)
Description copied from interface: Body
Sets the internal transformation of the element, that is, the transformation that takes the standard XYZ axes to the body's internal reference axes. The transformation is copied and should not be accessed by users directy. This implies that changing the original transformation has no effect on the element unless a new setTransformation is invoked. The transformation uses the body's position as its origin.

Specified by:
setTransformation in interface Body
Parameters:
transformation - the new transformation
See Also:
Transformation

toSpaceFrame

public void toSpaceFrame(double[] vector)
Description copied from interface: Body
This method converts a double[3] vector from the body's frame to the space's frame.

Specified by:
toSpaceFrame in interface Body

toBodyFrame

public void toBodyFrame(double[] vector)
                 throws java.lang.UnsupportedOperationException
Description copied from interface: Body
This method converts a double[3] vector from the space's frame to the body's frame.

This only works properly if the internal transformation is not set (i.e. it is the identity) or if it is invertible. Otherwise, a call to this method will throw a UnsupportedOperationException exception.

Specified by:
toBodyFrame in interface Body
Throws:
java.lang.UnsupportedOperationException

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