Package edu.macalester.graphics
Class Arc
java.lang.Object
edu.macalester.graphics.GraphicsObject
edu.macalester.graphics.Arc
- All Implemented Interfaces:
Strokable
A partial section of an ellipse.
-
Constructor Summary
ConstructorDescriptionArc
(double x, double y, double width, double height, double startAngle, double sweepAngle) This is an arc, based on Java's Arc2D.Double, which Java describes as follows: The arc is a partial section of a full ellipse which inscribes the framing rectangle of its parent RectangularShape. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
For internal use.Returns the bounding box of this graphics object in its local coordinates.protected Object
For internal use only.Returns the color to strokeColor that will be used to stroke this shape if it is stroked.double
Returns the thickness of the stroke in pixels.boolean
Returns true if the interior of this shape will be stroked with the stroke color.void
setStrokeColor
(Paint strokeColor) Sets the stroke color to the given color.void
setStroked
(boolean stroked) Causes the shape to be stroked with the stroke color when it is drawn.void
setStrokeWidth
(double width) Sets how thick the stroke is.boolean
testHitInLocalCoordinates
(double x, double y) Tests whether the given point is inside the boundary or interior of this object’s shape.Methods inherited from class edu.macalester.graphics.GraphicsObject
addObserver, changed, equals, getAnchor, getBoundsInParent, getCanvas, getCenter, getElementAt, getElementAtLocalCoordinates, getEmbeddedComponent, getHeight, getPosition, getRotation, getScale, getScaleX, getScaleY, getSize, getSizeInParent, getWidth, getX, getY, hashCode, isInBounds, moveBy, moveBy, removeObserver, renderToBuffer, rotateBy, setAnchor, setAnchor, setCenter, setCenter, setPosition, setPosition, setRotation, setScale, setScale, setScale, setX, setY, testHit
-
Constructor Details
-
Arc
public Arc(double x, double y, double width, double height, double startAngle, double sweepAngle) This is an arc, based on Java's Arc2D.Double, which Java describes as follows:The arc is a partial section of a full ellipse which inscribes the framing rectangle of its parent RectangularShape. The angles are specified relative to the non-square framing rectangle such that 45 degrees always falls on the line from the center of the ellipse to the upper right corner of the framing rectangle. As a result, if the framing rectangle is noticeably longer along one axis than the other, the angles to the start and end of the arc segment will be skewed farther along the longer axis of the frame. Note that 0 degrees is the positive x axis along the center of the ellipse, making the 90 degree point on a line from the center of the ellipse to the top center point of the upper arc of the ellipse.
- Parameters:
sweepAngle
- angle to sweep around from the starting angle, e.g. 180 would create a 1/2 ellipse
-
-
Method Details
-
drawInLocalCoordinates
Description copied from class:GraphicsObject
For internal use. Draws this graphics object on the screen in its local coordinates, without rotation or scaling.- Specified by:
drawInLocalCoordinates
in classGraphicsObject
-
getStrokeColor
Description copied from interface:Strokable
Returns the color to strokeColor that will be used to stroke this shape if it is stroked. Note that there will still be no stroke if isStroked() is false or the stroke width is zero.- Specified by:
getStrokeColor
in interfaceStrokable
-
setStrokeColor
Description copied from interface:Strokable
Sets the stroke color to the given color. Automatically calls setStroked(true).- Specified by:
setStrokeColor
in interfaceStrokable
-
getStrokeWidth
public double getStrokeWidth()Description copied from interface:Strokable
Returns the thickness of the stroke in pixels.- Specified by:
getStrokeWidth
in interfaceStrokable
-
setStrokeWidth
public void setStrokeWidth(double width) Description copied from interface:Strokable
Sets how thick the stroke is. Automatically calls setStroked(true).- Specified by:
setStrokeWidth
in interfaceStrokable
-
isStroked
public boolean isStroked()Description copied from interface:Strokable
Returns true if the interior of this shape will be stroked with the stroke color. -
setStroked
public void setStroked(boolean stroked) Description copied from interface:Strokable
Causes the shape to be stroked with the stroke color when it is drawn.- Specified by:
setStroked
in interfaceStrokable
-
testHitInLocalCoordinates
public boolean testHitInLocalCoordinates(double x, double y) Description copied from class:GraphicsObject
Tests whether the given point is inside the boundary or interior of this object’s shape. The point is in this object’s local coordinates.- Specified by:
testHitInLocalCoordinates
in classGraphicsObject
-
getBounds
Description copied from class:GraphicsObject
Returns the bounding box of this graphics object in its local coordinates.- Specified by:
getBounds
in classGraphicsObject
-
getEqualityAttributes
Description copied from class:GraphicsObject
For internal use only. Used to compute equals() and hashCode(). Returns an object whose equals() and hashCode() methods encompass the subclass-specific values that should be used to compute equality for the whole GraphicsObject.- Specified by:
getEqualityAttributes
in classGraphicsObject
-