jdraw.graphicalobjects
Class Ellipse

java.lang.Object
  |
  +--jdraw.graphicalobjects.GraphicalObject
        |
        +--jdraw.graphicalobjects.SizedGraphicalObject
              |
              +--jdraw.graphicalobjects.Ellipse

public class Ellipse
extends SizedGraphicalObject

A graphical ellipse.


Field Summary
private static Cursor CURSOR
          The mouse cursor for this object.
static String FRIENDLYNAME
          The friendly name of objects of this class.
private  int iXRadius
          The X-axis radius of this ellipse.
private  int iYRadius
          The Y-axis radius of this ellipse.
private  Point ptCenter
          The center of this ellipse.
 
Fields inherited from class jdraw.graphicalobjects.SizedGraphicalObject
iHeight, iWidth
 
Fields inherited from class jdraw.graphicalobjects.GraphicalObject
bDragInProgress, colColor, iX, iY, lstPropertyChangeListeners, ptDragAndDropStartPosition, ptInitialObjectPosition, rectInitialBoundingBox
 
Constructor Summary
Ellipse(int iX, int iY, Color colColor, int iWidth, int iHeight)
          Creates a new Ellipse with specified position, color, width and height.
 
Method Summary
 Point getCenter()
          Returns the center of this ellipse.
 Cursor getCursor()
          Returns the mouse cursor for this object.
 int getDistanceSq(Point ptPoint)
          Returns the square of the minimal distance between this ellipse and the specified point.
 String getFriendlyName()
          Returns the friendly name of this ellipse.
 int getXRadius()
          Returns the X-axis radius of this ellipse.
 int getYRadius()
          Returns the Y-axis radius of this ellipse.
 void paint(Graphics g)
          Paints this ellipse.
protected  void updateCachedData()
          Invoked when cached data have to be updated.
protected  void updateCenter()
          Updates the center of this ellipse.
protected  void updateRadii()
          Updates the radii of this ellipse.
 
Methods inherited from class jdraw.graphicalobjects.SizedGraphicalObject
getBoundingBox, getHeight, getPropertyDialog, getWidth, setHeight, setWidth
 
Methods inherited from class jdraw.graphicalobjects.GraphicalObject
addPropertyChangeListener, commitDragAndDrop, drag, fireBoudingBoxChange, getColor, getDistance, getDistanceSq, getDistanceSq, getX, getY, isDragInProgress, moveTo_silent, moveTo, openPropertyDialog, prepareBoudingBoxEvent, removePropertyChangeListener, rollbackDragAndDrop, setColor_silent, setColor, setX_silent, setX, setY_silent, setY, startDragAndDrop, suspendDragAndDrop
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

FRIENDLYNAME

public static final String FRIENDLYNAME
The friendly name of objects of this class.

CURSOR

private static final Cursor CURSOR
The mouse cursor for this object.

ptCenter

private final Point ptCenter
The center of this ellipse.

iXRadius

private int iXRadius
The X-axis radius of this ellipse.

iYRadius

private int iYRadius
The Y-axis radius of this ellipse.
Constructor Detail

Ellipse

public Ellipse(int iX,
               int iY,
               Color colColor,
               int iWidth,
               int iHeight)
Creates a new Ellipse with specified position, color, width and height.
Method Detail

getCursor

public Cursor getCursor()
Returns the mouse cursor for this object.
Overrides:
getCursor in class GraphicalObject

getFriendlyName

public String getFriendlyName()
Returns the friendly name of this ellipse.
Overrides:
getFriendlyName in class GraphicalObject

paint

public void paint(Graphics g)
Paints this ellipse.
Overrides:
paint in class GraphicalObject

getDistanceSq

public int getDistanceSq(Point ptPoint)
Returns the square of the minimal distance between this ellipse and the specified point. Actually, this methods does not return the minimal distance (which is not easily computable), but the distance between the specified point and the intersection between this point and the center of this ellipse. This was found to be a sufficient approximation.
Overrides:
getDistanceSq in class GraphicalObject

updateCachedData

protected void updateCachedData()
Invoked when cached data have to be updated.
Overrides:
updateCachedData in class GraphicalObject

getCenter

public Point getCenter()
Returns the center of this ellipse.

updateCenter

protected void updateCenter()
Updates the center of this ellipse.

getXRadius

public int getXRadius()
Returns the X-axis radius of this ellipse.

getYRadius

public int getYRadius()
Returns the Y-axis radius of this ellipse.

updateRadii

protected void updateRadii()
Updates the radii of this ellipse.