Class DecimatedShape
java.lang.Object
org.apache.sis.internal.referencing.j2d.AbstractShape
org.apache.sis.internal.feature.j2d.DecimatedShape
- All Implemented Interfaces:
Shape,Serializable
A shape that apply a simple decimation on-the-fly for faster drawing.
Limitations
Current implementation assumes that the shape is flattened. There is some tolerance for quadratic and cubic curves, but the result may not be correct.- Since:
- 1.2
- Version:
- 1.2
- Author:
- Johann Sorel (Puzzle-GIS, Geomatys), Martin Desruisseaux (Geomatys)
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDecimatedShape(Shape source, double[] resolution) Creates a new wrapper which will decimate the coordinates of the given source. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(double x, double y) Tests if the specified coordinates are inside the boundary of this shape.booleancontains(double x, double y, double w, double h) Tests if the interior of thisShapeentirely contains the interior of a specified rectangular area.booleanTests if the point is inside the boundary of this shape.booleanTests if the interior of thisShapeentirely 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 after decimation.getPathIterator(AffineTransform at, double flatness) Returns an iterator over the coordinates of this shape, approximated by decimated line segments.booleanintersects(double x, double y, double w, double h) Tests if the interior of thisShapeintersects the interior of a specified rectangular area.booleanTests if the interior of thisShapeintersects the interior of a specified rectangular area.protected booleanisFloat()Returnstrueif this shape backed by primitivefloatvalues.booleanisValid()Returnstrueif resolutions are strictly positive and finite numbers.Methods inherited from class org.apache.sis.internal.referencing.j2d.AbstractShape
isFloat
-
Field Details
-
source
The source of coordinate values.
-
-
Constructor Details
-
DecimatedShape
Creates a new wrapper which will decimate the coordinates of the given source.- Parameters:
source- the shape to decimate.resolution- the desired resolution on each axis.
-
-
Method Details
-
isValid
public boolean isValid()Returnstrueif resolutions are strictly positive and finite numbers.- Returns:
- whether this object can effectively apply decimation.
-
getPathIterator
Returns an iterator over the coordinates of this shape after decimation.- Specified by:
getPathIteratorin interfaceShape- Parameters:
at- an optional transform to be applied on coordinate values, ornullif none.- Returns:
- iterator over the coordinate values of this shape.
-
getPathIterator
Returns an iterator over the coordinates of this shape, approximated by decimated line segments.- Specified by:
getPathIteratorin interfaceShape- Parameters:
at- an optional transform to be applied on coordinate values, ornullif none.flatness- maximum distance between line segments approximations and the curve segments.- Returns:
- iterator over the coordinate values of line segments approximating this shape.
-
isFloat
protected boolean isFloat()Returnstrueif this shape backed by primitivefloatvalues.- Overrides:
isFloatin classAbstractShape- Returns:
trueif this shape is backed byfloatcoordinate 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:
getBounds2Din 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 thisShapeintersects the interior of a specified rectangular area. This method may conservatively returntrueif an accurate computation would be too expansive.- Specified by:
intersectsin 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 thisShapeintersects the interior of a specified rectangular area. This method may conservatively returntrueif an accurate computation would be too expansive.- Specified by:
intersectsin 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 thisShapeentirely contains the interior of a specified rectangular area. This method may conservatively returnfalseif an accurate computation would be too expansive. -
contains
Tests if the interior of thisShapeentirely contains the interior of a specified rectangular area. This method may conservatively returnfalseif an accurate computation would be too expansive.
-