GEOS 3.11.1
IndexedNestedPolygonTester.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2021 Paul Ramsey <pramsey@cleverelephant.ca>
7 * Copyright (C) 2021 Martin Davis
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************/
15
16#pragma once
17
18#include <geos/export.h>
19#include <geos/index/strtree/TemplateSTRtree.h>
20#include <geos/algorithm/locate/IndexedPointInAreaLocator.h>
21
22#include <memory>
23#include <map>
24
25// Forward declarations
26namespace geos {
27namespace geom {
28class Coordinate;
29class Polygon;
30class LinearRing;
31}
32}
33
34
35namespace geos { // geos.
36namespace operation { // geos.operation
37namespace valid { // geos.operation.valid
38
43using algorithm::locate::IndexedPointInAreaLocator;
44using index::strtree::TemplateSTRtree;
45
46class GEOS_DLL IndexedNestedPolygonTester {
47
48private:
49
50 const MultiPolygon* multiPoly;
51 TemplateSTRtree<const Polygon*> index;
52 // std::vector<IndexedPointInAreaLocator> locators;
53 std::map<const Polygon*, IndexedPointInAreaLocator> locators;
54 Coordinate nestedPt;
55
56 void loadIndex();
57
58 IndexedPointInAreaLocator& getLocator(const Polygon* poly);
59
60 bool findNestedPoint(const LinearRing* shell,
61 const Polygon* possibleOuterPoly,
62 IndexedPointInAreaLocator& locator,
63 Coordinate& coordNested);
64
75 static bool findIncidentSegmentNestedPoint(
76 const LinearRing* shell,
77 const Polygon* poly,
78 Coordinate& coordNested);
79
80 // Declare type as noncopyable
81 IndexedNestedPolygonTester(const IndexedNestedPolygonTester& other) = delete;
82 IndexedNestedPolygonTester& operator=(const IndexedNestedPolygonTester& rhs) = delete;
83
84public:
85
86 IndexedNestedPolygonTester(const MultiPolygon* p_multiPoly);
87
93 const Coordinate& getNestedPoint() const { return nestedPt; }
94
101 bool isNested();
102
103
104};
105
106
107
108} // namespace geos.operation.valid
109} // namespace geos.operation
110} // namespace geos
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition: LinearRing.h:55
Definition: MultiPolygon.h:59
Represents a linear polygon, which may include holes.
Definition: Polygon.h:61
Basic namespace for all GEOS functionalities.
Definition: geos.h:39