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 newCurvedPolygon
from the given list ofBezierCurve
s.CurvedPolygon(BezierCurve... curvedSides)
Constructs a newCurvedPolygon
from the givenBezierCurve
s.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
Overridden with public visibility as recommended withinCloneable
.boolean
contains(IGeometry g)
boolean
contains(Point p)
boolean
equals(java.lang.Object o)
Rectangle
getBounds()
Point
getCenter()
Returns an approximated centerPoint
of thisCurvedPolygon
.CurvedPolygon
getCopy()
Returns a new identical copy of thisIGeometry
.PolyBezier
getOutline()
BezierCurve[]
getOutlineSegments()
CurvedPolygon
getRotatedCCW(Angle angle)
CurvedPolygon
getRotatedCCW(Angle angle, double cx, double cy)
CurvedPolygon
getRotatedCCW(Angle angle, Point center)
CurvedPolygon
getRotatedCW(Angle angle)
CurvedPolygon
getRotatedCW(Angle angle, double cx, double cy)
CurvedPolygon
getRotatedCW(Angle angle, Point center)
CurvedPolygon
getScaled(double factor)
Scales a copy of the calling object by the given factor relative to its centerPoint
.CurvedPolygon
getScaled(double fx, double fy)
Scales a copy of the calling object by the given factors relative to its centerPoint
.CurvedPolygon
getScaled(double factor, double cx, double cy)
Scales a copy of the calling object by the given factor relative to the given centerPoint
(cx, cy).CurvedPolygon
getScaled(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).CurvedPolygon
getScaled(double fx, double fy, Point center)
Scales a copy of the calling object by the given factors relative to the given centerPoint
.CurvedPolygon
getScaled(double factor, Point center)
Scales a copy of the calling object by the given factor relative to the given centerPoint
.CurvedPolygon
getTransformed(AffineTransform t)
CurvedPolygon
getTranslated(double dx, double dy)
Translates a copy of this object by the given values in x and y direction.CurvedPolygon
getTranslated(Point d)
Translates a copy of this object by the givenPoint
.int
hashCode()
CurvedPolygon
rotateCCW(Angle angle)
Rotates thisCurvedPolygon
counter-clockwise (CCW) by the givenAngle
around the centerPoint
of thisCurvedPolygon
.CurvedPolygon
rotateCCW(Angle angle, double cx, double cy)
Rotates thisCurvedPolygon
counter-clockwise (CCW) by the givenAngle
around thePoint
specified by the given x and y coordinates.CurvedPolygon
rotateCCW(Angle angle, Point center)
CurvedPolygon
rotateCW(Angle angle)
Rotates thisCurvedPolygon
counter-clockwise (CCW) by the givenAngle
around the centerPoint
of thisCurvedPolygon
.CurvedPolygon
rotateCW(Angle angle, double cx, double cy)
Rotates thisCurvedPolygon
clockwise (CW) by the givenAngle
around thePoint
specified by the given x and y coordinates.CurvedPolygon
rotateCW(Angle angle, Point center)
CurvedPolygon
scale(double factor)
Scales the calling object by the given factor relative to its centerPoint
.CurvedPolygon
scale(double fx, double fy)
Scales the calling object by the given factors relative to the given centerPoint
.CurvedPolygon
scale(double factor, double cx, double cy)
Scales the calling object by the given factor relative to the given centerPoint
(cx, cy).CurvedPolygon
scale(double fx, double fy, double cx, double cy)
Scales the calling object by the given factors relative to the given centerPoint
(cx, cy).CurvedPolygon
scale(double fx, double fy, Point center)
Scales the calling object by the given factors relative to the given centerPoint
.CurvedPolygon
scale(double factor, Point center)
Scales the calling object by the given factor relative to the given centerPoint
.Path
toPath()
java.lang.String
toString()
boolean
touches(IGeometry g)
CurvedPolygon
translate(double dx, double dy)
Translates the object by the given values in x and y direction.CurvedPolygon
translate(Point d)
Translates the object by the givenPoint
.
-
-
-
Constructor Detail
-
CurvedPolygon
public CurvedPolygon(BezierCurve... curvedSides)
Constructs a newCurvedPolygon
from the givenBezierCurve
s. SubsequentBezierCurve
s need to be connected with each other and the closing segment has to be supplied, too, otherwise anIllegalArgumentException
is thrown.- Parameters:
curvedSides
- theBezierCurve
s representing the edges of the newCurvedPolygon
-
CurvedPolygon
public CurvedPolygon(java.util.List<BezierCurve> curvedSides)
Constructs a newCurvedPolygon
from the given list ofBezierCurve
s. SubsequentBezierCurve
s need to be connected with each other and the closing segment has to be supplied, too, otherwise anIllegalArgumentException
is thrown.- Parameters:
curvedSides
- theBezierCurve
s representing the edges of the newCurvedPolygon
- See Also:
CurvedPolygon(BezierCurve...)
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
getCenter
public Point getCenter()
Returns an approximated centerPoint
of thisCurvedPolygon
.- Returns:
- an approximated center
Point
of thisCurvedPolygon
-
getCopy
public CurvedPolygon getCopy()
Description copied from interface:IGeometry
Returns a new identical copy of thisIGeometry
.
-
getOutline
public PolyBezier getOutline()
Description copied from interface:IShape
- Specified by:
getOutline
in interfaceIShape
- Returns:
- An
ICurve
representing thisIShape
's outline.
-
getOutlineSegments
public BezierCurve[] getOutlineSegments()
Description copied from interface:IShape
- Specified by:
getOutlineSegments
in interfaceIShape
- Returns:
- The
ICurve
segments of thisIShape
's outline.
-
getRotatedCCW
public CurvedPolygon getRotatedCCW(Angle angle)
Description copied from interface:IRotatable
Rotates the calling object by specifiedAngle
counter-clock-wise (CCW) around its centerPoint
. Does not necessarily return an object of the same type.- Specified by:
getRotatedCCW
in interfaceIRotatable<CurvedPolygon>
- Parameters:
angle
- rotationAngle
- Returns:
- an
IGeometry
representing the result of the rotation
-
getRotatedCCW
public CurvedPolygon getRotatedCCW(Angle angle, double cx, double cy)
Description copied from interface:IRotatable
Rotates the calling object by the specifiedAngle
counter-clock-wise (CCW) around the specified centerPoint
(cx, cy). Does not necessarily return an object of the same type.- Specified by:
getRotatedCCW
in interfaceIRotatable<CurvedPolygon>
- Parameters:
angle
- rotationAngle
cx
- x-coordinate of the relativePoint
for the rotationcy
- y-coordinate of the relativePoint
for the rotation- Returns:
- an
IGeometry
representing the result of the rotation
-
getRotatedCCW
public CurvedPolygon getRotatedCCW(Angle angle, Point center)
Description copied from interface:IRotatable
Rotates the calling object by the specifiedAngle
counter-clock-wise (CCW) around the specified centerPoint
. Does not necessarily return an object of the same type.- Specified by:
getRotatedCCW
in interfaceIRotatable<CurvedPolygon>
- Parameters:
angle
- rotationAngle
center
- relativePoint
for the rotation- Returns:
- an
IGeometry
representing the result of the rotation
-
getRotatedCW
public CurvedPolygon getRotatedCW(Angle angle)
Description copied from interface:IRotatable
Rotates the calling object by specifiedAngle
clock-wise (CW) around its centerPoint
. Does not necessarily return an object of the same type.- Specified by:
getRotatedCW
in interfaceIRotatable<CurvedPolygon>
- Parameters:
angle
- rotationAngle
- Returns:
- an
IGeometry
representing the result of the rotation
-
getRotatedCW
public CurvedPolygon getRotatedCW(Angle angle, double cx, double cy)
Description copied from interface:IRotatable
Rotates the calling object by the specifiedAngle
clock-wise (CW) around the specified centerPoint
(cx, cy). Does not necessarily return an object of the same type.- Specified by:
getRotatedCW
in interfaceIRotatable<CurvedPolygon>
- Parameters:
angle
- rotationAngle
cx
- x-coordinate of the relativePoint
for the rotationcy
- y-coordinate of the relativePoint
for the rotation- Returns:
- an
IGeometry
representing the result of the rotation
-
getRotatedCW
public CurvedPolygon getRotatedCW(Angle angle, Point center)
Description copied from interface:IRotatable
Rotates the calling object by the specifiedAngle
clock-wise (CW) around the specified centerPoint
. Does not necessarily return an object of the same type.- Specified by:
getRotatedCW
in interfaceIRotatable<CurvedPolygon>
- Parameters:
angle
- rotationAngle
center
- relativePoint
for the rotation- Returns:
- an
IGeometry
representing the result of the rotation
-
getScaled
public CurvedPolygon getScaled(double factor)
Description copied from interface:IScalable
Scales a copy of the calling object by the given factor relative to its centerPoint
.- Specified by:
getScaled
in interfaceIScalable<CurvedPolygon>
- Parameters:
factor
- scale-factor- Returns:
- the new, scaled object
-
getScaled
public CurvedPolygon getScaled(double fx, double fy)
Description copied from interface:IScalable
Scales a copy of the calling object by the given factors relative to its centerPoint
.- Specified by:
getScaled
in 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:IScalable
Scales a copy of the calling object by the given factor relative to the given centerPoint
(cx, cy).- Specified by:
getScaled
in interfaceIScalable<CurvedPolygon>
- Parameters:
factor
- scale-factorcx
- x-coordinate of the relativePoint
for the scalingcy
- y-coordinate of the relativePoint
for the scaling- Returns:
- the new, scaled object
-
getScaled
public CurvedPolygon getScaled(double fx, double fy, double cx, double cy)
Description copied from interface:IScalable
Scales a copy of the calling object by the given factors relative to the given centerPoint
(cx, cy).- Specified by:
getScaled
in interfaceIScalable<CurvedPolygon>
- Parameters:
fx
- x-scale-factorfy
- y-scale-factorcx
- x-coordinate of the relativePoint
for the scalingcy
- y-coordinate of the relativePoint
for the scaling- Returns:
- the new, scaled object
-
getScaled
public CurvedPolygon getScaled(double fx, double fy, Point center)
Description copied from interface:IScalable
Scales a copy of the calling object by the given factors relative to the given centerPoint
.- Specified by:
getScaled
in interfaceIScalable<CurvedPolygon>
- Parameters:
fx
- x-scale-factorfy
- y-scale-factorcenter
- relativePoint
for the scaling- Returns:
- the new, scaled object
-
getScaled
public CurvedPolygon getScaled(double factor, Point center)
Description copied from interface:IScalable
Scales a copy of the calling object by the given factor relative to the given centerPoint
.- Specified by:
getScaled
in interfaceIScalable<CurvedPolygon>
- Parameters:
factor
- scale-factorcenter
- relativePoint
for the scaling- Returns:
- the new, scaled object
-
getTransformed
public CurvedPolygon getTransformed(AffineTransform t)
Default implementation returning a transformedPath
representation of thisIGeometry
. Subclasses may override this method to return a more specific representation.- Specified by:
getTransformed
in interfaceIGeometry
- Specified by:
getTransformed
in interfaceIShape
- Parameters:
t
- TheAffineTransform
to be applied- Returns:
- a transformed
Path
representation of thisIGeometry
- See Also:
IGeometry.getTransformed(AffineTransform)
-
getTranslated
public CurvedPolygon getTranslated(double dx, double dy)
Description copied from interface:ITranslatable
Translates a copy of this object by the given values in x and y direction.- Specified by:
getTranslated
in interfaceITranslatable<CurvedPolygon>
- Parameters:
dx
- x-translationdy
- y-translation- Returns:
- a new, translated object
-
getTranslated
public CurvedPolygon getTranslated(Point d)
Description copied from interface:ITranslatable
Translates a copy of this object by the givenPoint
.- Specified by:
getTranslated
in interfaceITranslatable<CurvedPolygon>
- Parameters:
d
- translationPoint
- Returns:
- a new, translated object
-
rotateCCW
public CurvedPolygon rotateCCW(Angle angle)
Rotates thisCurvedPolygon
counter-clockwise (CCW) by the givenAngle
around the centerPoint
of thisCurvedPolygon
.- Parameters:
angle
- the rotationAngle
- Returns:
this
for convenience
-
rotateCCW
public CurvedPolygon rotateCCW(Angle angle, double cx, double cy)
Rotates thisCurvedPolygon
counter-clockwise (CCW) by the givenAngle
around thePoint
specified by the given x and y coordinates.
-
rotateCCW
public CurvedPolygon rotateCCW(Angle angle, Point center)
-
rotateCW
public CurvedPolygon rotateCW(Angle angle)
Rotates thisCurvedPolygon
counter-clockwise (CCW) by the givenAngle
around the centerPoint
of thisCurvedPolygon
.- Parameters:
angle
- the rotationAngle
- Returns:
this
for convenience
-
rotateCW
public CurvedPolygon rotateCW(Angle angle, double cx, double cy)
Rotates thisCurvedPolygon
clockwise (CW) by the givenAngle
around thePoint
specified 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:IScalable
Scales the calling object by the given factor relative to its centerPoint
.- Specified by:
scale
in interfaceIScalable<CurvedPolygon>
- Parameters:
factor
- scale-factor- Returns:
this
for convenience
-
scale
public CurvedPolygon scale(double fx, double fy)
Description copied from interface:IScalable
Scales the calling object by the given factors relative to the given centerPoint
.- Specified by:
scale
in interfaceIScalable<CurvedPolygon>
- Parameters:
fx
- x-scale-factorfy
- y-scale-factor- Returns:
this
for convenience
-
scale
public CurvedPolygon scale(double factor, double cx, double cy)
Description copied from interface:IScalable
Scales the calling object by the given factor relative to the given centerPoint
(cx, cy).- Specified by:
scale
in interfaceIScalable<CurvedPolygon>
- Parameters:
factor
- scale-factorcx
- x-coordinate of the relativePoint
for the scalingcy
- y-coordinate of the relativePoint
for the scaling- Returns:
this
for convenience
-
scale
public CurvedPolygon scale(double fx, double fy, double cx, double cy)
Description copied from interface:IScalable
Scales the calling object by the given factors relative to the given centerPoint
(cx, cy).- Specified by:
scale
in interfaceIScalable<CurvedPolygon>
- Parameters:
fx
- x-scale-factorfy
- y-scale-factorcx
- x-coordinate of the relativePoint
for the scalingcy
- y-coordinate of the relativePoint
for the scaling- Returns:
this
for convenience
-
scale
public CurvedPolygon scale(double fx, double fy, Point center)
Description copied from interface:IScalable
Scales the calling object by the given factors relative to the given centerPoint
.- Specified by:
scale
in interfaceIScalable<CurvedPolygon>
- Parameters:
fx
- x-scale-factorfy
- y-scale-factorcenter
- relativePoint
for the scaling- Returns:
this
for convenience
-
scale
public CurvedPolygon scale(double factor, Point center)
Description copied from interface:IScalable
Scales the calling object by the given factor relative to the given centerPoint
.- Specified by:
scale
in interfaceIScalable<CurvedPolygon>
- Parameters:
factor
- scale-factorcenter
- relativePoint
for the scaling- Returns:
this
for convenience
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
translate
public CurvedPolygon translate(double dx, double dy)
Description copied from interface:ITranslatable
Translates the object by the given values in x and y direction.- Specified by:
translate
in interfaceITranslatable<CurvedPolygon>
- Parameters:
dx
- x-translationdy
- y-translation- Returns:
this
for convenience
-
translate
public CurvedPolygon translate(Point d)
Description copied from interface:ITranslatable
Translates the object by the givenPoint
.- Specified by:
translate
in interfaceITranslatable<CurvedPolygon>
- Parameters:
d
- translationPoint
- Returns:
this
for convenience
-
clone
public java.lang.Object clone()
Overridden with public visibility as recommended withinCloneable
.- Overrides:
clone
in classjava.lang.Object
-
hashCode
public final int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
-