org.opensourcephysics.displayejs
Class InteractiveParticle

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

public class InteractiveParticle
extends AbstractInteractiveElement

An InteractiveParticle is an InteractiveElement that displays a RectangularShape


Field Summary
static int ELLIPSE
           
static int NONE
           
static int RECTANGLE
           
static int ROUND_RECTANGLE
           
static int WHEEL
           
 
Fields inherited from class org.opensourcephysics.displayejs.AbstractInteractiveElement
SENSIBILITY
 
Fields inherited from interface org.opensourcephysics.displayejs.InteractiveElement
TARGET_POSITION, TARGET_SIZE
 
Constructor Summary
InteractiveParticle()
          Default constructor
InteractiveParticle(int _type)
          Constructor that accepts 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.
 boolean getPixelSize()
           
 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 setPixelSize(boolean _s)
          If true, the image is drawn as is, without resizing it
 void setSensitivity(int _s)
          Sets the size of the interaction hot spot (in pixels).
 void setShapeType(int _type)
          Set the type of the marker
 
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, 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

NONE

public static final int NONE
See Also:
Constant Field Values

ELLIPSE

public static final int ELLIPSE
See Also:
Constant Field Values

RECTANGLE

public static final int RECTANGLE
See Also:
Constant Field Values

ROUND_RECTANGLE

public static final int ROUND_RECTANGLE
See Also:
Constant Field Values

WHEEL

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

InteractiveParticle

public InteractiveParticle()
Default constructor


InteractiveParticle

public InteractiveParticle(int _type)
Constructor that accepts a given type. Either ELLIPSE, RECTANGLE, ROUND_RECTANGLE or NONE (a dot will be displayed)

Method Detail

copyFrom

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

setShapeType

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


setPixelSize

public void setPixelSize(boolean _s)
If true, the image is drawn as is, without resizing it

Parameters:
_s - boolean

getPixelSize

public boolean getPixelSize()

setSensitivity

public void setSensitivity(int _s)
Description copied from interface: InteractiveElement
Sets the size of the interaction hot spot (in pixels). If zero or negative, some elements (such as Images and Particles) may use the full area. Others will use a default of 5.

Specified by:
setSensitivity in interface InteractiveElement
Overrides:
setSensitivity in class AbstractInteractiveElement
Parameters:
_s - int

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

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