jdraw.graphicobjects
Class Ellipse

java.lang.Object
  |
  +--jdraw.graphicobjects.GraphicObject
        |
        +--jdraw.graphicobjects.SizedGraphicObject
              |
              +--jdraw.graphicobjects.Ellipse

public class Ellipse
extends SizedGraphicObject

An ellipse.


Field Summary
private  Point center
          The center of this ellipse.
private static Cursor CURSOR
          The mouse cursor for this object.
static String FRIENDLY_NAME
          The friendly name of objects of this class.
private  int x_radius
          The X-axis radius of this ellipse.
private  int y_radius
          The Y-axis radius of this ellipse.
 
Fields inherited from class jdraw.graphicobjects.SizedGraphicObject
 
Fields inherited from class jdraw.graphicobjects.GraphicObject
 
Constructor Summary
Ellipse(int x, int y, Color color, int width, int height)
          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 point)
          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.
 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.graphicobjects.SizedGraphicObject
getBoundingBox, getHeight, getWidth
 
Methods inherited from class jdraw.graphicobjects.GraphicObject
getColor, getDistance, getDistanceSq, getDistanceSq, getX, getY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FRIENDLY_NAME

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

See Also:
Constant Field Values

CURSOR

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


center

private final Point center
The center of this ellipse.


x_radius

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


y_radius

private int y_radius
The Y-axis radius of this ellipse.

Constructor Detail

Ellipse

public Ellipse(int x,
               int y,
               Color color,
               int width,
               int height)
Creates a new Ellipse with specified position, color, width and height.

Method Detail

getCursor

public Cursor getCursor()
Returns the mouse cursor for this object.

Specified by:
getCursor in class GraphicObject

getFriendlyName

public String getFriendlyName()
Returns the friendly name of this ellipse.

Specified by:
getFriendlyName in class GraphicObject

paint

public void paint(Graphics g)
Paints this ellipse.

Specified by:
paint in class GraphicObject

getDistanceSq

public int getDistanceSq(Point point)
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.

Specified by:
getDistanceSq in class GraphicObject

updateCachedData

public void updateCachedData()
Invoked when cached data have to be updated.

Overrides:
updateCachedData in class GraphicObject

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.