GEOS 3.14.0dev
CoverageValidator.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2022 Paul Ramsey <pramsey@cleverelephant.ca>
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************/
14
15#pragma once
16
17#include <geos/index/strtree/TemplateSTRtree.h>
18
19
20// Forward declarations
21namespace geos {
22namespace geom {
23class Geometry;
24}
25}
26
27namespace geos { // geos
28namespace coverage { // geos::coverage
29
30
62class GEOS_DLL CoverageValidator {
64 template <typename ItemType>
65 using TemplateSTRtree = geos::index::strtree::TemplateSTRtree<ItemType>;
66
67private:
68
69 std::vector<const Geometry*>& m_coverage;
70 double m_gapWidth = 0.0;
71
72 std::unique_ptr<Geometry> validate(
73 const Geometry* targetGeom,
74 TemplateSTRtree<const Geometry*>& index);
75
76
77public:
78
79 /*
80 * Creates a new coverage validator
81 *
82 * @param coverage a array of polygons representing a polygonal coverage
83 */
84 CoverageValidator(std::vector<const Geometry*>& coverage)
85 : m_coverage(coverage)
86 {};
87
93 void setGapWidth(double gapWidth) {
94 m_gapWidth = gapWidth;
95 };
96
107 std::vector<std::unique_ptr<Geometry>> validate();
108
115 static bool isValid(
116 std::vector<const Geometry*>& coverage);
117
125 static bool hasInvalidResult(
126 const std::vector<std::unique_ptr<Geometry>>& validateResult);
127
138 static std::vector<std::unique_ptr<Geometry>> validate(
139 std::vector<const Geometry*>& coverage);
140
153 static std::vector<std::unique_ptr<Geometry>> validate(
154 std::vector<const Geometry*>& coverage,
155 double gapWidth);
156};
157
158} // namespace geos::coverage
159} // namespace geos
Definition CoverageValidator.h:62
static bool hasInvalidResult(const std::vector< std::unique_ptr< Geometry > > &validateResult)
std::vector< std::unique_ptr< Geometry > > validate()
static std::vector< std::unique_ptr< Geometry > > validate(std::vector< const Geometry * > &coverage, double gapWidth)
static std::vector< std::unique_ptr< Geometry > > validate(std::vector< const Geometry * > &coverage)
void setGapWidth(double gapWidth)
Definition CoverageValidator.h:93
static bool isValid(std::vector< const Geometry * > &coverage)
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:197
Basic namespace for all GEOS functionalities.
Definition geos.h:39