CoverageValidator.h
/**********************************************************************
*
* 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/index/strtree/TemplateSTRtree.h>
// Forward declarations
namespace geos {
namespace geom {
class Geometry;
}
}
namespace geos { // geos
namespace coverage { // geos::coverage
class GEOS_DLL CoverageValidator {
using Geometry = geos::geom::Geometry;
template <typename ItemType>
using TemplateSTRtree = geos::index::strtree::TemplateSTRtree<ItemType>;
private:
std::vector<const Geometry*>& m_coverage;
double m_gapWidth = 0.0;
std::unique_ptr<Geometry> validate(
const Geometry* targetGeom,
TemplateSTRtree<const Geometry*>& index);
public:
/*
* Creates a new coverage validator
*
* @param coverage a array of polygons representing a polygonal coverage
*/
CoverageValidator(std::vector<const Geometry*>& coverage)
: m_coverage(coverage)
{};
void setGapWidth(double gapWidth) {
m_gapWidth = gapWidth;
};
std::vector<std::unique_ptr<Geometry>> validate();
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);
};
} // namespace geos::coverage
} // namespace geos
geos::coverage::CoverageValidator::hasInvalidResult
static bool hasInvalidResult(const std::vector< std::unique_ptr< Geometry > > &validateResult)
geos::coverage::CoverageValidator::validate
std::vector< std::unique_ptr< Geometry > > validate()
geos::coverage::CoverageValidator::validate
static std::vector< std::unique_ptr< Geometry > > validate(std::vector< const Geometry * > &coverage, double gapWidth)
geos::coverage::CoverageValidator::isValid
static bool isValid(std::vector< const Geometry * > &coverage, double gapWidth)
geos::coverage::CoverageValidator::validate
static std::vector< std::unique_ptr< Geometry > > validate(std::vector< const Geometry * > &coverage)
geos::coverage::CoverageValidator::setGapWidth
void setGapWidth(double gapWidth)
Definition CoverageValidator.h:93
geos::coverage::CoverageValidator::isValid
static bool isValid(std::vector< const Geometry * > &coverage)
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:196
geos::geom
Definition Angle.h:26
geos::index
Provides classes for various kinds of spatial indexes.
Definition CleanCoverage.h:39
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38