Class GeometryPrecisionReducer
Reduces the precision of a Geometry
according to the supplied Precision
Topological Precision Reduction
The default mode of operation ensures the reduced result is topologically valid (i.e. Isfalse
,
or by using the static method ReducePointwise Precision Reduction
Alternatively, geometry can be reduced pointwise by using {@link #setPointwise(boolean)}. Linear and point geometry are always reduced pointwise(i.e.without further change to topology or structure), since this does not change validity. Invalid inputs are allowed. Duplicate vertices are preserved. Collapsed components are always included in the result. The result geometry may be invalid. This mode is invoked by the static method ReduceInherited Members
Namespace: NetTopologySuite .Precision
Assembly: NetTopologySuite.dll
Syntax
public class GeometryPrecisionReducer
Constructors
| Edit this page View SourceGeometryPrecisionReducer(PrecisionModel)
Declaration
public GeometryPrecisionReducer(PrecisionModel pm)
Parameters
Type | Name | Description |
---|---|---|
Precision |
pm |
Properties
| Edit this page View SourceChangePrecisionModel
Gets or sets whether the Precision
Declaration
public bool ChangePrecisionModel { get; set; }
Property Value
Type | Description |
---|---|
bool |
Pointwise
Gets or sets whether the precision reduction will be done in pointwise fashion only. Pointwise precision reduction reduces the precision of the individual coordinates only, but does not attempt to recreate valid topology. This is only relevant for geometries containing polygonal components.
Declaration
public bool Pointwise { get; set; }
Property Value
Type | Description |
---|---|
bool |
RemoveCollapsedComponents
Gets or sets whether the reduction will result in collapsed components being removed completely, or simply being collapsed to an (invalid) Geometry of the same type. The default is to remove collapsed components.
Declaration
public bool RemoveCollapsedComponents { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
| Edit this page View SourceReduce(Geometry)
Reduces the precision of a geometry, according to the specified strategy of this reducer.
Declaration
public Geometry Reduce(Geometry geom)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geom | The geometry to reduce |
Returns
Type | Description |
---|---|
Geometry | The precision-reduced geometry |
Exceptions
Type | Condition |
---|---|
Argument |
if the reduction fails due to input geometry is invalid. |
Reduce(Geometry, PrecisionModel)
Reduces precision of a geometry, ensuring output geometry is valid. Collapsed linear and polygonal components are removed. The geometry precision model is not changed. Invalid input geometry may cause an error, unless the invalidity is below the scale of the precision reduction.
Declaration
public static Geometry Reduce(Geometry g, PrecisionModel precModel)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g | The geometry to reduce |
Precision |
precModel | The precision model to use |
Returns
Type | Description |
---|---|
Geometry | The reduced geometry |
Exceptions
Type | Condition |
---|---|
Argument |
Thrwon if the reduction fails due to invalid input geometry |
ReduceKeepCollapsed(Geometry, PrecisionModel)
Reduces precision of a geometry, ensuring output polygonal geometry is valid, and preserving collapsed linear elements. The geometry precision model is not changed. Invalid input geometry may cause an error, unless the invalidity is below the scale of the precision reduction.
Declaration
public static Geometry ReduceKeepCollapsed(Geometry geom, PrecisionModel pm)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geom | |
Precision |
pm |
Returns
Type | Description |
---|---|
Geometry | The reduced geometry |
Exceptions
Type | Condition |
---|---|
Argument |
Thrwon if the reduction fails due to invalid input geometry |
ReducePointwise(Geometry, PrecisionModel)
Reduce precision of a geometry in a pointwise way. All input geometry elements are preserved in the output, including invalid polygons and collapsed polygons and linestrings. The output may not be valid, due to collapse or self-intersection. The geometry precision model is not changed. Invalid input geometry is allowed.
Declaration
public static Geometry ReducePointwise(Geometry g, PrecisionModel precModel)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g | The geometry to reduce |
Precision |
precModel | The precision model to use |
Returns
Type | Description |
---|---|
Geometry | The reduced geometry |