Class DecimatedShape
java.lang.Object
org.apache.sis.internal.referencing.j2d.AbstractShape
org.apache.sis.internal.feature.j2d.ShapeWrapper
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
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
For cross-version compatibility.private final double
The desired resolution on each axis.private final double
The desired resolution on each axis.Fields inherited from class org.apache.sis.internal.feature.j2d.ShapeWrapper
source
-
Constructor Summary
ConstructorsConstructorDescriptionDecimatedShape
(Shape source, double[] resolution) Creates a new wrapper which will decimate the coordinates of the given source. -
Method Summary
Modifier and TypeMethodDescriptionReturns 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.boolean
isValid()
Returnstrue
if resolutions are strictly positive and finite numbers.Methods inherited from class org.apache.sis.internal.feature.j2d.ShapeWrapper
contains, contains, contains, contains, getBounds, getBounds2D, intersects, intersects, isFloat
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:
-
xRes
private final double xResThe desired resolution on each axis. -
yRes
private final double yResThe desired resolution on each axis.
-
-
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()Returnstrue
if 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:
getPathIterator
in interfaceShape
- Overrides:
getPathIterator
in classShapeWrapper
- 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 decimated line segments.- Specified by:
getPathIterator
in interfaceShape
- Overrides:
getPathIterator
in classShapeWrapper
- 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.
-