IndexedNestedPolygonTester.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2021 Paul Ramsey <pramsey@cleverelephant.ca>
* Copyright (C) 2021 Martin Davis
*
* 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 <geos/index/strtree/TemplateSTRtree.h>
#include <geos/algorithm/locate/IndexedPointInAreaLocator.h>
#include <memory>
#include <map>
// Forward declarations
namespace geos {
namespace geom {
class Coordinate;
class Polygon;
class LinearRing;
class MultiPolygon;
}
}
namespace geos { // geos.
namespace operation { // geos.operation
namespace valid { // geos.operation.valid
class GEOS_DLL IndexedNestedPolygonTester {
using Polygon = geos::geom::Polygon;
using MultiPolygon = geos::geom::MultiPolygon;
using LinearRing = geos::geom::LinearRing;
using CoordinateXY = geos::geom::CoordinateXY;
using IndexedPointInAreaLocator = algorithm::locate::IndexedPointInAreaLocator;
template<typename ItemType>
using TemplateSTRtree = index::strtree::TemplateSTRtree<ItemType>;
private:
const MultiPolygon* multiPoly;
TemplateSTRtree<const Polygon*> index;
// std::vector<IndexedPointInAreaLocator> locators;
std::map<const Polygon*, IndexedPointInAreaLocator> locators;
CoordinateXY nestedPt;
void loadIndex();
IndexedPointInAreaLocator& getLocator(const Polygon* poly);
bool findNestedPoint(const LinearRing* shell,
const Polygon* possibleOuterPoly,
IndexedPointInAreaLocator& locator,
CoordinateXY& coordNested);
static bool findIncidentSegmentNestedPoint(
const LinearRing* shell,
const Polygon* poly,
CoordinateXY& coordNested);
// Declare type as noncopyable
IndexedNestedPolygonTester(const IndexedNestedPolygonTester& other) = delete;
IndexedNestedPolygonTester& operator=(const IndexedNestedPolygonTester& rhs) = delete;
public:
IndexedNestedPolygonTester(const MultiPolygon* p_multiPoly);
const CoordinateXY& getNestedPoint() const { return nestedPt; }
bool isNested();
};
} // namespace geos.operation.valid
} // namespace geos.operation
} // namespace geos
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
geos::geom::LinearRing
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition LinearRing.h:54
geos::geom::MultiPolygon
Definition MultiPolygon.h:58
geos::geom::Polygon
Represents a linear polygon, which may include holes.
Definition Polygon.h:61
geos::geom
Definition Angle.h:26
geos::operation::valid
Provides classes for testing the validity of geometries.
Definition namespaces.h:289
geos::operation
Provides classes for implementing operations on geometries.
Definition CleanCoverage.h:34
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38