Package org.eclipse.gef.geometry.planar
Class Arc
java.lang.Object
org.eclipse.gef.geometry.planar.Arc
- All Implemented Interfaces:
Serializable,Cloneable,ICurve,IGeometry,IRotatable<PolyBezier>,IScalable<Arc>,ITranslatable<Arc>
Represents the geometric shape of an
Arc, which is defined by its
enclosing framing Rectangle, a start Angle (relative to the
x-axis), and an angular extend in counter-clockwise (CCW) direction.- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Overridden with public visibility as recommended withinCloneable.protected CubicCurve[]Computes aCubicCurveapproximation for thisAbstractArcBasedGeometry.booleanbooleanexpand(double h, double v) Expands the horizontal and vertical sides of thisAbstractRectangleBasedGeometrywith the values provided as input, and returnsthisfor convenience.expand(double left, double top, double right, double bottom) Expands thisAbstractRectangleBasedGeometryby the given amounts, and returns this for convenience.Returns the centerPointof thisAbstractRectangleBasedGeometry.getCopy()Returns a new identical copy of thisIGeometry.getExpanded(double h, double v) Returns a new expandedAbstractRectangleBasedGeometry, where the sides are incremented by the horizontal and vertical values provided.getExpanded(double left, double top, double right, double bottom) Creates and returns a newAbstractRectangleBasedGeometrywith the bounds of thisAbstractRectangleBasedGeometryexpanded by the given insets.final doubleReturns the height of thisAbstractRectangleBasedGeometry.Point[]Returns aPointspecifying the x and y coordinates of thisAbstractRectangleBasedGeometry.ICurve[]getP1()Returns the startPointof thisAbstractArcBasedGeometry.getP2()Returns the endPointof thisAbstractArcBasedGeometry.Computes aPointon thisAbstractArcBasedGeometry.getProjection(Point reference) getRotatedCCW(Angle angle) getRotatedCCW(Angle angle, double cx, double cy) getRotatedCCW(Angle angle, Point center) getRotatedCW(Angle angle) getRotatedCW(Angle angle, double cx, double cy) getRotatedCW(Angle angle, Point center) getScaled(double factor) Scales a copy of the calling object by the given factor relative to its centerPoint.getScaled(double factorX, double factorY) Scales a copy of the calling object by the given factors relative to its centerPoint.getScaled(double factor, double centerX, double centerY) Scales a copy of the calling object by the given factor relative to the given centerPoint(cx, cy).getScaled(double factorX, double factorY, double centerX, double centerY) Scales a copy of the calling object by the given factors relative to the given centerPoint(cx, cy).Scales a copy of the calling object by the given factors relative to the given centerPoint.Scales a copy of the calling object by the given factor relative to the given centerPoint.getShrinked(double h, double v) Returns a newAbstractRectangleBasedGeometry, where the sides are shrinked by the horizontal and vertical values supplied.getShrinked(double left, double top, double right, double bottom) Returns a newAbstractRectangleBasedGeometryshrinked by the specified insets.final DimensiongetSize()Returns aDimensionthat records the width and height of thisAbstractRectangleBasedGeometry.Returns thisAbstractArcBasedGeometry's startAngle.getTranslated(double dx, double dy) Translates a copy of this object by the given values in x and y direction.getTranslated(Point pt) Translates a copy of this object by the givenPoint.final doublegetWidth()Returns the width of thisAbstractRectangleBasedGeometry.final doublegetX()Returns the x coordinate thisAbstractRectangleBasedGeometry.doublegetX1()Returns the x coordinate of the startPointof thisAbstractArcBasedGeometry.doublegetX2()Returns the x coordinate of the endPointof thisAbstractArcBasedGeometry.final doublegetY()Returns the y coordinate of thisAbstractRectangleBasedGeometry.doublegetY1()Returns the y coordinate of the startPointof thisAbstractArcBasedGeometry.doublegetY2()Returns the y coordinate of the endPointof thisAbstractArcBasedGeometry.final inthashCode()booleanintersects(ICurve c) booleanscale(double factor) Scales the calling object by the given factor relative to its centerPoint.scale(double fx, double fy) Scales the calling object by the given factors relative to the given centerPoint.scale(double factor, double cx, double cy) Scales the calling object by the given factor relative to the given centerPoint(cx, cy).scale(double fx, double fy, double cx, double cy) Scales the calling object by the given factors relative to the given centerPoint(cx, cy).Scales the calling object by the given factors relative to the given centerPoint.Scales the calling object by the given factor relative to the given centerPoint.setAngularExtent(Angle angularExtent) Sets the extensionAngleof thisAbstractArcBasedGeometry.final ArcsetBounds(double x, double y, double w, double h) Sets the x, y, width, and height values of thisAbstractRectangleBasedGeometryto the given values.final Arcfinal ArcSets the x and y coordinates and the width and height of thisAbstractRectangleBasedGeometryto the respective values of the givenRectangle.final ArcsetHeight(double height) Sets the height of thisAbstractRectangleBasedGeometryto the given value.final ArcsetLocation(double x, double y) Sets the x and y coordinates of thisAbstractRectangleBasedGeometryto the specified values.final ArcsetLocation(Point p) Sets the x and y coordinates of thisAbstractRectangleBasedGeometryto the respective values of the givenPoint.final ArcsetSize(double w, double h) Sets the width and height of thisAbstractRectangleBasedGeometryto the given values.final ArcSets the width and height of thisAbstractRectangleBasedGeometryto the width and height of the givenDimension.setStartAngle(Angle startAngle) Sets the startAngleof thisAbstractArcBasedGeometry.final ArcsetWidth(double width) Sets the width of thisAbstractRectangleBasedGeometryto the passed-in value.final ArcsetX(double x) Sets the x-coordinate of thisAbstractRectangleBasedGeometryto the given value.final ArcsetY(double y) Sets the y-coordinate of thisAbstractRectangleBasedGeometryto the given value.shrink(double h, double v) Shrinks the sides of thisAbstractRectangleBasedGeometryby the horizontal and vertical values provided as input, and returns thisAbstractRectangleBasedGeometryfor convenience.shrink(double left, double top, double right, double bottom) Shrinks thisAbstractRectangleBasedGeometryby the specified amounts.toBezier()Computes a list ofBezierCurves that approximate theICurve.toPath()toString()booleantranslate(double dx, double dy) Translates the object by the given values in x and y direction.Translates the object by the givenPoint.Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.gef.geometry.planar.ICurve
getP1, getP2, getX1, getX2, getY1, getY2Methods inherited from interface org.eclipse.gef.geometry.planar.IGeometry
getTransformed, toPath, touches
-
Field Details
-
Constructor Details
-
Arc
public Arc(org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?, ?> r, Angle startAngle, Angle angularExtent) Constructs a newArcof the given values. AnArcis cut out of anEllipse. The startAngleis the counter-clockwise (CCW)Angleto the x-axis at which theArcbegins. The angular extent is the CCWAnglethat spans theArc, i.e. the resulting endAngleof theArcis the sum of the startAngleand the angular extent. -
Arc
Constructs a newArcof the given values. AnArcis cut out of anEllipse. The startAngleis the counter-clockwise (CCW)Angleto the x-axis at which theArcbegins. The angular extent is the CCWAnglethat spans theArc, i.e. the resulting endAngleof theArcis the sum of the startAngleand the angular extent.- Parameters:
x- the x coordinate of the bounds of theEllipseof which theArcis cut outy- the y coordinate of the bounds of theEllipseof which theArcis cut outwidth- the width of the bounds of theEllipseof which theArcis cut outheight- the height of the bounds of theEllipseof which theArcis cut outstartAngle- the CCWAngleat which theArcbeginsangularExtent- the CCWAnglethat spans theArc
-
-
Method Details
-
contains
Description copied from interface:IGeometry -
equals
-
getBounds
Description copied from interface:IGeometry -
getCopy
Description copied from interface:IGeometryReturns a new identical copy of thisIGeometry. -
getIntersections
Description copied from interface:ICurve- Specified by:
getIntersectionsin interfaceICurve- Parameters:
c- TheICurveto compute intersection points with.- Returns:
- The points of intersection.
-
getOverlaps
Description copied from interface:ICurve- Specified by:
getOverlapsin interfaceICurve- Parameters:
c- The curve to compute overlaps with.- Returns:
- The segments where both curves overlap.
-
getProjection
Description copied from interface:ICurveReturns a projection of the given referencePointonto thisICurve, i.e. aPointon thisICurvethat is closest to the given referencePoint. Note, that- Specified by:
getProjectionin interfaceICurve- Parameters:
reference- The referencePointfor which to return the projection.- Returns:
- The projection of the given reference
Pointonto thisICurve.
-
getRotatedCCW
Description copied from interface:IRotatableRotates the calling object by specifiedAnglecounter-clock-wise (CCW) around its centerPoint. Does not necessarily return an object of the same type.- Specified by:
getRotatedCCWin interfaceIRotatable<PolyBezier>- Parameters:
angle- rotationAngle- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getRotatedCCW
Description copied from interface:IRotatableRotates the calling object by the specifiedAnglecounter-clock-wise (CCW) around the specified centerPoint(cx, cy). Does not necessarily return an object of the same type.- Specified by:
getRotatedCCWin interfaceIRotatable<PolyBezier>- Parameters:
angle- rotationAnglecx- x-coordinate of the relativePointfor the rotationcy- y-coordinate of the relativePointfor the rotation- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getRotatedCCW
Description copied from interface:IRotatableRotates the calling object by the specifiedAnglecounter-clock-wise (CCW) around the specified centerPoint. Does not necessarily return an object of the same type.- Specified by:
getRotatedCCWin interfaceIRotatable<PolyBezier>- Parameters:
angle- rotationAnglecenter- relativePointfor the rotation- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getRotatedCW
Description copied from interface:IRotatableRotates the calling object by specifiedAngleclock-wise (CW) around its centerPoint. Does not necessarily return an object of the same type.- Specified by:
getRotatedCWin interfaceIRotatable<PolyBezier>- Parameters:
angle- rotationAngle- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getRotatedCW
Description copied from interface:IRotatableRotates the calling object by the specifiedAngleclock-wise (CW) around the specified centerPoint(cx, cy). Does not necessarily return an object of the same type.- Specified by:
getRotatedCWin interfaceIRotatable<PolyBezier>- Parameters:
angle- rotationAnglecx- x-coordinate of the relativePointfor the rotationcy- y-coordinate of the relativePointfor the rotation- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getRotatedCW
Description copied from interface:IRotatableRotates the calling object by the specifiedAngleclock-wise (CW) around the specified centerPoint. Does not necessarily return an object of the same type.- Specified by:
getRotatedCWin interfaceIRotatable<PolyBezier>- Parameters:
angle- rotationAnglecenter- relativePointfor the rotation- Returns:
- an
IGeometryrepresenting the result of the rotation
-
intersects
Description copied from interface:ICurveTests if thisICurveand the givenICurveintersect, i.e. whether a final set of intersection points exists. Two curves intersect if they touch (seeIGeometry.touches(IGeometry)) but do not overlap (seeICurve.overlaps(ICurve)).- Specified by:
intersectsin interfaceICurve- Parameters:
c- TheICurveto test for intersections.- Returns:
trueif they intersect,falseotherwise
-
overlaps
Description copied from interface:ICurveTests if thisICurveand the givenICurveoverlap, i.e. whether an infinite set of intersection points exists. Two curves overlap if they touch (seeIGeometry.touches(IGeometry)) but not intersect (seeICurve.intersects(ICurve)). -
toBezier
Description copied from interface:ICurveComputes a list ofBezierCurves that approximate theICurve. For example, aLineor aBezierCurvein general could return a list with the curve itself as its only element. But anEllipseor anArcmay return a list of consecutiveBezierCurves which approximate theICurve.- Specified by:
toBezierin interfaceICurve- Returns:
- a list of
BezierCurves that approximate theICurve
-
toString
-
computeBezierApproximation
Computes aCubicCurveapproximation for thisAbstractArcBasedGeometry. It is approximated by a maximum of fourCubicCurves, each of which covers a maximum of 90 degrees.- Returns:
- a
CubicCurveapproximation for thisAbstractArcBasedGeometry
-
getAngularExtent
Returns the extensionAngleof thisAbstractArcBasedGeometry, i.e. theAngledefining the span of thisAbstractArcBasedGeometry.- Returns:
- the extension
Angleof thisAbstractArcBasedGeometry
-
getP1
Returns the startPointof thisAbstractArcBasedGeometry.- Returns:
- the start
Pointof thisAbstractArcBasedGeometry
-
getP2
Returns the endPointof thisAbstractArcBasedGeometry.- Returns:
- the end
Pointof thisAbstractArcBasedGeometry
-
getPoint
-
getStartAngle
Returns thisAbstractArcBasedGeometry's startAngle.- Returns:
- this
AbstractArcBasedGeometry's startAngle
-
getX1
public double getX1()Returns the x coordinate of the startPointof thisAbstractArcBasedGeometry.- Returns:
- the x coordinate of the start
Pointof thisAbstractArcBasedGeometry
-
getX2
public double getX2()Returns the x coordinate of the endPointof thisAbstractArcBasedGeometry.- Returns:
- the x coordinate of the end
Pointof thisAbstractArcBasedGeometry
-
getY1
public double getY1()Returns the y coordinate of the startPointof thisAbstractArcBasedGeometry.- Returns:
- the y coordinate of the start
Pointof thisAbstractArcBasedGeometry
-
getY2
public double getY2()Returns the y coordinate of the endPointof thisAbstractArcBasedGeometry.- Returns:
- the y coordinate of the end
Pointof thisAbstractArcBasedGeometry
-
setAngularExtent
Sets the extensionAngleof thisAbstractArcBasedGeometry.- Parameters:
angularExtent- the new extensionAnglefor thisAbstractArcBasedGeometry- Returns:
thisfor convenience
-
setStartAngle
Sets the startAngleof thisAbstractArcBasedGeometry.- Parameters:
startAngle- the new startAnglefor thisAbstractArcBasedGeometry- Returns:
thisfor convenience
-
toPath
Description copied from interface:IGeometry -
expand
Expands the horizontal and vertical sides of thisAbstractRectangleBasedGeometrywith the values provided as input, and returnsthisfor convenience. The location of its center is kept constant.- Parameters:
h- the horizontal incrementv- the vertical increment- Returns:
thisfor convenience
-
expand
Expands thisAbstractRectangleBasedGeometryby the given amounts, and returns this for convenience.- Parameters:
left- the amount to expand the left sidetop- the amount to expand the top sideright- the amount to expand the right sidebottom- the amount to expand the bottom side- Returns:
thisfor convenience
-
getCenter
Returns the centerPointof thisAbstractRectangleBasedGeometry.- Returns:
- the center
Pointof thisAbstractRectangleBasedGeometry
-
getExpanded
Returns a new expandedAbstractRectangleBasedGeometry, where the sides are incremented by the horizontal and vertical values provided. The center of theAbstractRectangleBasedGeometryis maintained constant.- Parameters:
h- The horizontal incrementv- The vertical increment- Returns:
- a new expanded
AbstractRectangleBasedGeometry
-
getExpanded
Creates and returns a newAbstractRectangleBasedGeometrywith the bounds of thisAbstractRectangleBasedGeometryexpanded by the given insets.- Parameters:
left- the amount to expand the left sidetop- the amount to expand the top sideright- the amount to expand the right sidebottom- the amount to expand the bottom side- Returns:
- a new expanded
AbstractRectangleBasedGeometry
-
getHeight
public final double getHeight()Returns the height of thisAbstractRectangleBasedGeometry.- Returns:
- the height of this
AbstractRectangleBasedGeometry
-
getLocation
Returns aPointspecifying the x and y coordinates of thisAbstractRectangleBasedGeometry.- Returns:
- a
Pointrepresenting the x and y coordinates of thisAbstractRectangleBasedGeometry
-
getScaled
Description copied from interface:IScalableScales a copy of the calling object by the given factor relative to its centerPoint. -
getScaled
Description copied from interface:IScalableScales a copy of the calling object by the given factors relative to its centerPoint. -
getScaled
Description copied from interface:IScalableScales a copy of the calling object by the given factor relative to the given centerPoint(cx, cy).- Specified by:
getScaledin interfaceIScalable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,?>> - Parameters:
factor- scale-factorcenterX- x-coordinate of the relativePointfor the scalingcenterY- y-coordinate of the relativePointfor the scaling- Returns:
- the new, scaled object
-
getScaled
Description copied from interface:IScalableScales a copy of the calling object by the given factors relative to the given centerPoint(cx, cy).- Specified by:
getScaledin interfaceIScalable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,?>> - Parameters:
factorX- x-scale-factorfactorY- y-scale-factorcenterX- x-coordinate of the relativePointfor the scalingcenterY- y-coordinate of the relativePointfor the scaling- Returns:
- the new, scaled object
-
getScaled
Description copied from interface:IScalableScales a copy of the calling object by the given factors relative to the given centerPoint. -
getScaled
Description copied from interface:IScalableScales a copy of the calling object by the given factor relative to the given centerPoint. -
getShrinked
Returns a newAbstractRectangleBasedGeometry, where the sides are shrinked by the horizontal and vertical values supplied. The center of thisAbstractRectangleBasedGeometryis kept constant.- Parameters:
h- horizontal reduction amountv- vertical reduction amount- Returns:
- a new, shrinked
AbstractRectangleBasedGeometry
-
getShrinked
Returns a newAbstractRectangleBasedGeometryshrinked by the specified insets.- Parameters:
left- the amount to shrink the left sidetop- the amount to shrink the top sideright- the amount to shrink the right sidebottom- the amount to shrink the bottom side- Returns:
- a new, shrinked
AbstractRectangleBasedGeometry
-
getSize
Returns aDimensionthat records the width and height of thisAbstractRectangleBasedGeometry.- Returns:
- a
Dimensionthat records the width and height of thisAbstractRectangleBasedGeometry
-
getTranslated
Description copied from interface:ITranslatableTranslates a copy of this object by the given values in x and y direction.- Specified by:
getTranslatedin interfaceITranslatable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,?>> - Parameters:
dx- x-translationdy- y-translation- Returns:
- a new, translated object
-
getTranslated
Description copied from interface:ITranslatableTranslates a copy of this object by the givenPoint.- Specified by:
getTranslatedin interfaceITranslatable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,?>> - Parameters:
pt- translationPoint- Returns:
- a new, translated object
-
getWidth
public final double getWidth()Returns the width of thisAbstractRectangleBasedGeometry.- Returns:
- the width of this
AbstractRectangleBasedGeometry
-
getX
public final double getX()Returns the x coordinate thisAbstractRectangleBasedGeometry.- Returns:
- the x coordinate this
AbstractRectangleBasedGeometry
-
getY
public final double getY()Returns the y coordinate of thisAbstractRectangleBasedGeometry.- Returns:
- the y coordinate of this
AbstractRectangleBasedGeometry
-
scale
Description copied from interface:IScalableScales the calling object by the given factor relative to its centerPoint. -
scale
Description copied from interface:IScalableScales the calling object by the given factors relative to the given centerPoint. -
scale
Description copied from interface:IScalableScales the calling object by the given factor relative to the given centerPoint(cx, cy). -
scale
Description copied from interface:IScalableScales the calling object by the given factors relative to the given centerPoint(cx, cy).- Specified by:
scalein interfaceIScalable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,?>> - Parameters:
fx- x-scale-factorfy- y-scale-factorcx- x-coordinate of the relativePointfor the scalingcy- y-coordinate of the relativePointfor the scaling- Returns:
thisfor convenience
-
scale
Description copied from interface:IScalableScales the calling object by the given factors relative to the given centerPoint. -
scale
Description copied from interface:IScalableScales the calling object by the given factor relative to the given centerPoint. -
setBounds
Sets the x, y, width, and height values of thisAbstractRectangleBasedGeometryto the given values.- Parameters:
x- the new x-coordinatey- the new y-coordinatew- the new widthh- the new height- Returns:
thisfor convenience
-
setBounds
-
setBounds
Sets the x and y coordinates and the width and height of thisAbstractRectangleBasedGeometryto the respective values of the givenRectangle.- Parameters:
r- theRectanglespecifying the new x, y, width, and height values of thisAbstractRectangleBasedGeometry- Returns:
thisfor convenience
-
setHeight
Sets the height of thisAbstractRectangleBasedGeometryto the given value.- Parameters:
height- the new height- Returns:
thisfor convenience
-
setLocation
Sets the x and y coordinates of thisAbstractRectangleBasedGeometryto the specified values.- Parameters:
x- the new x coordinate of thisAbstractRectangleBasedGeometryy- the new y coordinate of thisAbstractRectangleBasedGeometry- Returns:
thisfor convenience
-
setLocation
Sets the x and y coordinates of thisAbstractRectangleBasedGeometryto the respective values of the givenPoint.- Parameters:
p- thePointspecifying the new x and y coordinates of thisAbstractRectangleBasedGeometry- Returns:
thisfor convenience
-
setSize
Sets the width and height of thisAbstractRectangleBasedGeometryto the width and height of the givenDimension.- Parameters:
d- theDimensionspecifying the new width and height of thisAbstractRectangleBasedGeometry- Returns:
thisfor convenience
-
setSize
Sets the width and height of thisAbstractRectangleBasedGeometryto the given values.- Parameters:
w- the new width of thisAbstractRectangleBasedGeometryh- the new height of thisAbstractRectangleBasedGeometry- Returns:
thisfor convenience
-
setWidth
Sets the width of thisAbstractRectangleBasedGeometryto the passed-in value.- Parameters:
width- the new width of thisAbstractRectangleBasedGeometry- Returns:
thisfor convenience
-
setX
Sets the x-coordinate of thisAbstractRectangleBasedGeometryto the given value.- Parameters:
x- The new x-coordinate.- Returns:
thisfor convenience.
-
setY
Sets the y-coordinate of thisAbstractRectangleBasedGeometryto the given value.- Parameters:
y- The new y-coordinate.- Returns:
thisfor convenience.
-
shrink
Shrinks the sides of thisAbstractRectangleBasedGeometryby the horizontal and vertical values provided as input, and returns thisAbstractRectangleBasedGeometryfor convenience. The center of thisAbstractRectangleBasedGeometryis kept constant.- Parameters:
h- horizontal reduction amountv- vertical reduction amount- Returns:
thisfor convenience
-
shrink
Shrinks thisAbstractRectangleBasedGeometryby the specified amounts.- Parameters:
left- the amount to shrink the left sidetop- the amount to shrink the top sideright- the amount to shrink the right sidebottom- the amount to shrink the bottom side- Returns:
thisfor convenience
-
translate
Description copied from interface:ITranslatableTranslates the object by the given values in x and y direction.- Specified by:
translatein interfaceITranslatable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,?>> - Parameters:
dx- x-translationdy- y-translation- Returns:
thisfor convenience
-
translate
Description copied from interface:ITranslatableTranslates the object by the givenPoint.- Specified by:
translatein interfaceITranslatable<T extends org.eclipse.gef.geometry.planar.AbstractRectangleBasedGeometry<?,?>> - Parameters:
p- translationPoint- Returns:
thisfor convenience
-
clone
Overridden with public visibility as recommended withinCloneable. -
getTransformed
Default implementation returning a transformedPathrepresentation of thisIGeometry. Subclasses may override this method to return a more specific representation.- Specified by:
getTransformedin interfaceIGeometry- Parameters:
t- TheAffineTransformto be applied- Returns:
- a transformed
Pathrepresentation of thisIGeometry
-
hashCode
public final int hashCode() -
touches
Description copied from interface:IGeometry
-