edu.rit.draw.item
Class Oval
- java.lang.Object
-
- All Implemented Interfaces:
- java.io.Externalizable, java.io.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
Fields Modifier and Type Field and Description static doubleNORMAL_HEIGHTThe normal height for ovals (72).static doubleNORMAL_WIDTHThe 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
Constructors Constructor and Description 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description Ovaladd()Add this oval to the end of the default drawing's sequence of drawing items.Ovaladd(Drawing theDrawing)Add this oval to the end of the given drawing's sequence of drawing items.OvaladdFirst()Add this oval to the beginning of the default drawing's sequence of drawing items.OvaladdFirst(Drawing theDrawing)Add this oval to the beginning of the given drawing's sequence of drawing items.Ovalc(double x, double y)Set the center point of this oval's bounding box.Ovalc(Point thePoint)Set the center point of this oval's bounding box.static doubledefaultHeight()Returns the default height for ovals.static voiddefaultHeight(double theHeight)Set the default height for ovals.static SizedefaultSize()Returns the default size for ovals.static voiddefaultSize(Size theSize)Set the default size for ovals.static doubledefaultWidth()Returns the default width for ovals.static voiddefaultWidth(double theWidth)Set the default width for ovals.Ovale(double x, double y)Set the east middle point of this oval's bounding box.Ovale(Point thePoint)Set the east middle point of this oval's bounding box.Ovalfill(Fill theFill)Set this oval's fill paint.Ovalheight(double theHeight)Set the height of this oval's bounding box.Ovaln(double x, double y)Set the north middle point of this oval's bounding box.Ovaln(Point thePoint)Set the north middle point of this oval's bounding box.Ovalne(double x, double y)Set the northeast corner point of this oval's bounding box.Ovalne(Point thePoint)Set the northeast corner point of this oval's bounding box.Ovalnw(double x, double y)Set the northwest corner point of this oval's bounding box.Ovalnw(Point thePoint)Set the northwest corner point of this oval's bounding box.Ovaloutline(Outline theOutline)Set this oval's outline.Ovals(double x, double y)Set the south middle point of this oval's bounding box.Ovals(Point thePoint)Set the south middle point of this oval's bounding box.Ovalse(double x, double y)Set the southeast corner point of this oval's bounding box.Ovalse(Point thePoint)Set the southeast corner point of this oval's bounding box.Ovalsize(Size theSize)Set the size of this oval's bounding box.Ovalsw(double x, double y)Set the southwest corner point of this oval's bounding box.Ovalsw(Point thePoint)Set the southwest corner point of this oval's bounding box.Ovalw(double x, double y)Set the west middle point of this oval's bounding box.Ovalw(Point thePoint)Set the west middle point of this oval's bounding box.Ovalwidth(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.FilledItem
defaultFill, defaultFill, fill
-
Methods inherited from class edu.rit.draw.item.OutlinedItem
defaultOutline, defaultOutline, outline
-
-
-
-
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:
java.lang.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:
java.lang.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:
java.lang.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:
java.lang.IllegalArgumentException- (unchecked exception) Thrown if theHeight is less than 0.
-
outline
public Oval outline(Outline theOutline)
Set this oval's outline.- Overrides:
outlinein classRectangularItem- Parameters:
theOutline- Outline, or Outline.NONE.- Returns:
- This oval.
-
fill
public Oval fill(Fill theFill)
Set this oval's fill paint.- Overrides:
fillin classRectangularItem- 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:
sizein classRectangularItem- Parameters:
theSize- Size.- Returns:
- This oval.
- Throws:
java.lang.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:
widthin classRectangularItem- Parameters:
theWidth- Width.- Returns:
- This oval.
- Throws:
java.lang.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:
heightin classRectangularItem- Parameters:
theHeight- Height.- Returns:
- This oval.
- Throws:
java.lang.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:
nwin classRectangularItem- 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:
nwin classRectangularItem- Parameters:
thePoint- Northwest corner point.- Returns:
- This oval.
- Throws:
java.lang.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:
nin classRectangularItem- 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:
nin classRectangularItem- Parameters:
thePoint- North middle point.- Returns:
- This oval.
- Throws:
java.lang.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:
nein classRectangularItem- 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:
nein classRectangularItem- Parameters:
thePoint- Northeast corner point.- Returns:
- This oval.
- Throws:
java.lang.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:
win classRectangularItem- 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:
win classRectangularItem- Parameters:
thePoint- West middle point.- Returns:
- This oval.
- Throws:
java.lang.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:
cin classRectangularItem- 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:
cin classRectangularItem- Parameters:
thePoint- Center point.- Returns:
- This oval.
- Throws:
java.lang.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:
ein classRectangularItem- 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:
ein classRectangularItem- Parameters:
thePoint- East middle point.- Returns:
- This oval.
- Throws:
java.lang.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:
swin classRectangularItem- 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:
swin classRectangularItem- Parameters:
thePoint- Southwest corner point.- Returns:
- This oval.
- Throws:
java.lang.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:
sin classRectangularItem- 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:
sin classRectangularItem- Parameters:
thePoint- South middle point.- Returns:
- This oval.
- Throws:
java.lang.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:
sein classRectangularItem- 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:
sein classRectangularItem- Parameters:
thePoint- Southeast corner point.- Returns:
- This oval.
- Throws:
java.lang.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:
addin classRectangularItem- Returns:
- This oval.
- Throws:
java.lang.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:
addin classRectangularItem- Parameters:
theDrawing- Drawing.- Returns:
- This oval.
- Throws:
java.lang.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:
addFirstin classRectangularItem- Returns:
- This oval.
- Throws:
java.lang.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:
addFirstin classRectangularItem- Parameters:
theDrawing- Drawing.- Returns:
- This oval.
- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if theDrawing is null.
-
-
DMelt 3.0 © DataMelt by jWork.ORG