GEOS  3.13.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
21 namespace geos {
22 namespace geom {
23 class Geometry;
24 }
25 }
26 
28 using geos::index::strtree::TemplateSTRtree;
29 
30 namespace geos { // geos
31 namespace coverage { // geos::coverage
32 
33 
65 class GEOS_DLL CoverageValidator {
66 
67 private:
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 
77 public:
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:65
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)
static bool hasInvalidResult(const std::vector< std::unique_ptr< Geometry >> &validateResult)
void setGapWidth(double gapWidth)
Definition: CoverageValidator.h:93
static bool isValid(std::vector< const Geometry * > &coverage)
std::vector< std::unique_ptr< Geometry > > validate()
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:186
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25