Package org.eclipse.gef.geometry.planar
Class CurvedPolygon
- java.lang.Object
-
- org.eclipse.gef.geometry.planar.CurvedPolygon
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,IGeometry,IRotatable<CurvedPolygon>,IScalable<CurvedPolygon>,IShape,ITranslatable<CurvedPolygon>
public class CurvedPolygon extends java.lang.Object implements IShape, ITranslatable<CurvedPolygon>, IRotatable<CurvedPolygon>, IScalable<CurvedPolygon>
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CurvedPolygon(java.util.List<BezierCurve> curvedSides)Constructs a newCurvedPolygonfrom the given list ofBezierCurves.CurvedPolygon(BezierCurve... curvedSides)Constructs a newCurvedPolygonfrom the givenBezierCurves.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Overridden with public visibility as recommended withinCloneable.booleancontains(IGeometry g)booleancontains(Point p)booleanequals(java.lang.Object o)RectanglegetBounds()PointgetCenter()Returns an approximated centerPointof thisCurvedPolygon.CurvedPolygongetCopy()Returns a new identical copy of thisIGeometry.PolyBeziergetOutline()BezierCurve[]getOutlineSegments()CurvedPolygongetRotatedCCW(Angle angle)CurvedPolygongetRotatedCCW(Angle angle, double cx, double cy)CurvedPolygongetRotatedCCW(Angle angle, Point center)CurvedPolygongetRotatedCW(Angle angle)CurvedPolygongetRotatedCW(Angle angle, double cx, double cy)CurvedPolygongetRotatedCW(Angle angle, Point center)CurvedPolygongetScaled(double factor)Scales a copy of the calling object by the given factor relative to its centerPoint.CurvedPolygongetScaled(double fx, double fy)Scales a copy of the calling object by the given factors relative to its centerPoint.CurvedPolygongetScaled(double factor, double cx, double cy)Scales a copy of the calling object by the given factor relative to the given centerPoint(cx, cy).CurvedPolygongetScaled(double fx, double fy, double cx, double cy)Scales a copy of the calling object by the given factors relative to the given centerPoint(cx, cy).CurvedPolygongetScaled(double fx, double fy, Point center)Scales a copy of the calling object by the given factors relative to the given centerPoint.CurvedPolygongetScaled(double factor, Point center)Scales a copy of the calling object by the given factor relative to the given centerPoint.CurvedPolygongetTransformed(AffineTransform t)CurvedPolygongetTranslated(double dx, double dy)Translates a copy of this object by the given values in x and y direction.CurvedPolygongetTranslated(Point d)Translates a copy of this object by the givenPoint.inthashCode()CurvedPolygonrotateCCW(Angle angle)Rotates thisCurvedPolygoncounter-clockwise (CCW) by the givenAnglearound the centerPointof thisCurvedPolygon.CurvedPolygonrotateCCW(Angle angle, double cx, double cy)Rotates thisCurvedPolygoncounter-clockwise (CCW) by the givenAnglearound thePointspecified by the given x and y coordinates.CurvedPolygonrotateCCW(Angle angle, Point center)CurvedPolygonrotateCW(Angle angle)Rotates thisCurvedPolygoncounter-clockwise (CCW) by the givenAnglearound the centerPointof thisCurvedPolygon.CurvedPolygonrotateCW(Angle angle, double cx, double cy)Rotates thisCurvedPolygonclockwise (CW) by the givenAnglearound thePointspecified by the given x and y coordinates.CurvedPolygonrotateCW(Angle angle, Point center)CurvedPolygonscale(double factor)Scales the calling object by the given factor relative to its centerPoint.CurvedPolygonscale(double fx, double fy)Scales the calling object by the given factors relative to the given centerPoint.CurvedPolygonscale(double factor, double cx, double cy)Scales the calling object by the given factor relative to the given centerPoint(cx, cy).CurvedPolygonscale(double fx, double fy, double cx, double cy)Scales the calling object by the given factors relative to the given centerPoint(cx, cy).CurvedPolygonscale(double fx, double fy, Point center)Scales the calling object by the given factors relative to the given centerPoint.CurvedPolygonscale(double factor, Point center)Scales the calling object by the given factor relative to the given centerPoint.PathtoPath()java.lang.StringtoString()booleantouches(IGeometry g)CurvedPolygontranslate(double dx, double dy)Translates the object by the given values in x and y direction.CurvedPolygontranslate(Point d)Translates the object by the givenPoint.
-
-
-
Constructor Detail
-
CurvedPolygon
public CurvedPolygon(BezierCurve... curvedSides)
Constructs a newCurvedPolygonfrom the givenBezierCurves. SubsequentBezierCurves need to be connected with each other and the closing segment has to be supplied, too, otherwise anIllegalArgumentExceptionis thrown.- Parameters:
curvedSides- theBezierCurves representing the edges of the newCurvedPolygon
-
CurvedPolygon
public CurvedPolygon(java.util.List<BezierCurve> curvedSides)
Constructs a newCurvedPolygonfrom the given list ofBezierCurves. SubsequentBezierCurves need to be connected with each other and the closing segment has to be supplied, too, otherwise anIllegalArgumentExceptionis thrown.- Parameters:
curvedSides- theBezierCurves representing the edges of the newCurvedPolygon- See Also:
CurvedPolygon(BezierCurve...)
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
getCenter
public Point getCenter()
Returns an approximated centerPointof thisCurvedPolygon.- Returns:
- an approximated center
Pointof thisCurvedPolygon
-
getCopy
public CurvedPolygon getCopy()
Description copied from interface:IGeometryReturns a new identical copy of thisIGeometry.
-
getOutline
public PolyBezier getOutline()
Description copied from interface:IShape- Specified by:
getOutlinein interfaceIShape- Returns:
- An
ICurverepresenting thisIShape's outline.
-
getOutlineSegments
public BezierCurve[] getOutlineSegments()
Description copied from interface:IShape- Specified by:
getOutlineSegmentsin interfaceIShape- Returns:
- The
ICurvesegments of thisIShape's outline.
-
getRotatedCCW
public CurvedPolygon getRotatedCCW(Angle angle)
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<CurvedPolygon>- Parameters:
angle- rotationAngle- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getRotatedCCW
public CurvedPolygon getRotatedCCW(Angle angle, double cx, double cy)
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<CurvedPolygon>- 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
public CurvedPolygon getRotatedCCW(Angle angle, Point center)
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<CurvedPolygon>- Parameters:
angle- rotationAnglecenter- relativePointfor the rotation- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getRotatedCW
public CurvedPolygon getRotatedCW(Angle angle)
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<CurvedPolygon>- Parameters:
angle- rotationAngle- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getRotatedCW
public CurvedPolygon getRotatedCW(Angle angle, double cx, double cy)
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<CurvedPolygon>- 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
public CurvedPolygon getRotatedCW(Angle angle, Point center)
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<CurvedPolygon>- Parameters:
angle- rotationAnglecenter- relativePointfor the rotation- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getScaled
public CurvedPolygon getScaled(double factor)
Description copied from interface:IScalableScales a copy of the calling object by the given factor relative to its centerPoint.- Specified by:
getScaledin interfaceIScalable<CurvedPolygon>- Parameters:
factor- scale-factor- Returns:
- the new, scaled object
-
getScaled
public CurvedPolygon getScaled(double fx, double fy)
Description copied from interface:IScalableScales a copy of the calling object by the given factors relative to its centerPoint.- Specified by:
getScaledin interfaceIScalable<CurvedPolygon>- Parameters:
fx- x-scale-factorfy- y-scale-factor- Returns:
- the new, scaled object
-
getScaled
public CurvedPolygon getScaled(double factor, double cx, double cy)
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<CurvedPolygon>- Parameters:
factor- scale-factorcx- x-coordinate of the relativePointfor the scalingcy- y-coordinate of the relativePointfor the scaling- Returns:
- the new, scaled object
-
getScaled
public CurvedPolygon getScaled(double fx, double fy, double cx, double cy)
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<CurvedPolygon>- Parameters:
fx- x-scale-factorfy- y-scale-factorcx- x-coordinate of the relativePointfor the scalingcy- y-coordinate of the relativePointfor the scaling- Returns:
- the new, scaled object
-
getScaled
public CurvedPolygon getScaled(double fx, double fy, Point center)
Description copied from interface:IScalableScales a copy of the calling object by the given factors relative to the given centerPoint.- Specified by:
getScaledin interfaceIScalable<CurvedPolygon>- Parameters:
fx- x-scale-factorfy- y-scale-factorcenter- relativePointfor the scaling- Returns:
- the new, scaled object
-
getScaled
public CurvedPolygon getScaled(double factor, Point center)
Description copied from interface:IScalableScales a copy of the calling object by the given factor relative to the given centerPoint.- Specified by:
getScaledin interfaceIScalable<CurvedPolygon>- Parameters:
factor- scale-factorcenter- relativePointfor the scaling- Returns:
- the new, scaled object
-
getTransformed
public CurvedPolygon getTransformed(AffineTransform t)
Default implementation returning a transformedPathrepresentation of thisIGeometry. Subclasses may override this method to return a more specific representation.- Specified by:
getTransformedin interfaceIGeometry- Specified by:
getTransformedin interfaceIShape- Parameters:
t- TheAffineTransformto be applied- Returns:
- a transformed
Pathrepresentation of thisIGeometry - See Also:
IGeometry.getTransformed(AffineTransform)
-
getTranslated
public CurvedPolygon getTranslated(double dx, double dy)
Description copied from interface:ITranslatableTranslates a copy of this object by the given values in x and y direction.- Specified by:
getTranslatedin interfaceITranslatable<CurvedPolygon>- Parameters:
dx- x-translationdy- y-translation- Returns:
- a new, translated object
-
getTranslated
public CurvedPolygon getTranslated(Point d)
Description copied from interface:ITranslatableTranslates a copy of this object by the givenPoint.- Specified by:
getTranslatedin interfaceITranslatable<CurvedPolygon>- Parameters:
d- translationPoint- Returns:
- a new, translated object
-
rotateCCW
public CurvedPolygon rotateCCW(Angle angle)
Rotates thisCurvedPolygoncounter-clockwise (CCW) by the givenAnglearound the centerPointof thisCurvedPolygon.- Parameters:
angle- the rotationAngle- Returns:
thisfor convenience
-
rotateCCW
public CurvedPolygon rotateCCW(Angle angle, double cx, double cy)
Rotates thisCurvedPolygoncounter-clockwise (CCW) by the givenAnglearound thePointspecified by the given x and y coordinates.
-
rotateCCW
public CurvedPolygon rotateCCW(Angle angle, Point center)
-
rotateCW
public CurvedPolygon rotateCW(Angle angle)
Rotates thisCurvedPolygoncounter-clockwise (CCW) by the givenAnglearound the centerPointof thisCurvedPolygon.- Parameters:
angle- the rotationAngle- Returns:
thisfor convenience
-
rotateCW
public CurvedPolygon rotateCW(Angle angle, double cx, double cy)
Rotates thisCurvedPolygonclockwise (CW) by the givenAnglearound thePointspecified by the given x and y coordinates.
-
rotateCW
public CurvedPolygon rotateCW(Angle angle, Point center)
-
scale
public CurvedPolygon scale(double factor)
Description copied from interface:IScalableScales the calling object by the given factor relative to its centerPoint.- Specified by:
scalein interfaceIScalable<CurvedPolygon>- Parameters:
factor- scale-factor- Returns:
thisfor convenience
-
scale
public CurvedPolygon scale(double fx, double fy)
Description copied from interface:IScalableScales the calling object by the given factors relative to the given centerPoint.- Specified by:
scalein interfaceIScalable<CurvedPolygon>- Parameters:
fx- x-scale-factorfy- y-scale-factor- Returns:
thisfor convenience
-
scale
public CurvedPolygon scale(double factor, double cx, double cy)
Description copied from interface:IScalableScales the calling object by the given factor relative to the given centerPoint(cx, cy).- Specified by:
scalein interfaceIScalable<CurvedPolygon>- Parameters:
factor- scale-factorcx- x-coordinate of the relativePointfor the scalingcy- y-coordinate of the relativePointfor the scaling- Returns:
thisfor convenience
-
scale
public CurvedPolygon scale(double fx, double fy, double cx, double cy)
Description copied from interface:IScalableScales the calling object by the given factors relative to the given centerPoint(cx, cy).- Specified by:
scalein interfaceIScalable<CurvedPolygon>- 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
public CurvedPolygon scale(double fx, double fy, Point center)
Description copied from interface:IScalableScales the calling object by the given factors relative to the given centerPoint.- Specified by:
scalein interfaceIScalable<CurvedPolygon>- Parameters:
fx- x-scale-factorfy- y-scale-factorcenter- relativePointfor the scaling- Returns:
thisfor convenience
-
scale
public CurvedPolygon scale(double factor, Point center)
Description copied from interface:IScalableScales the calling object by the given factor relative to the given centerPoint.- Specified by:
scalein interfaceIScalable<CurvedPolygon>- Parameters:
factor- scale-factorcenter- relativePointfor the scaling- Returns:
thisfor convenience
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
translate
public CurvedPolygon translate(double dx, double dy)
Description copied from interface:ITranslatableTranslates the object by the given values in x and y direction.- Specified by:
translatein interfaceITranslatable<CurvedPolygon>- Parameters:
dx- x-translationdy- y-translation- Returns:
thisfor convenience
-
translate
public CurvedPolygon translate(Point d)
Description copied from interface:ITranslatableTranslates the object by the givenPoint.- Specified by:
translatein interfaceITranslatable<CurvedPolygon>- Parameters:
d- translationPoint- Returns:
thisfor convenience
-
clone
public java.lang.Object clone()
Overridden with public visibility as recommended withinCloneable.- Overrides:
clonein classjava.lang.Object
-
hashCode
public final int hashCode()
- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
-