com.rolemodelsoft.drawlet.shapes.ellipses
Class Ellipse
java.lang.Object
|
+--com.rolemodelsoft.drawlet.basics.AbstractPaintable
|
+--com.rolemodelsoft.drawlet.basics.AbstractFigure
|
+--com.rolemodelsoft.drawlet.shapes.AbstractShape
|
+--com.rolemodelsoft.drawlet.shapes.FilledShape
|
+--com.rolemodelsoft.drawlet.shapes.AbstractRectangleShape
|
+--com.rolemodelsoft.drawlet.shapes.ellipses.Ellipse
- public class Ellipse
- extends AbstractRectangleShape
This provides a basic concrete implementation of Ellipses that are
assumed to be movable and reshapable with observers that want to know when
their locations or shapes change.
NOTE: intersection algorithms are currently incomplete and only determine if
the Rectangular bounds intersect.
- See Also:
- Serialized Form
|
Constructor Summary |
Ellipse()
Creates a new, default Ellipse. |
Ellipse(int x,
int y,
int width,
int height)
Creates a new Ellipse initialized to the given values. |
Ellipse(java.awt.Rectangle rectangle)
Creates a new Ellipse initialized to the given value. |
|
Method Summary |
boolean |
contains(int x,
int y)
Checks whether a specified x,y location is "inside" this
Figure. |
boolean |
contains(java.awt.Rectangle box)
Checks whether a specified Rectangle is "inside" this Figure,
where the Rectangle and this Figure are in the same coordinate system
In addition to checking topLeft and bottomRight, check topRight and bottomLeft. |
boolean |
intersects(java.awt.Rectangle box)
Answers whether the receiver intersects a Rectangular area. |
void |
paintFilled(java.awt.Graphics g)
Paint the receiver, filling all the contained area. |
void |
paintStrokes(java.awt.Graphics g)
Paint the outline of the receiver. |
| Methods inherited from class com.rolemodelsoft.drawlet.shapes.AbstractRectangleShape |
basicMove,
basicReshape,
basicResize,
basicTranslate,
changedShape,
defaultHeight,
defaultWidth,
defaultX,
defaultY,
getBounds,
getSize |
| Methods inherited from class com.rolemodelsoft.drawlet.shapes.FilledShape |
defaultFillColor,
defaultLineColor,
getFillColor,
getLineColor,
getStyle,
isOpaque,
isStroked,
paint,
setFillColor,
setLineColor,
setStyle |
| Methods inherited from class com.rolemodelsoft.drawlet.basics.AbstractFigure |
addPropertyChangeListener,
addRelatedLocationListener,
changedLocation,
changedSize,
contains,
deleteLocationListeners,
disconnect,
duplicate,
duplicateIn,
editTool,
estimatedDuplicateSize,
figureFromLocator,
fireLocationChange,
firePropertyChange,
firePropertyChange,
fireRelationChange,
fireShapeChange,
fireSizeChange,
getLocation,
getLocator,
intersects,
isObsolete,
isWithin,
isWithin,
locatorAt,
move,
move,
postDuplicate,
relatedLocationListeners,
removePropertyChangeListener,
removeRelatedLocationListener,
requestConnection,
resetLocationCache,
setSize,
translate |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Ellipse
public Ellipse()
- Creates a new, default Ellipse.
Ellipse
public Ellipse(int x,
int y,
int width,
int height)
- Creates a new Ellipse initialized to the given values.
- Parameters:
x - an integer representing the x coordinate for the new Ellipse.y - an integer representing the y coordinate for the new Ellipse.width - an integer representing the width for the new Ellipse.height - an integer representing the height for the new Ellipse.
Ellipse
public Ellipse(java.awt.Rectangle rectangle)
- Creates a new Ellipse initialized to the given value.
- Parameters:
rectangle - a Rectangle representing the bounds for the new Ellipse.
contains
public boolean contains(int x,
int y)
- Checks whether a specified x,y location is "inside" this
Figure.
x and y are defined to be relative to the
coordinate system of this figure. This is not guaranteed to be 100% accurate around the edges
due to rounding errors, but shouldn't be off by more than a single pixel.
- Overrides:
- contains in class AbstractFigure
- Parameters:
x - the x coordinatey - the y coordinate- Returns:
- boolean value of
true if the specified x,y
location is "inside" this Figure;
false otherwise. - See Also:
AbstractFigure.isWithin(com.rolemodelsoft.drawlet.Figure)
contains
public boolean contains(java.awt.Rectangle box)
- Checks whether a specified Rectangle is "inside" this Figure,
where the Rectangle and this Figure are in the same coordinate system
In addition to checking topLeft and bottomRight, check topRight and bottomLeft.
If all four corners are inside, everything is inside.
- Overrides:
- contains in class AbstractFigure
- Parameters:
box - the rectangle to test for inclusion- Returns:
- boolean value of
true if the specified Rectangle
is "inside" this Figure;
false otherwise.
intersects
public boolean intersects(java.awt.Rectangle box)
- Answers whether the receiver intersects a Rectangular area.
By default, just check if the bounds intersects.
Subclasses may wish to do something more sophisticated.
- Overrides:
- intersects in class AbstractFigure
- Parameters:
box - the Rectangular area- Returns:
- boolean value of
true if the receiver intersects the
specified Rectangular area;
false otherwise. - See Also:
#bounds
paintFilled
public void paintFilled(java.awt.Graphics g)
- Paint the receiver, filling all the contained area.
- Overrides:
- paintFilled in class FilledShape
- Parameters:
g - the specified Graphics window
paintStrokes
public void paintStrokes(java.awt.Graphics g)
- Paint the outline of the receiver.
- Overrides:
- paintStrokes in class FilledShape
- Parameters:
g - the specified Graphics window