Class ShapeWrapper
java.lang.Object
org.apache.sis.internal.referencing.j2d.AbstractShape
org.apache.sis.internal.feature.j2d.ShapeWrapper
- All Implemented Interfaces:
Shape
,Serializable
- Direct Known Subclasses:
DecimatedShape
A wrapper that delegate all
Shape
methods to a source shape.
Subclasses should override at least one method for making this class useful.- Since:
- 1.2
- Version:
- 1.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
For cross-version compatibility.protected final Shape
The source of coordinate values. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ShapeWrapper
(Shape source) Creates a new wrapper for the given shape. -
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(double x, double y) Tests if the specified coordinates are inside the boundary of this shape.boolean
contains
(double x, double y, double w, double h) Tests if the interior of thisShape
entirely contains the interior of a specified rectangular area.boolean
Tests if the point is inside the boundary of this shape.boolean
Tests if the interior of thisShape
entirely contains the interior of a specified rectangular area.Returns a rectangle that completely encloses thisShape
.Returns a rectangle that completely encloses thisShape
.Returns an iterator over the coordinates of this shape.getPathIterator
(AffineTransform at, double flatness) Returns an iterator over the coordinates of this shape, approximated by line segments.boolean
intersects
(double x, double y, double w, double h) Tests if the interior of thisShape
intersects the interior of a specified rectangular area.boolean
Tests if the interior of thisShape
intersects the interior of a specified rectangular area.protected boolean
isFloat()
Returnstrue
if this shape backed by primitivefloat
values.Methods inherited from class org.apache.sis.internal.referencing.j2d.AbstractShape
isFloat
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
source
The source of coordinate values.
-
-
Constructor Details
-
ShapeWrapper
Creates a new wrapper for the given shape.- Parameters:
source
- the source of coordinate values.
-
-
Method Details
-
isFloat
protected boolean isFloat()Returnstrue
if this shape backed by primitivefloat
values.- Overrides:
isFloat
in classAbstractShape
- Returns:
true
if this shape is backed byfloat
coordinate values.
-
getBounds
Returns a rectangle that completely encloses thisShape
. This is not necessarily the smallest bounding box if an accurate computation would be too expansive. -
getBounds2D
Returns a rectangle that completely encloses thisShape
. This is not necessarily the smallest bounding box if an accurate computation would be too expansive.- Specified by:
getBounds2D
in interfaceShape
- Returns:
- a rectangle that completely encloses this
Shape
.
-
contains
public boolean contains(double x, double y) Tests if the specified coordinates are inside the boundary of this shape. -
contains
Tests if the point is inside the boundary of this shape. -
intersects
public boolean intersects(double x, double y, double w, double h) Tests if the interior of thisShape
intersects the interior of a specified rectangular area. This method may conservatively returntrue
if an accurate computation would be too expansive.- Specified by:
intersects
in interfaceShape
- Parameters:
x
- minimal x coordinate of the rectangle.y
- minimal y coordinate of the rectangle.w
- width of the rectangle.h
- height of the rectangle.- Returns:
- whether the specified rectangle intersects the interior of this shape.
-
intersects
Tests if the interior of thisShape
intersects the interior of a specified rectangular area. This method may conservatively returntrue
if an accurate computation would be too expansive.- Specified by:
intersects
in interfaceShape
- Parameters:
r
- the rectangular area to test.- Returns:
- whether the specified rectangle intersects the interior of this shape.
-
contains
public boolean contains(double x, double y, double w, double h) Tests if the interior of thisShape
entirely contains the interior of a specified rectangular area. This method may conservatively returnfalse
if an accurate computation would be too expansive. -
contains
Tests if the interior of thisShape
entirely contains the interior of a specified rectangular area. This method may conservatively returnfalse
if an accurate computation would be too expansive. -
getPathIterator
Returns an iterator over the coordinates of this shape.- Specified by:
getPathIterator
in interfaceShape
- Parameters:
at
- an optional transform to be applied on coordinate values, ornull
if none.- Returns:
- iterator over the coordinate values of this shape.
-
getPathIterator
Returns an iterator over the coordinates of this shape, approximated by line segments.- Specified by:
getPathIterator
in interfaceShape
- Parameters:
at
- an optional transform to be applied on coordinate values, ornull
if none.flatness
- maximum distance between line segments approximations and the curve segments.- Returns:
- iterator over the coordinate values of line segments approximating this shape.
-