public class GeometryPrecisionReducer
extends java.lang.Object
Geometry
according to the supplied PrecisionModel
,
ensuring that the result is topologically valid.Modifier and Type | Field and Description |
---|---|
private boolean |
changePrecisionModel |
private boolean |
isPointwise |
private boolean |
removeCollapsed |
private PrecisionModel |
targetPM |
Constructor and Description |
---|
GeometryPrecisionReducer(PrecisionModel pm) |
Modifier and Type | Method and Description |
---|---|
private Geometry |
changePM(Geometry geom,
PrecisionModel newPM)
Duplicates a geometry to one that uses a different PrecisionModel,
without changing any coordinate values.
|
private GeometryEditor |
createEditor(GeometryFactory geomFactory,
PrecisionModel newPM) |
private GeometryFactory |
createFactory(GeometryFactory inputFactory,
PrecisionModel pm) |
private Geometry |
fixPolygonalTopology(Geometry geom) |
Geometry |
reduce(Geometry geom) |
static Geometry |
reduce(Geometry g,
PrecisionModel precModel)
Convenience method for doing precision reduction
on a single geometry,
with collapses removed
and keeping the geometry precision model the same,
and preserving polygonal topology.
|
private Geometry |
reducePointwise(Geometry geom) |
static Geometry |
reducePointwise(Geometry g,
PrecisionModel precModel)
Convenience method for doing pointwise precision reduction
on a single geometry,
with collapses removed
and keeping the geometry precision model the same,
but NOT preserving valid polygonal topology.
|
void |
setChangePrecisionModel(boolean changePrecisionModel)
Sets whether the
PrecisionModel of the new reduced Geometry
will be changed to be the PrecisionModel supplied to
specify the precision reduction. |
void |
setPointwise(boolean isPointwise)
Sets whether the precision reduction will be done
in pointwise fashion only.
|
void |
setRemoveCollapsedComponents(boolean removeCollapsed)
Sets whether the reduction will result in collapsed components
being removed completely, or simply being collapsed to an (invalid)
Geometry of the same type.
|
private PrecisionModel targetPM
private boolean removeCollapsed
private boolean changePrecisionModel
private boolean isPointwise
public GeometryPrecisionReducer(PrecisionModel pm)
public static Geometry reduce(Geometry g, PrecisionModel precModel)
g
- the geometry to reduceprecModel
- the precision model to usepublic static Geometry reducePointwise(Geometry g, PrecisionModel precModel)
g
- the geometry to reduceprecModel
- the precision model to usepublic void setRemoveCollapsedComponents(boolean removeCollapsed)
removeCollapsed
- if true
collapsed components will be removedpublic void setChangePrecisionModel(boolean changePrecisionModel)
PrecisionModel
of the new reduced Geometry
will be changed to be the PrecisionModel
supplied to
specify the precision reduction.
The default is to not change the precision model
changePrecisionModel
- if true
the precision model of the created Geometry will be the
the precisionModel supplied in the constructor.public void setPointwise(boolean isPointwise)
isPointwise
- if reduction should be done pointwise onlyprivate Geometry changePM(Geometry geom, PrecisionModel newPM)
geom
- the geometry to duplicatenewPM
- the precision model to useprivate GeometryEditor createEditor(GeometryFactory geomFactory, PrecisionModel newPM)
private GeometryFactory createFactory(GeometryFactory inputFactory, PrecisionModel pm)