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
ConstructorsConstructorDescriptionArc(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 voidFor internal use.Returns the bounding box of this graphics object in its local coordinates.protected ObjectFor internal use only.Returns the color to strokeColor that will be used to stroke this shape if it is stroked.doubleReturns the thickness of the stroke in pixels.booleanReturns true if the interior of this shape will be stroked with the stroke color.voidsetStrokeColor(Paint strokeColor) Sets the stroke color to the given color.voidsetStroked(boolean stroked) Causes the shape to be stroked with the stroke color when it is drawn.voidsetStrokeWidth(double width) Sets how thick the stroke is.booleantestHitInLocalCoordinates(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, getParent, 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:GraphicsObjectFor internal use. Draws this graphics object on the screen in its local coordinates, without rotation or scaling.- Specified by:
drawInLocalCoordinatesin classGraphicsObject
-
getStrokeColor
Description copied from interface:StrokableReturns 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:
getStrokeColorin interfaceStrokable
-
setStrokeColor
Description copied from interface:StrokableSets the stroke color to the given color. Automatically calls setStroked(true).- Specified by:
setStrokeColorin interfaceStrokable
-
getStrokeWidth
public double getStrokeWidth()Description copied from interface:StrokableReturns the thickness of the stroke in pixels.- Specified by:
getStrokeWidthin interfaceStrokable
-
setStrokeWidth
public void setStrokeWidth(double width) Description copied from interface:StrokableSets how thick the stroke is. Automatically calls setStroked(true).- Specified by:
setStrokeWidthin interfaceStrokable
-
isStroked
public boolean isStroked()Description copied from interface:StrokableReturns true if the interior of this shape will be stroked with the stroke color. -
setStroked
public void setStroked(boolean stroked) Description copied from interface:StrokableCauses the shape to be stroked with the stroke color when it is drawn.- Specified by:
setStrokedin interfaceStrokable
-
testHitInLocalCoordinates
public boolean testHitInLocalCoordinates(double x, double y) Description copied from class:GraphicsObjectTests 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:
testHitInLocalCoordinatesin classGraphicsObject
-
getBounds
Description copied from class:GraphicsObjectReturns the bounding box of this graphics object in its local coordinates.- Specified by:
getBoundsin classGraphicsObject
-
getEqualityAttributes
Description copied from class:GraphicsObjectFor 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:
getEqualityAttributesin classGraphicsObject
-