edu.rit.draw.item
Class Oval

java.lang.Object
  extended by edu.rit.draw.item.DrawingItem
      extended by edu.rit.draw.item.OutlinedItem
          extended by edu.rit.draw.item.FilledItem
              extended by edu.rit.draw.item.ShapeItem
                  extended by edu.rit.draw.item.RectangularItem
                      extended by edu.rit.draw.item.Oval
All Implemented Interfaces:
Externalizable, Serializable

public class Oval
extends RectangularItem

Class Oval provides an oval DrawingItem. An oval is a rectangle whose narrower sides have been rounded into half-circles:

The static defaultSize(), defaultWidth(), and defaultHeight() methods are provided to set the default size, width, and height. If an oval's size, width, or height is not specified, the current default size, width, or height is used.

See Also:
Serialized Form

Field Summary
static double NORMAL_HEIGHT
          The normal height for ovals (72).
static double NORMAL_WIDTH
          The normal width for ovals (72).
 
Fields inherited from class edu.rit.draw.item.FilledItem
NORMAL_FILL
 
Fields inherited from class edu.rit.draw.item.OutlinedItem
NORMAL_OUTLINE
 
Constructor Summary
Oval()
          Construct a new oval.
Oval(Oval theItem)
          Construct a new oval with the same outline, fill paint, location, and size as the given oval.
 
Method Summary
 Oval add()
          Add this oval to the end of the default drawing's sequence of drawing items.
 Oval add(Drawing theDrawing)
          Add this oval to the end of the given drawing's sequence of drawing items.
 Oval addFirst()
          Add this oval to the beginning of the default drawing's sequence of drawing items.
 Oval addFirst(Drawing theDrawing)
          Add this oval to the beginning of the given drawing's sequence of drawing items.
 Oval c(double x, double y)
          Set the center point of this oval's bounding box.
 Oval c(Point thePoint)
          Set the center point of this oval's bounding box.
static double defaultHeight()
          Returns the default height for ovals.
static void defaultHeight(double theHeight)
          Set the default height for ovals.
static Size defaultSize()
          Returns the default size for ovals.
static void defaultSize(Size theSize)
          Set the default size for ovals.
static double defaultWidth()
          Returns the default width for ovals.
static void defaultWidth(double theWidth)
          Set the default width for ovals.
 Oval e(double x, double y)
          Set the east middle point of this oval's bounding box.
 Oval e(Point thePoint)
          Set the east middle point of this oval's bounding box.
 Oval fill(Fill theFill)
          Set this oval's fill paint.
 Oval height(double theHeight)
          Set the height of this oval's bounding box.
 Oval n(double x, double y)
          Set the north middle point of this oval's bounding box.
 Oval n(Point thePoint)
          Set the north middle point of this oval's bounding box.
 Oval ne(double x, double y)
          Set the northeast corner point of this oval's bounding box.
 Oval ne(Point thePoint)
          Set the northeast corner point of this oval's bounding box.
 Oval nw(double x, double y)
          Set the northwest corner point of this oval's bounding box.
 Oval nw(Point thePoint)
          Set the northwest corner point of this oval's bounding box.
 Oval outline(Outline theOutline)
          Set this oval's outline.
 Oval s(double x, double y)
          Set the south middle point of this oval's bounding box.
 Oval s(Point thePoint)
          Set the south middle point of this oval's bounding box.
 Oval se(double x, double y)
          Set the southeast corner point of this oval's bounding box.
 Oval se(Point thePoint)
          Set the southeast corner point of this oval's bounding box.
 Oval size(Size theSize)
          Set the size of this oval's bounding box.
 Oval sw(double x, double y)
          Set the southwest corner point of this oval's bounding box.
 Oval sw(Point thePoint)
          Set the southwest corner point of this oval's bounding box.
 Oval w(double x, double y)
          Set the west middle point of this oval's bounding box.
 Oval w(Point thePoint)
          Set the west middle point of this oval's bounding box.
 Oval width(double theWidth)
          Set the width of this oval's bounding box.
 
Methods inherited from class edu.rit.draw.item.RectangularItem
height, nw, readExternal, width, writeExternal
 
Methods inherited from class edu.rit.draw.item.ShapeItem
draw
 
Methods inherited from class edu.rit.draw.item.FilledItem
defaultFill, defaultFill, fill
 
Methods inherited from class edu.rit.draw.item.OutlinedItem
defaultOutline, defaultOutline, outline
 
Methods inherited from class edu.rit.draw.item.DrawingItem
boundingBox, c, e, n, ne, s, se, size, sw, w
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORMAL_WIDTH

public static final double NORMAL_WIDTH
The normal width for ovals (72). Note: 72 points = 1 inch.

See Also:
Constant Field Values

NORMAL_HEIGHT

public static final double NORMAL_HEIGHT
The normal height for ovals (72). Note: 72 points = 1 inch.

See Also:
Constant Field Values
Constructor Detail

Oval

public Oval()
Construct a new oval. The oval's northwest corner is located at (0,0). The oval's size is the default size.


Oval

public Oval(Oval theItem)
Construct a new oval with the same outline, fill paint, location, and size as the given oval.

Parameters:
theItem - Oval.
Throws:
NullPointerException - (unchecked exception) Thrown if theItem is null.
Method Detail

defaultSize

public static Size defaultSize()
Returns the default size for ovals.

Returns:
Default size.

defaultSize

public static void defaultSize(Size theSize)
Set the default size for ovals.

Parameters:
theSize - Default size.
Throws:
IllegalArgumentException - (unchecked exception) Thrown if the width or the height of theSize is less than 0.

defaultWidth

public static double defaultWidth()
Returns the default width for ovals.

Returns:
Default width.

defaultWidth

public static void defaultWidth(double theWidth)
Set the default width for ovals.

Parameters:
theWidth - Default width.
Throws:
IllegalArgumentException - (unchecked exception) Thrown if theWidth is less than 0.

defaultHeight

public static double defaultHeight()
Returns the default height for ovals.

Returns:
Default height.

defaultHeight

public static void defaultHeight(double theHeight)
Set the default height for ovals.

Parameters:
theHeight - Default height.
Throws:
IllegalArgumentException - (unchecked exception) Thrown if theHeight is less than 0.

outline

public Oval outline(Outline theOutline)
Set this oval's outline.

Overrides:
outline in class RectangularItem
Parameters:
theOutline - Outline, or Outline.NONE.
Returns:
This oval.

fill

public Oval fill(Fill theFill)
Set this oval's fill paint.

Overrides:
fill in class RectangularItem
Parameters:
theFill - Fill paint, or Fill.NONE.
Returns:
This oval.

size

public Oval size(Size theSize)
Set the size of this oval's bounding box.

Overrides:
size in class RectangularItem
Parameters:
theSize - Size.
Returns:
This oval.
Throws:
IllegalArgumentException - (unchecked exception) Thrown if the width or the height of theSize is less than 0.

width

public Oval width(double theWidth)
Set the width of this oval's bounding box.

Overrides:
width in class RectangularItem
Parameters:
theWidth - Width.
Returns:
This oval.
Throws:
IllegalArgumentException - (unchecked exception) Thrown if theWidth is less than 0.

height

public Oval height(double theHeight)
Set the height of this oval's bounding box.

Overrides:
height in class RectangularItem
Parameters:
theHeight - Height.
Returns:
This oval.
Throws:
IllegalArgumentException - (unchecked exception) Thrown if theHeight is less than 0.

nw

public Oval nw(double x,
               double y)
Set the northwest corner point of this oval's bounding box.

Overrides:
nw in class RectangularItem
Parameters:
x - X coordinate of northwest corner point.
y - Y coordinate of northwest corner point.
Returns:
This oval.

nw

public Oval nw(Point thePoint)
Set the northwest corner point of this oval's bounding box.

Overrides:
nw in class RectangularItem
Parameters:
thePoint - Northwest corner point.
Returns:
This oval.
Throws:
NullPointerException - (unchecked exception) Thrown if thePoint is null.

n

public Oval n(double x,
              double y)
Set the north middle point of this oval's bounding box.

Overrides:
n in class RectangularItem
Parameters:
x - X coordinate of north middle point.
y - Y coordinate of north middle point.
Returns:
This oval.

n

public Oval n(Point thePoint)
Set the north middle point of this oval's bounding box.

Overrides:
n in class RectangularItem
Parameters:
thePoint - North middle point.
Returns:
This oval.
Throws:
NullPointerException - (unchecked exception) Thrown if thePoint is null.

ne

public Oval ne(double x,
               double y)
Set the northeast corner point of this oval's bounding box.

Overrides:
ne in class RectangularItem
Parameters:
x - X coordinate of northeast corner point.
y - Y coordinate of northeast corner point.
Returns:
This oval.

ne

public Oval ne(Point thePoint)
Set the northeast corner point of this oval's bounding box.

Overrides:
ne in class RectangularItem
Parameters:
thePoint - Northeast corner point.
Returns:
This oval.
Throws:
NullPointerException - (unchecked exception) Thrown if thePoint is null.

w

public Oval w(double x,
              double y)
Set the west middle point of this oval's bounding box.

Overrides:
w in class RectangularItem
Parameters:
x - X coordinate of west middle point.
y - Y coordinate of west middle point.
Returns:
This oval.

w

public Oval w(Point thePoint)
Set the west middle point of this oval's bounding box.

Overrides:
w in class RectangularItem
Parameters:
thePoint - West middle point.
Returns:
This oval.
Throws:
NullPointerException - (unchecked exception) Thrown if thePoint is null.

c

public Oval c(double x,
              double y)
Set the center point of this oval's bounding box.

Overrides:
c in class RectangularItem
Parameters:
x - X coordinate of center point.
y - Y coordinate of center point.
Returns:
This oval.

c

public Oval c(Point thePoint)
Set the center point of this oval's bounding box.

Overrides:
c in class RectangularItem
Parameters:
thePoint - Center point.
Returns:
This oval.
Throws:
NullPointerException - (unchecked exception) Thrown if thePoint is null.

e

public Oval e(double x,
              double y)
Set the east middle point of this oval's bounding box.

Overrides:
e in class RectangularItem
Parameters:
x - X coordinate of east middle point.
y - Y coordinate of east middle point.
Returns:
This oval.

e

public Oval e(Point thePoint)
Set the east middle point of this oval's bounding box.

Overrides:
e in class RectangularItem
Parameters:
thePoint - East middle point.
Returns:
This oval.
Throws:
NullPointerException - (unchecked exception) Thrown if thePoint is null.

sw

public Oval sw(double x,
               double y)
Set the southwest corner point of this oval's bounding box.

Overrides:
sw in class RectangularItem
Parameters:
x - X coordinate of southwest corner point.
y - Y coordinate of southwest corner point.
Returns:
This oval.

sw

public Oval sw(Point thePoint)
Set the southwest corner point of this oval's bounding box.

Overrides:
sw in class RectangularItem
Parameters:
thePoint - Southwest corner point.
Returns:
This oval.
Throws:
NullPointerException - (unchecked exception) Thrown if thePoint is null.

s

public Oval s(double x,
              double y)
Set the south middle point of this oval's bounding box.

Overrides:
s in class RectangularItem
Parameters:
x - X coordinate of south middle point.
y - Y coordinate of south middle point.
Returns:
This oval.

s

public Oval s(Point thePoint)
Set the south middle point of this oval's bounding box.

Overrides:
s in class RectangularItem
Parameters:
thePoint - South middle point.
Returns:
This oval.
Throws:
NullPointerException - (unchecked exception) Thrown if thePoint is null.

se

public Oval se(double x,
               double y)
Set the southeast corner point of this oval's bounding box.

Overrides:
se in class RectangularItem
Parameters:
x - X coordinate of southeast corner point.
y - Y coordinate of southeast corner point.
Returns:
This oval.

se

public Oval se(Point thePoint)
Set the southeast corner point of this oval's bounding box.

Overrides:
se in class RectangularItem
Parameters:
thePoint - Southeast corner point.
Returns:
This oval.
Throws:
NullPointerException - (unchecked exception) Thrown if thePoint is null.

add

public Oval add()
Add this oval to the end of the default drawing's sequence of drawing items.

Overrides:
add in class RectangularItem
Returns:
This oval.
Throws:
NullPointerException - (unchecked exception) Thrown if there is no default drawing.
See Also:
Drawing.defaultDrawing()

add

public Oval add(Drawing theDrawing)
Add this oval to the end of the given drawing's sequence of drawing items.

Overrides:
add in class RectangularItem
Parameters:
theDrawing - Drawing.
Returns:
This oval.
Throws:
NullPointerException - (unchecked exception) Thrown if theDrawing is null.

addFirst

public Oval addFirst()
Add this oval to the beginning of the default drawing's sequence of drawing items.

Overrides:
addFirst in class RectangularItem
Returns:
This oval.
Throws:
NullPointerException - (unchecked exception) Thrown if there is no default drawing.
See Also:
Drawing.defaultDrawing()

addFirst

public Oval addFirst(Drawing theDrawing)
Add this oval to the beginning of the given drawing's sequence of drawing items.

Overrides:
addFirst in class RectangularItem
Parameters:
theDrawing - Drawing.
Returns:
This oval.
Throws:
NullPointerException - (unchecked exception) Thrown if theDrawing is null.


Copyright © 2005-2012 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.