Package org.eclipse.gef.geometry.planar
Class Region
java.lang.Object
org.eclipse.gef.geometry.planar.Region
- All Implemented Interfaces:
Serializable
,Cloneable
,IGeometry
,IMultiShape
,IRotatable<Ring>
,IScalable<Region>
,ITranslatable<Region>
public class Region
extends Object
implements ITranslatable<Region>, IScalable<Region>, IRotatable<Ring>
A combination of
Rectangle
s. The Rectangle
s that build up a
Region
do not have to be touching. The area covered by the
Region
is exactly the area that all of its corresponding
Rectangle
s are covering.
A Region
differentiates between the internal Rectangle
s and
the external Rectangle
s. The external Rectangle
s are those
that you feed it, in order to construct the Region
. The internal
Rectangle
s are those used for computations of the Region
.
They are defined to not share any area, so that only their borders can be
overlapping.- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Overridden with public visibility as recommended withinCloneable
.boolean
Checks if the givenIGeometry
is fully contained by thisIMultiShape
.boolean
boolean
protected Line[]
Collects all outline segments of the internalRectangle
s.getCopy()
Returns a new identical copy of thisIGeometry
.Point[]
Polyline[]
Computes the outlines of thisIMultiShape
.Line[]
Computes the outline segments of thisAbstractMultiShape
.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 fx, double fy) Scales a copy of the calling object by the given factors relative to its centerPoint
.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).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).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
.Returns theIShape
s that constitute thisIMultiShape
.getTranslated
(double dx, double dy) Translates a copy of this object by the given values in x and y direction.Translates a copy of this object by the givenPoint
.final int
hashCode()
scale
(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
.toPath()
toRing()
boolean
translate
(double dx, double dy) Translates the object by the given values in x and y direction.Translates the object by the givenPoint
.
-
Constructor Details
-
Method Details
-
add
-
contains
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
-
getAllEdges
Collects all outline segments of the internalRectangle
s.- Returns:
- all the outline segments of the internal
Rectangle
s
-
getBounds
Description copied from interface:IGeometry
-
getCopy
Description copied from interface:IGeometry
Returns a new identical copy of thisIGeometry
. -
getOutlineIntersections
-
getRotatedCCW
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
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
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
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
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
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
Description copied from interface:IScalable
Scales a copy of the calling object by the given factor relative to its centerPoint
. -
getScaled
Description copied from interface:IScalable
Scales a copy of the calling object by the given factors relative to its centerPoint
. -
getScaled
Description copied from interface:IScalable
Scales a copy of the calling object by the given factor relative to the given centerPoint
(cx, cy). -
getScaled
Description copied from interface:IScalable
Scales a copy of the calling object by the given factors relative to the given centerPoint
(cx, cy). -
getScaled
Description copied from interface:IScalable
Scales a copy of the calling object by the given factors relative to the given centerPoint
. -
getScaled
Description copied from interface:IScalable
Scales a copy of the calling object by the given factor relative to the given centerPoint
. -
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
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
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<Region>
- Parameters:
dx
- x-translationdy
- y-translation- Returns:
- a new, translated object
-
getTranslated
Description copied from interface:ITranslatable
Translates a copy of this object by the givenPoint
.- Specified by:
getTranslated
in interfaceITranslatable<Region>
- Parameters:
d
- translationPoint
- Returns:
- a new, translated object
-
scale
Description copied from interface:IScalable
Scales the calling object by the given factor relative to its centerPoint
. -
scale
Description copied from interface:IScalable
Scales the calling object by the given factors relative to the given centerPoint
. -
scale
Description copied from interface:IScalable
Scales the calling object by the given factor relative to the given centerPoint
(cx, cy). -
scale
Description copied from interface:IScalable
Scales the calling object by the given factors relative to the given centerPoint
(cx, cy). -
scale
Description copied from interface:IScalable
Scales the calling object by the given factors relative to the given centerPoint
. -
scale
Description copied from interface:IScalable
Scales the calling object by the given factor relative to the given centerPoint
. -
toRing
-
translate
Description copied from interface:ITranslatable
Translates the object by the given values in x and y direction.- Specified by:
translate
in interfaceITranslatable<Region>
- Parameters:
dx
- x-translationdy
- y-translation- Returns:
this
for convenience
-
translate
Description copied from interface:ITranslatable
Translates the object by the givenPoint
.- Specified by:
translate
in interfaceITranslatable<Region>
- Parameters:
d
- translationPoint
- Returns:
this
for convenience
-
contains
Description copied from interface:IGeometry
-
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
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
-
toPath
Description copied from interface:IGeometry
-
clone
Overridden with public visibility as recommended withinCloneable
. -
hashCode
public final int hashCode() -
touches
Description copied from interface:IGeometry
-