public class CoverageValidator extends Object
A polygonal coverage is a set of polygons which may be edge-adjacent but do
not overlap.
Coverage algorithms (such as CoverageUnion or simplification)
generally require the input coverage to be valid to produce correct results.
A polygonal coverage is valid if:
A valid coverage may contain holes (regions of no coverage).
Sometimes it is desired to detect whether coverages contain
narrow gaps between polygons
(which can be a result of digitizing error or misaligned data).
This class can detect narrow gaps,
by specifying a maximum gap width using setGapWidth(double).
Note that this also identifies narrow gaps separating disjoint coverage regions,
and narrow gores.
In some situations it may also produce false positives
(linework identified as part of a gap which is actually wider).
See CoverageGapFinder for an alternate way to detect gaps which may be more accurate.
| Constructor and Description |
|---|
CoverageValidator(Geometry[] coverage)
Creates a new coverage validator
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
hasInvalidResult(Geometry[] validateResult)
Tests if some element of an array of geometries is a coverage invalidity
indicator.
|
static boolean |
isValid(Geometry[] coverage)
Tests whether a polygonal coverage is valid.
|
void |
setGapWidth(double gapWidth)
Sets the maximum gap width, if narrow gaps are to be detected.
|
Geometry[] |
validate()
Validates the polygonal coverage.
|
static Geometry[] |
validate(Geometry[] coverage)
Validates that a set of polygons forms a valid polygonal coverage,
and returns linear geometries indicating the locations of invalidities, if any.
|
static Geometry[] |
validate(Geometry[] coverage,
double gapWidth)
Validates that a set of polygons forms a valid polygonal coverage
and contains no gaps narrower than a specified width.
|
public CoverageValidator(Geometry[] coverage)
coverage - a array of polygons representing a polygonal coveragepublic static boolean isValid(Geometry[] coverage)
coverage - an array of polygons forming a coveragepublic static boolean hasInvalidResult(Geometry[] validateResult)
validateResult - an array produced by a polygonal coverage validationpublic static Geometry[] validate(Geometry[] coverage)
coverage - an array of polygons forming a coveragepublic static Geometry[] validate(Geometry[] coverage, double gapWidth)
coverage - an array of polygons forming a coveragegapWidth - the maximum width of invalid gapspublic void setGapWidth(double gapWidth)
gapWidth - the maximum width of gaps to detectpublic Geometry[] validate()
Copyright © 2024. All rights reserved.