Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds the package geos::coverage containing classes for operating on Polygonal Coverages. CoverageValidator determines if a set of polygons forms a valid coverage and identifies locations of invalidity (and optionally narrow gaps) CoveragePolygonValidator determines if a single polygons forms a valid coverage with adjacent polygons, and identifies locations of invalidity (and optionally narrow gaps) CoverageGapFinder detects narrow gaps which form holes in a polygonal coverage CoverageUnion performs an efficient union of a set of polygons which form a coverage
- Loading branch information
Showing
34 changed files
with
3,267 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/********************************************************************** | ||
* | ||
* GEOS - Geometry Engine Open Source | ||
* http://geos.osgeo.org | ||
* | ||
* Copyright (C) 2022 Paul Ramsey <pramsey@cleverelephant.ca> | ||
* | ||
* This is free software; you can redistribute and/or modify it under | ||
* the terms of the GNU Lesser General Public Licence as published | ||
* by the Free Software Foundation. | ||
* See the COPYING file for more information. | ||
* | ||
**********************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include <geos/export.h> | ||
#include <vector> | ||
#include <memory> | ||
|
||
|
||
// Forward declarations | ||
namespace geos { | ||
namespace geom { | ||
class Geometry; | ||
class LinearRing; | ||
} | ||
} | ||
|
||
using geos::geom::Geometry; | ||
using geos::geom::LinearRing; | ||
|
||
|
||
namespace geos { // geos | ||
namespace coverage { // geos::coverage | ||
|
||
/** | ||
* Finds gaps in a polygonal coverage. | ||
* Gaps are holes in the coverage which are narrower than a given width. | ||
* | ||
* The coverage should be valid according to CoverageValidator. | ||
* If this is not the case, some gaps may not be reported, or the invocation may fail. | ||
* | ||
* This is a more accurate way of identifying gaps | ||
* than using CoverageValidator::setGapWidth(double). | ||
* Gaps which separate the coverage into two disjoint regions are not detected. | ||
* Gores are not identified as gaps. | ||
* | ||
* @author mdavis | ||
* | ||
*/ | ||
class GEOS_DLL CoverageGapFinder { | ||
|
||
private: | ||
|
||
std::vector<const Geometry*>& m_coverage; | ||
|
||
bool isGap(const LinearRing* hole, double gapWidth); | ||
|
||
|
||
public: | ||
|
||
/** | ||
* Creates a new polygonal coverage gap finder. | ||
* | ||
* @param coverage a set of polygons forming a polygonal coverage | ||
*/ | ||
CoverageGapFinder(std::vector<const Geometry*>& coverage) | ||
: m_coverage(coverage) | ||
{}; | ||
|
||
/** | ||
* Finds gaps in a polygonal coverage. | ||
* Returns lines indicating the locations of the gaps. | ||
* | ||
* @param coverage a set of polygons forming a polygonal coverage | ||
* @param gapWidth the maximum width of gap to detect | ||
* @return a geometry indicating the locations of gaps (which is empty if no gaps were found), or null if the coverage was empty | ||
*/ | ||
static std::unique_ptr<Geometry> findGaps( | ||
std::vector<const Geometry*>& coverage, | ||
double gapWidth); | ||
|
||
/** | ||
* Finds gaps in the coverage. | ||
* Returns lines indicating the locations of the gaps. | ||
* | ||
* @param gapWidth the maximum width of gap to detect | ||
* @return a geometry indicating the locations of gaps (which is empty if no gaps were found), or null if the coverage was empty | ||
*/ | ||
std::unique_ptr<Geometry> findGaps(double gapWidth); | ||
|
||
|
||
}; | ||
|
||
} // namespace geos::coverage | ||
} // namespace geos | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.