public class CoveragePolygonValidator extends Object
LineString is returned.
Otherwise, the result is a linear geometry containing
the target polygon boundary linework causing the invalidity.
A polygon is coverage-valid if:
The algorithm detects the following coverage errors:
If any of these errors is present, the target polygon does not form a valid coverage with the adjacent polygons.
The validity rules do not preclude properly-noded gaps between coverage polygons.
However, this class can detect narrow gaps,
by specifying a maximum gap width using setGapWidth(double).
Note that this will also identify narrow gaps separating disjoint coverage regions,
and narrow gores.
In some situations it may also produce false positives
(i.e. linework identified as part of a gap which is wider than the given width).
To fully identify gaps it maybe necessary to use CoverageUnion and analyze
the holes in the result to see if they are acceptable.
A polygon may be coverage-valid with respect to
a set of surrounding polygons, but the collection as a whole may not
form a clean coverage. For example, the target polygon boundary may be fully matched
by adjacent boundary segments, but the adjacent set contains polygons
which are not coverage-valid relative to other ones in the set.
A coverage is valid only if every polygon in the coverage is coverage-valid.
Use CoverageValidator to validate an entire set of polygons.
The adjacent set may contain polygons which do not intersect the target polygon. These are effectively ignored during validation (but may decrease performance).
CoverageValidator| Constructor and Description |
|---|
CoveragePolygonValidator(Geometry geom,
Geometry[] adjGeoms)
Create a new validator.
|
| Modifier and Type | Method and Description |
|---|---|
void |
setGapWidth(double gapWidth)
Sets the maximum gap width, if narrow gaps are to be detected.
|
Geometry |
validate()
Validates the coverage polygon against the set of adjacent polygons
in the coverage.
|
static Geometry |
validate(Geometry targetPolygon,
Geometry[] adjPolygons)
Validates that a polygon is coverage-valid against the
surrounding polygons in a polygonal coverage.
|
static Geometry |
validate(Geometry targetPolygon,
Geometry[] adjPolygons,
double gapWidth)
Validates that a polygon is coverage-valid against the
surrounding polygons in a polygonal coverage,
and forms no gaps narrower than a specified width.
|
public CoveragePolygonValidator(Geometry geom, Geometry[] adjGeoms)
If the gap width is specified, the set of surrounding polygons should include all polygons which are within the gap width distance of the target polygon.
geom - the geometry to validateadjGeoms - the adjacent polygons in the polygonal coveragepublic static Geometry validate(Geometry targetPolygon, Geometry[] adjPolygons)
targetPolygon - the polygon to validateadjPolygons - the adjacent polygonspublic static Geometry validate(Geometry targetPolygon, Geometry[] adjPolygons, double gapWidth)
The set of surrounding polygons should include all polygons which are within the gap width distance of the target polygon.
targetPolygon - the polygon to validateadjPolygons - a collection of the adjacent polygonsgapWidth - the maximum width of invalid gapspublic void setGapWidth(double gapWidth)
gapWidth - the maximum width of gaps to detectpublic Geometry validate()
adjGeoms - the surrounding polygons in the coverageCopyright © 2024. All rights reserved.