uwcse.graphics
Class Arc
java.lang.Object
|
+--uwcse.graphics.ShapeImpl
|
+--uwcse.graphics.CurvedShape
|
+--uwcse.graphics.Arc
- All Implemented Interfaces:
- Shape
- public class Arc
- extends CurvedShape
An arc shape. This is a portion of an oval, either filled (a pie
wedge) or unfilled (a curving line), from a starting angle through
an ending angle. The main operations are to read the x and y
coordinates of the upper-left corner and the center of the bounding
rectangle (getX(), getY(), getCenterX(), and getCenterY()), to
change the position of the arc (moveBy(...) and moveTo(...)), to
rotate the center of the arc around some point (rotateAround(...)),
to read and change the color of the arc (getColor() and
setColor(...)), to read and change the width and height of the arc
(getWidth(), getHeight(), and resize(...)), and add to and remove
from a GWindow (addTo(...) and removeFromWindow()). Other
operations are mainly for internal use, and should not be called by
regular client programs.
Constructor Summary |
Arc()
Create an unfilled yellow arc with a default position, size, and
angle. |
Arc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Create an unfilled black arc whose bounding rectangle has the
specified upper-left corner and dimensions and with the
specified start angle and arc angle. |
Arc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle,
java.awt.Color c,
boolean fill)
Create an arc with the given color and filledness whose bounding
rectangle has the specified upper-left corner and dimensions and
with the specified start angle and arc angle. |
Method Summary |
void |
paint(java.awt.Graphics g)
Paint this shape onto the given graphics context. |
java.lang.String |
toString()
Answer the printed representation of this shape. |
Methods inherited from class uwcse.graphics.ShapeImpl |
addTo, currentWindow, getBoundingBox, getCenterX, getCenterY, getColor, getHeight, getWidth, getX, getY, intersects, moveBy, moveTo, recordWindow, removeFromWindow, rotateAround, setColor |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface uwcse.graphics.Shape |
addTo, currentWindow, getBoundingBox, getCenterX, getCenterY, getColor, getHeight, getWidth, getX, getY, intersects, moveBy, moveTo, recordWindow, removeFromWindow, rotateAround, setColor |
Arc
public Arc()
- Create an unfilled yellow arc with a default position, size, and
angle.
Arc
public Arc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
- Create an unfilled black arc whose bounding rectangle has the
specified upper-left corner and dimensions and with the
specified start angle and arc angle.
- Parameters:
x
- the x coordinate of the upper left cornery
- the y coordinate of the upper left cornerwidth
- the width of the archeight
- the height of the arcstartAngle
- the angle in degrees (counter-clockwise from 3
o'clock) to start the arcarcAngle
- the angle in degrees of the arc
Arc
public Arc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle,
java.awt.Color c,
boolean fill)
- Create an arc with the given color and filledness whose bounding
rectangle has the specified upper-left corner and dimensions and
with the specified start angle and arc angle.
- Parameters:
x
- the x coordinate of the upper left cornery
- the y coordinate of the upper left cornerwidth
- the width of the archeight
- the height of the arcstartAngle
- the angle in degrees (counter-clockwise from 3
o'clock) to start the arcarcAngle
- the angle in degrees of the arcc
- the color of the arcfill
- should it be filled?
paint
public void paint(java.awt.Graphics g)
- Description copied from interface:
Shape
- Paint this shape onto the given graphics context. For internal
use only.
toString
public java.lang.String toString()
- Description copied from class:
ShapeImpl
- Answer the printed representation of this shape.
- Overrides:
toString
in class ShapeImpl