org.opensourcephysics.media.core
Class TCircle

java.lang.Object
  extended by java.awt.geom.Point2D
      extended by java.awt.geom.Point2D.Double
          extended by org.opensourcephysics.media.core.TPoint
              extended by org.opensourcephysics.media.core.TShape
                  extended by org.opensourcephysics.media.core.TCircle
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Drawable, Interactive, Measurable, Trackable

public class TCircle
extends TShape

This is a Trackable circle that extends TShape.

Version:
1.0
Author:
Douglas Brown
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Point2D
java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Float
 
Field Summary
protected  java.awt.geom.Ellipse2D circle
           
protected  int n
           
protected  int radius
           
 
Fields inherited from class org.opensourcephysics.media.core.TShape
color, fillShape, hitRect, stroke, visible
 
Fields inherited from class org.opensourcephysics.media.core.TPoint
coordinateStrBuilder, coordsEditTrigger, coordsVisibleInMouseBox, enabled, screenPt, stepEditTrigger, support, trackEditTrigger, worldPt
 
Fields inherited from class java.awt.geom.Point2D.Double
x, y
 
Constructor Summary
TCircle(int n)
          Constructs a TCircle with image coordinates (0, 0).
TCircle(int n, double x, double y)
          Constructs a TCircle with specified image coordinates.
 
Method Summary
 Interactive findInteractive(DrawingPanel panel, int xpix, int ypix)
          Returns this if it is enabled and visible and the specified pixel position falls within the bounds of this circle.
 int getFrameNumber(VideoPanel vidPanel)
          Overrides TPoint getFrameNumber method.
 int getRadius()
          Gets the radius of this circle.
protected  java.awt.Shape getShape(VideoPanel vidPanel)
          Gets the circle shape to be filled in the draw method.
 void setRadius(int radius)
          Sets the radius of this circle.
 
Methods inherited from class org.opensourcephysics.media.core.TShape
draw, getBounds, getColor, getStroke, isVisible, setColor, setHitRectCenter, setStroke, setVisible, toString
 
Methods inherited from class org.opensourcephysics.media.core.TPoint
addPropertyChangeListener, addPropertyChangeListener, angle, angle, center, cos, cos, equals, getScreenPosition, getWorldPosition, getXMax, getXMin, getYMax, getYMin, isCoordsEditTrigger, isEnabled, isMeasured, isStepEditTrigger, isTrackEditTrigger, removePropertyChangeListener, removePropertyChangeListener, setCoordsEditTrigger, setEnabled, setLocation, setPositionOnLine, setScreenPosition, setScreenPosition, setStepEditTrigger, setTrackEditTrigger, setX, setXY, setY, showCoordinates, sin, sin, translate
 
Methods inherited from class java.awt.geom.Point2D.Double
getX, getY
 
Methods inherited from class java.awt.geom.Point2D
clone, distance, distance, distance, distanceSq, distanceSq, distanceSq, hashCode, setLocation
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opensourcephysics.display.Interactive
getX, getY
 

Field Detail

circle

protected java.awt.geom.Ellipse2D circle

radius

protected int radius

n

protected int n
Constructor Detail

TCircle

public TCircle(int n)
Constructs a TCircle with image coordinates (0, 0).

Parameters:
n - the video frame number

TCircle

public TCircle(int n,
               double x,
               double y)
Constructs a TCircle with specified image coordinates.

Parameters:
n - the video frame number
x - the x coordinate
y - the y coordinate
Method Detail

setRadius

public void setRadius(int radius)
Sets the radius of this circle.

Parameters:
radius - the radius in screen pixels

getRadius

public int getRadius()
Gets the radius of this circle.

Returns:
the radius in screen pixels

getFrameNumber

public int getFrameNumber(VideoPanel vidPanel)
Overrides TPoint getFrameNumber method.

Overrides:
getFrameNumber in class TPoint
Parameters:
vidPanel - the video panel drawing this circle
Returns:
the frame number

findInteractive

public Interactive findInteractive(DrawingPanel panel,
                                   int xpix,
                                   int ypix)
Returns this if it is enabled and visible and the specified pixel position falls within the bounds of this circle.

Specified by:
findInteractive in interface Interactive
Overrides:
findInteractive in class TShape
Parameters:
panel - the drawing panel
xpix - the x pixel position on the panel
ypix - the y pixel position on the panel
Returns:
this if enabled and hit, otherwise null

getShape

protected java.awt.Shape getShape(VideoPanel vidPanel)
Gets the circle shape to be filled in the draw method.

Overrides:
getShape in class TShape
Parameters:
vidPanel - the video panel
Returns:
the circle shape