Package org.eclipse.gef.geometry.planar
Class Ring
- java.lang.Object
-
- org.eclipse.gef.geometry.planar.Ring
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,IGeometry
,IMultiShape
,IRotatable<Ring>
,IScalable<Ring>
,ITranslatable<Ring>
public class Ring extends java.lang.Object implements ITranslatable<Ring>, IScalable<Ring>, IRotatable<Ring>
A combination of Polygons....- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Ring
add(Polygon p)
java.lang.Object
clone()
Overridden with public visibility as recommended withinCloneable
.boolean
contains(IGeometry g)
Checks if the givenIGeometry
is fully contained by thisIMultiShape
.boolean
contains(Point p)
boolean
equals(java.lang.Object obj)
protected Line[]
getAllEdges()
Collects all edges of the internalIShape
s.Rectangle
getBounds()
Ring
getCopy()
Returns a new identical copy of thisIGeometry
.Polyline[]
getOutlines()
Computes the outlines of thisIMultiShape
.Line[]
getOutlineSegments()
Computes the outline segments of thisAbstractMultiShape
.Ring
getRotatedCCW(Angle angle)
Ring
getRotatedCCW(Angle angle, double cx, double cy)
Ring
getRotatedCCW(Angle angle, Point center)
Ring
getRotatedCW(Angle angle)
Ring
getRotatedCW(Angle angle, double cx, double cy)
Ring
getRotatedCW(Angle angle, Point center)
Ring
getScaled(double factor)
Scales a copy of the calling object by the given factor relative to its centerPoint
.Ring
getScaled(double fx, double fy)
Scales a copy of the calling object by the given factors relative to its centerPoint
.Ring
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).Ring
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).Ring
getScaled(double fx, double fy, Point center)
Scales a copy of the calling object by the given factors relative to the given centerPoint
.Ring
getScaled(double factor, Point center)
Scales a copy of the calling object by the given factor relative to the given centerPoint
.Polygon[]
getShapes()
Returns theIShape
s that constitute thisIMultiShape
.Ring
getTransformed(AffineTransform t)
Ring
getTranslated(double dx, double dy)
Translates a copy of this object by the given values in x and y direction.Ring
getTranslated(Point d)
Translates a copy of this object by the givenPoint
.int
hashCode()
Ring
rotateCCW(Angle angle)
Ring
rotateCCW(Angle angle, double cx, double cy)
Ring
rotateCCW(Angle angle, Point center)
Ring
rotateCW(Angle angle)
Ring
rotateCW(Angle angle, double cx, double cy)
Ring
rotateCW(Angle angle, Point center)
Ring
scale(double factor)
Scales the calling object by the given factor relative to its centerPoint
.Ring
scale(double fx, double fy)
Scales the calling object by the given factors relative to the given centerPoint
.Ring
scale(double factor, double cx, double cy)
Scales the calling object by the given factor relative to the given centerPoint
(cx, cy).Ring
scale(double fx, double fy, double cx, double cy)
Scales the calling object by the given factors relative to the given centerPoint
(cx, cy).Ring
scale(double fx, double fy, Point center)
Scales the calling object by the given factors relative to the given centerPoint
.Ring
scale(double factor, Point center)
Scales the calling object by the given factor relative to the given centerPoint
.Path
toPath()
boolean
touches(IGeometry g)
Ring
translate(double dx, double dy)
Translates the object by the given values in x and y direction.Ring
translate(Point d)
Translates the object by the givenPoint
.
-
-
-
Method Detail
-
contains
public boolean contains(IGeometry g)
Description copied from interface:IMultiShape
Checks if the givenIGeometry
is fully contained by thisIMultiShape
.- Specified by:
contains
in interfaceIMultiShape
- Parameters:
g
- TheIGeometry
which is tested for containment.- Returns:
true
if theIGeometry
is contained by thisIMultiShape
, otherwisefalse
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
getAllEdges
protected Line[] getAllEdges()
Collects all edges of the internalIShape
s. For aRegion
the internalIShape
s areRectangle
s. For aRing
the internalIShape
s arePolygon
s (triangles). The internal edges are needed to determine inner and outer segments of theIMultiShape
. Based on the outline of theIMultiShape
, the outline intersections can be computed. These outline intersections are required to test if anICurve
is fully-contained by theIMultiShape
.- Returns:
- the edges of all internal
IShape
s
-
getCopy
public Ring getCopy()
Description copied from interface:IGeometry
Returns a new identical copy of thisIGeometry
.
-
getRotatedCCW
public Ring 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<Ring>
- Parameters:
angle
- rotationAngle
- Returns:
- an
IGeometry
representing the result of the rotation
-
getRotatedCCW
public Ring 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<Ring>
- 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 Ring 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<Ring>
- Parameters:
angle
- rotationAngle
center
- relativePoint
for the rotation- Returns:
- an
IGeometry
representing the result of the rotation
-
getRotatedCW
public Ring 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<Ring>
- Parameters:
angle
- rotationAngle
- Returns:
- an
IGeometry
representing the result of the rotation
-
getRotatedCW
public Ring 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<Ring>
- 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 Ring 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<Ring>
- Parameters:
angle
- rotationAngle
center
- relativePoint
for the rotation- Returns:
- an
IGeometry
representing the result of the rotation
-
getScaled
public Ring getScaled(double factor)
Description copied from interface:IScalable
Scales a copy of the calling object by the given factor relative to its centerPoint
.
-
getScaled
public Ring 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
.
-
getScaled
public Ring 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).
-
getScaled
public Ring 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).
-
getScaled
public Ring 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
.
-
getScaled
public Ring 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
.
-
getShapes
public Polygon[] getShapes()
Description copied from interface:IMultiShape
Returns theIShape
s that constitute thisIMultiShape
.- Specified by:
getShapes
in interfaceIMultiShape
- Returns:
- an array of
IShape
s, representing the parts that make up thisIMultiShape
.
-
getTransformed
public Ring 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
- Parameters:
t
- TheAffineTransform
to be applied- Returns:
- a transformed
Path
representation of thisIGeometry
-
getTranslated
public Ring 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<Ring>
- Parameters:
dx
- x-translationdy
- y-translation- Returns:
- a new, translated object
-
getTranslated
public Ring getTranslated(Point d)
Description copied from interface:ITranslatable
Translates a copy of this object by the givenPoint
.- Specified by:
getTranslated
in interfaceITranslatable<Ring>
- Parameters:
d
- translationPoint
- Returns:
- a new, translated object
-
rotateCCW
public Ring rotateCCW(Angle angle)
Directly rotates thisRing
counter-clock-wise around its centerPoint
by the givenAngle
. Direct adaptation means, thatthis
PolyBezier
is modified in-place.- Parameters:
angle
- rotationAngle
- Returns:
this
for convenience
-
rotateCCW
public Ring rotateCCW(Angle angle, double cx, double cy)
Directly rotates thisRing
counter-clock-wise around the given point (specified by cx and cy) by the givenAngle
. Direct adaptation means, thatthis
PolyBezier
is modified in-place.
-
rotateCCW
public Ring rotateCCW(Angle angle, Point center)
Directly rotates thisRing
counter-clock-wise around the givenPoint
by the givenAngle
. Direct adaptation means, thatthis
PolyBezier
is modified in-place.
-
rotateCW
public Ring rotateCW(Angle angle)
Directly rotates thisRing
clock-wise around its centerPoint
by the givenAngle
. Direct adaptation means, thatthis
PolyBezier
is modified in-place.- Parameters:
angle
- rotationAngle
- Returns:
this
for convenience
-
rotateCW
public Ring rotateCW(Angle angle, double cx, double cy)
Directly rotates thisRing
clock-wise around the given point (specified by cx and cy) by the givenAngle
. Direct adaptation means, thatthis
PolyBezier
is modified in-place.
-
rotateCW
public Ring rotateCW(Angle angle, Point center)
Directly rotates thisRing
clock-wise around the givenPoint
by the givenAngle
. Direct adaptation means, thatthis
PolyBezier
is modified in-place.
-
scale
public Ring scale(double factor)
Description copied from interface:IScalable
Scales the calling object by the given factor relative to its centerPoint
.
-
scale
public Ring scale(double fx, double fy)
Description copied from interface:IScalable
Scales the calling object by the given factors relative to the given centerPoint
.
-
scale
public Ring 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).
-
scale
public Ring 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).
-
scale
public Ring 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
.
-
scale
public Ring scale(double factor, Point center)
Description copied from interface:IScalable
Scales the calling object by the given factor relative to the given centerPoint
.
-
translate
public Ring 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<Ring>
- Parameters:
dx
- x-translationdy
- y-translation- Returns:
this
for convenience
-
translate
public Ring translate(Point d)
Description copied from interface:ITranslatable
Translates the object by the givenPoint
.- Specified by:
translate
in interfaceITranslatable<Ring>
- Parameters:
d
- translationPoint
- Returns:
this
for convenience
-
getOutlines
public Polyline[] getOutlines()
Description copied from interface:IMultiShape
Computes the outlines of this
IMultiShape
.The outlines are returned as an array of
ICurve
s. For every closed outline of thisIMultiShape
oneICurve
is returned.- Specified by:
getOutlines
in interfaceIMultiShape
- Returns:
- an array of
ICurve
s, one for each closed outline
-
getOutlineSegments
public Line[] getOutlineSegments()
Computes the outline segments of this
AbstractMultiShape
.The outline segments of this
AbstractMultiShape
are those outline segments of the internalIShape
s that only exist once.- Specified by:
getOutlineSegments
in interfaceIMultiShape
- Returns:
- the outline segments of this
AbstractMultiShape
-
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()
-
-