public class Region extends java.lang.Object implements ITranslatable<Region>, IScalable<Region>, IRotatable<Ring>
Rectangles. The Rectangles 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
Rectangles are covering.
A Region differentiates between the internal Rectangles and
the external Rectangles. The external Rectangles are those
that you feed it, in order to construct the Region. The internal
Rectangles are those used for computations of the Region.
They are defined to not share any area, so that only their borders can be
overlapping.| Constructor and Description |
|---|
Region()
Constructs a new
Region not covering any area. |
Region(Rectangle... rectangles)
|
Region(Region other)
|
| Modifier and Type | Method and Description |
|---|---|
Region |
add(Rectangle rectangle)
|
java.lang.Object |
clone()
Overridden with public visibility as recommended within
Cloneable
. |
boolean |
contains(IGeometry g)
Checks if the given
IGeometry is fully contained by this
IMultiShape. |
boolean |
contains(Point p)
|
boolean |
equals(java.lang.Object obj) |
protected Line[] |
getAllEdges()
Collects all outline segments of the internal
Rectangles. |
Rectangle |
getBounds()
|
Region |
getCopy()
Returns a new identical copy of this
IGeometry. |
Point[] |
getOutlineIntersections(ICurve c)
|
Polyline[] |
getOutlines()
Computes the outlines of this
IMultiShape. |
Line[] |
getOutlineSegments()
Computes the outline segments of this
AbstractMultiShape. |
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)
|
Region |
getScaled(double factor)
Scales a copy of the calling object by the given factor relative to its
center
Point. |
Region |
getScaled(double fx,
double fy)
Scales a copy of the calling object by the given factors relative to its
center
Point. |
Region |
getScaled(double factor,
double cx,
double cy)
Scales a copy of the calling object by the given factor relative to the
given center
Point (cx, cy). |
Region |
getScaled(double fx,
double fy,
double cx,
double cy)
Scales a copy of the calling object by the given factors relative to the
given center
Point (cx, cy). |
Region |
getScaled(double fx,
double fy,
Point center)
Scales a copy of the calling object by the given factors relative to the
given center
Point. |
Region |
getScaled(double factor,
Point center)
Scales a copy of the calling object by the given factor relative to the
given center
Point. |
Rectangle[] |
getShapes()
Returns the
IShapes that constitute this IMultiShape. |
Ring |
getTransformed(AffineTransform t)
|
Region |
getTranslated(double dx,
double dy)
Translates a copy of this object by the given values in x and y
direction.
|
Region |
getTranslated(Point d)
Translates a copy of this object by the given
Point. |
int |
hashCode() |
Region |
scale(double factor)
Scales the calling object by the given factor relative to its center
Point. |
Region |
scale(double fx,
double fy)
Scales the calling object by the given factors relative to the given
center
Point. |
Region |
scale(double factor,
double cx,
double cy)
Scales the calling object by the given factor relative to the given
center
Point (cx, cy). |
Region |
scale(double fx,
double fy,
double cx,
double cy)
Scales the calling object by the given factors relative to the given
center
Point (cx, cy). |
Region |
scale(double fx,
double fy,
Point center)
Scales the calling object by the given factors relative to the given
center
Point. |
Region |
scale(double factor,
Point center)
Scales the calling object by the given factor relative to the given
center
Point. |
Path |
toPath()
|
Ring |
toRing()
|
boolean |
touches(IGeometry g)
|
Region |
translate(double dx,
double dy)
Translates the object by the given values in x and y direction.
|
Region |
translate(Point d)
Translates the object by the given
Point. |
public Region()
Region not covering any area.public Region(Rectangle... rectangles)
Region from the given list of Rectangle
s.
The given Rectangles are add(Rectangle)ed to the
Region one after the other.public boolean contains(IGeometry g)
IMultiShapeIGeometry is fully contained by this
IMultiShape.contains in interface IMultiShapeg - The IGeometry which is tested for containment.true if the IGeometry is contained by this
IMultiShape, otherwise falsepublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectprotected Line[] getAllEdges()
Rectangles.Rectanglespublic Region getCopy()
IGeometryIGeometry.public Ring getRotatedCCW(Angle angle)
IRotatableAngle counter-clock-wise
(CCW) around its center Point. Does not necessarily return an
object of the same type.getRotatedCCW in interface IRotatable<Ring>angle - rotation AngleIGeometry representing the result of the rotationpublic Ring getRotatedCCW(Angle angle, double cx, double cy)
IRotatableAngle
counter-clock-wise (CCW) around the specified center Point (cx,
cy). Does not necessarily return an object of the same type.getRotatedCCW in interface IRotatable<Ring>angle - rotation Anglecx - x-coordinate of the relative Point for the rotationcy - y-coordinate of the relative Point for the rotationIGeometry representing the result of the rotationpublic Ring getRotatedCCW(Angle angle, Point center)
IRotatableAngle
counter-clock-wise (CCW) around the specified center Point. Does
not necessarily return an object of the same type.getRotatedCCW in interface IRotatable<Ring>angle - rotation Anglecenter - relative Point for the rotationIGeometry representing the result of the rotationpublic Ring getRotatedCW(Angle angle)
IRotatableAngle clock-wise (CW)
around its center Point. Does not necessarily return an object of
the same type.getRotatedCW in interface IRotatable<Ring>angle - rotation AngleIGeometry representing the result of the rotationpublic Ring getRotatedCW(Angle angle, double cx, double cy)
IRotatableAngle clock-wise (CW)
around the specified center Point (cx, cy). Does not necessarily
return an object of the same type.getRotatedCW in interface IRotatable<Ring>angle - rotation Anglecx - x-coordinate of the relative Point for the rotationcy - y-coordinate of the relative Point for the rotationIGeometry representing the result of the rotationpublic Ring getRotatedCW(Angle angle, Point center)
IRotatableAngle clock-wise (CW)
around the specified center Point. Does not necessarily return an
object of the same type.getRotatedCW in interface IRotatable<Ring>angle - rotation Anglecenter - relative Point for the rotationIGeometry representing the result of the rotationpublic Region getScaled(double factor)
IScalablePoint.public Region getScaled(double fx, double fy)
IScalablePoint.public Region getScaled(double factor, double cx, double cy)
IScalablePoint (cx, cy).public Region getScaled(double fx, double fy, double cx, double cy)
IScalablePoint (cx, cy).public Region getScaled(double fx, double fy, Point center)
IScalablePoint.public Region getScaled(double factor, Point center)
IScalablePoint.public Rectangle[] getShapes()
IMultiShapeIShapes that constitute this IMultiShape.getShapes in interface IMultiShapeIShapes, representing the parts that make up
this IMultiShape.public Ring getTransformed(AffineTransform t)
Path
representation of this IGeometry. Subclasses may override this
method to return a more specific representation.getTransformed in interface IGeometryt - The AffineTransform to be appliedPath representation of this
IGeometrypublic Region getTranslated(double dx, double dy)
ITranslatablegetTranslated in interface ITranslatable<Region>dx - x-translationdy - y-translationpublic Region getTranslated(Point d)
ITranslatablePoint.getTranslated in interface ITranslatable<Region>d - translation Pointpublic Region scale(double factor)
IScalablePoint.public Region scale(double fx, double fy)
IScalablePoint.public Region scale(double factor, double cx, double cy)
IScalablePoint (cx, cy).public Region scale(double fx, double fy, double cx, double cy)
IScalablePoint (cx, cy).public Region scale(double fx, double fy, Point center)
IScalablePoint.public Region scale(double factor, Point center)
IScalablePoint.public Region translate(double dx, double dy)
ITranslatabletranslate in interface ITranslatable<Region>dx - x-translationdy - y-translationthis for conveniencepublic Region translate(Point d)
ITranslatablePoint.translate in interface ITranslatable<Region>d - translation Pointthis for conveniencepublic Polyline[] getOutlines()
IMultiShape
Computes the outlines of this IMultiShape.
The outlines are returned as an array of ICurves. For every
closed outline of this IMultiShape one ICurve is
returned.
getOutlines in interface IMultiShapeICurves, one for each closed outlinepublic Line[] getOutlineSegments()
Computes the outline segments of this AbstractMultiShape.
The outline segments of this AbstractMultiShape are those outline
segments of the internal IShapes that only exist once.
getOutlineSegments in interface IMultiShapeAbstractMultiShapepublic java.lang.Object clone()
Cloneable
.clone in class java.lang.Objectpublic final int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()Copyright (c) 2014 itemis AG, and others. All rights reserved.