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 Ringadd(Polygon p)java.lang.Objectclone()Overridden with public visibility as recommended withinCloneable.booleancontains(IGeometry g)Checks if the givenIGeometryis fully contained by thisIMultiShape.booleancontains(Point p)booleanequals(java.lang.Object obj)protected Line[]getAllEdges()Collects all edges of the internalIShapes.RectanglegetBounds()RinggetCopy()Returns a new identical copy of thisIGeometry.Polyline[]getOutlines()Computes the outlines of thisIMultiShape.Line[]getOutlineSegments()Computes the outline segments of thisAbstractMultiShape.RinggetRotatedCCW(Angle angle)RinggetRotatedCCW(Angle angle, double cx, double cy)RinggetRotatedCCW(Angle angle, Point center)RinggetRotatedCW(Angle angle)RinggetRotatedCW(Angle angle, double cx, double cy)RinggetRotatedCW(Angle angle, Point center)RinggetScaled(double factor)Scales a copy of the calling object by the given factor relative to its centerPoint.RinggetScaled(double fx, double fy)Scales a copy of the calling object by the given factors relative to its centerPoint.RinggetScaled(double factor, double cx, double cy)Scales a copy of the calling object by the given factor relative to the given centerPoint(cx, cy).RinggetScaled(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).RinggetScaled(double fx, double fy, Point center)Scales a copy of the calling object by the given factors relative to the given centerPoint.RinggetScaled(double factor, Point center)Scales a copy of the calling object by the given factor relative to the given centerPoint.Polygon[]getShapes()Returns theIShapes that constitute thisIMultiShape.RinggetTransformed(AffineTransform t)RinggetTranslated(double dx, double dy)Translates a copy of this object by the given values in x and y direction.RinggetTranslated(Point d)Translates a copy of this object by the givenPoint.inthashCode()RingrotateCCW(Angle angle)RingrotateCCW(Angle angle, double cx, double cy)RingrotateCCW(Angle angle, Point center)RingrotateCW(Angle angle)RingrotateCW(Angle angle, double cx, double cy)RingrotateCW(Angle angle, Point center)Ringscale(double factor)Scales the calling object by the given factor relative to its centerPoint.Ringscale(double fx, double fy)Scales the calling object by the given factors relative to the given centerPoint.Ringscale(double factor, double cx, double cy)Scales the calling object by the given factor relative to the given centerPoint(cx, cy).Ringscale(double fx, double fy, double cx, double cy)Scales the calling object by the given factors relative to the given centerPoint(cx, cy).Ringscale(double fx, double fy, Point center)Scales the calling object by the given factors relative to the given centerPoint.Ringscale(double factor, Point center)Scales the calling object by the given factor relative to the given centerPoint.PathtoPath()booleantouches(IGeometry g)Ringtranslate(double dx, double dy)Translates the object by the given values in x and y direction.Ringtranslate(Point d)Translates the object by the givenPoint.
-
-
-
Method Detail
-
contains
public boolean contains(IGeometry g)
Description copied from interface:IMultiShapeChecks if the givenIGeometryis fully contained by thisIMultiShape.- Specified by:
containsin interfaceIMultiShape- Parameters:
g- TheIGeometrywhich is tested for containment.- Returns:
trueif theIGeometryis contained by thisIMultiShape, otherwisefalse
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
getAllEdges
protected Line[] getAllEdges()
Collects all edges of the internalIShapes. For aRegionthe internalIShapes areRectangles. For aRingthe internalIShapes arePolygons (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 anICurveis fully-contained by theIMultiShape.- Returns:
- the edges of all internal
IShapes
-
getCopy
public Ring getCopy()
Description copied from interface:IGeometryReturns a new identical copy of thisIGeometry.
-
getRotatedCCW
public Ring 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<Ring>- Parameters:
angle- rotationAngle- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getRotatedCCW
public Ring 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<Ring>- 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 Ring 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<Ring>- Parameters:
angle- rotationAnglecenter- relativePointfor the rotation- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getRotatedCW
public Ring 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<Ring>- Parameters:
angle- rotationAngle- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getRotatedCW
public Ring 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<Ring>- 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 Ring 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<Ring>- Parameters:
angle- rotationAnglecenter- relativePointfor the rotation- Returns:
- an
IGeometryrepresenting the result of the rotation
-
getScaled
public Ring getScaled(double factor)
Description copied from interface:IScalableScales 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:IScalableScales 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:IScalableScales 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:IScalableScales 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:IScalableScales 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:IScalableScales a copy of the calling object by the given factor relative to the given centerPoint.
-
getShapes
public Polygon[] getShapes()
Description copied from interface:IMultiShapeReturns theIShapes that constitute thisIMultiShape.- Specified by:
getShapesin interfaceIMultiShape- Returns:
- an array of
IShapes, representing the parts that make up thisIMultiShape.
-
getTransformed
public Ring 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- Parameters:
t- TheAffineTransformto be applied- Returns:
- a transformed
Pathrepresentation of thisIGeometry
-
getTranslated
public Ring 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<Ring>- Parameters:
dx- x-translationdy- y-translation- Returns:
- a new, translated object
-
getTranslated
public Ring getTranslated(Point d)
Description copied from interface:ITranslatableTranslates a copy of this object by the givenPoint.- Specified by:
getTranslatedin interfaceITranslatable<Ring>- Parameters:
d- translationPoint- Returns:
- a new, translated object
-
rotateCCW
public Ring rotateCCW(Angle angle)
Directly rotates thisRingcounter-clock-wise around its centerPointby the givenAngle. Direct adaptation means, thatthisPolyBezieris modified in-place.- Parameters:
angle- rotationAngle- Returns:
thisfor convenience
-
rotateCCW
public Ring rotateCCW(Angle angle, double cx, double cy)
Directly rotates thisRingcounter-clock-wise around the given point (specified by cx and cy) by the givenAngle. Direct adaptation means, thatthisPolyBezieris modified in-place.
-
rotateCCW
public Ring rotateCCW(Angle angle, Point center)
Directly rotates thisRingcounter-clock-wise around the givenPointby the givenAngle. Direct adaptation means, thatthisPolyBezieris modified in-place.
-
rotateCW
public Ring rotateCW(Angle angle)
Directly rotates thisRingclock-wise around its centerPointby the givenAngle. Direct adaptation means, thatthisPolyBezieris modified in-place.- Parameters:
angle- rotationAngle- Returns:
thisfor convenience
-
rotateCW
public Ring rotateCW(Angle angle, double cx, double cy)
Directly rotates thisRingclock-wise around the given point (specified by cx and cy) by the givenAngle. Direct adaptation means, thatthisPolyBezieris modified in-place.
-
rotateCW
public Ring rotateCW(Angle angle, Point center)
Directly rotates thisRingclock-wise around the givenPointby the givenAngle. Direct adaptation means, thatthisPolyBezieris modified in-place.
-
scale
public Ring scale(double factor)
Description copied from interface:IScalableScales the calling object by the given factor relative to its centerPoint.
-
scale
public Ring scale(double fx, double fy)
Description copied from interface:IScalableScales 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:IScalableScales 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:IScalableScales 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:IScalableScales the calling object by the given factors relative to the given centerPoint.
-
scale
public Ring scale(double factor, Point center)
Description copied from interface:IScalableScales the calling object by the given factor relative to the given centerPoint.
-
translate
public Ring 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<Ring>- Parameters:
dx- x-translationdy- y-translation- Returns:
thisfor convenience
-
translate
public Ring translate(Point d)
Description copied from interface:ITranslatableTranslates the object by the givenPoint.- Specified by:
translatein interfaceITranslatable<Ring>- Parameters:
d- translationPoint- Returns:
thisfor convenience
-
getOutlines
public Polyline[] getOutlines()
Description copied from interface:IMultiShapeComputes the outlines of this
IMultiShape.The outlines are returned as an array of
ICurves. For every closed outline of thisIMultiShapeoneICurveis returned.- Specified by:
getOutlinesin interfaceIMultiShape- Returns:
- an array of
ICurves, one for each closed outline
-
getOutlineSegments
public Line[] getOutlineSegments()
Computes the outline segments of this
AbstractMultiShape.The outline segments of this
AbstractMultiShapeare those outline segments of the internalIShapes that only exist once.- Specified by:
getOutlineSegmentsin interfaceIMultiShape- Returns:
- the outline segments of this
AbstractMultiShape
-
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()
-
-