geos::coverage::CoverageValidator Class Reference

`#include <CoverageValidator.h>`

## Public Member Functions

| CoverageValidator (std::vector< const Geometry * > &coverage)
void | setGapWidth (double gapWidth)
std::vector< std::unique_ptr< Geometry > > | validate ()

## Static Public Member Functions

static bool | isValid (std::vector< const Geometry * > &coverage)
static bool | isValid (std::vector< const Geometry * > &coverage, double gapWidth)
static bool | hasInvalidResult (const std::vector< std::unique_ptr< Geometry > > &validateResult)
static std::vector< std::unique_ptr< Geometry > > | validate (std::vector< const Geometry * > &coverage)
static std::vector< std::unique_ptr< Geometry > > | validate (std::vector< const Geometry * > &coverage, double gapWidth)

## Detailed Description

Validates a polygonal coverage, and returns the locations of invalid polygon boundary segments if found.

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:

- The interiors of all polygons do not intersect (are disjoint). This is the case if no polygon has a boundary which intersects the interior of another polygon, and no two polygons are identical.
- If the boundaries of polygons intersect, the vertices and line segments of the intersection match exactly.

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.

Author
  Martin Davis

## Member Function Documentation

## hasInvalidResult()

bool geos::coverage::CoverageValidator::hasInvalidResult | ( | const std::vector< std::unique_ptr< Geometry > > & | validateResult | ) |

static

Tests if some element of an array of geometries is a coverage invalidity indicator.

Parameters

  validateResult | an array produced by a polygonal coverage validation

Returns
  true if the result has at least one invalid indicator

## isValid() [1/2]

bool geos::coverage::CoverageValidator::isValid | ( | std::vector< const Geometry * > & | coverage | ) |

static

Tests whether a polygonal coverage is valid.

Parameters

  coverage | an array of polygons forming a coverage

Returns
  true if the coverage is valid

## isValid() [2/2]

bool geos::coverage::CoverageValidator::isValid | ( | std::vector< const Geometry * > & | coverage,
|  | double | gapWidth )

static

Tests whether a polygonal coverage is valid and contains no gaps narrower than a specified width.

Parameters

  coverage | an array of polygons forming a coverage
  gapWidth | the maximum width of invalid gaps

Returns
  true if the coverage is valid with no narrow gaps

## setGapWidth()

void geos::coverage::CoverageValidator::setGapWidth | ( | double | gapWidth | ) |

inline

Sets the maximum gap width, if narrow gaps are to be detected.

Parameters

  gapWidth | the maximum width of gaps to detect

## validate() [1/3]

std::vector< std::unique_ptr< Geometry > > geos::coverage::CoverageValidator::validate | ( |  | ) |

Validates the polygonal coverage. The result is an array of the same size as the input coverage. Each array entry is either null, or if the polygon does not form a valid coverage, a linear geometry containing the boundary segments which intersect polygon interiors, which are mismatched, or form gaps (if checked).

Returns
  an array of nulls or linear geometries

## validate() [2/3]

std::vector< std::unique_ptr< Geometry > > geos::coverage::CoverageValidator::validate | ( | std::vector< const Geometry * > & | coverage | ) |

static

Validates that a set of polygons forms a valid polygonal coverage. The result is a list of the same length as the input, containing for each input geometry either a linear geometry indicating the locations of invalidities, or a null if the geometry is coverage-valid.

Parameters

  coverage | an array of polygons forming a coverage

Returns
  an array of linear geometries indicating coverage errors, or nulls

## validate() [3/3]

std::vector< std::unique_ptr< Geometry > > geos::coverage::CoverageValidator::validate | ( | std::vector< const Geometry * > & | coverage,
|  | double | gapWidth )

static

Validates that a set of polygons forms a valid polygonal coverage and contains no gaps narrower than a specified width. The result is a list of the same length as the input, containing for each input geometry either a linear geometry indicating the locations of invalidities, or a null if the geometry is coverage-valid.

Parameters

  coverage | an array of polygons forming a coverage
  gapWidth | the maximum width of invalid gaps

Returns
  an array of linear geometries indicating coverage errors, or nulls

The documentation for this class was generated from the following file:

- CoverageValidator.h