GEOS  3.9.0dev
HoleAssigner.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2019 Daniel Baston <dbaston@gmail.com>
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  * Last port: operation/polygonize/HoleAssigner.java 0b3c7e3eb0d3e
16  *
17  **********************************************************************/
18 
19 #ifndef GEOS_OP_POLYGONIZE_HOLEASSIGNER_H
20 #define GEOS_OP_POLYGONIZE_HOLEASSIGNER_H
21 
22 #include <geos/operation/polygonize/EdgeRing.h>
23 #include <geos/index/strtree/STRtree.h>
24 
25 #include <vector>
26 
27 namespace geos {
28 namespace operation {
29 namespace polygonize {
30 
38 class GEOS_DLL HoleAssigner {
39 public:
45  static void assignHolesToShells(std::vector<EdgeRing*> & holes, std::vector<EdgeRing*> & shells);
46 
47 private:
48  explicit HoleAssigner(std::vector<EdgeRing*> & shells) : m_shells(shells) {
49  buildIndex();
50  }
51 
52  void assignHolesToShells(std::vector<EdgeRing*> & holes);
53  void assignHoleToShell(EdgeRing* holeER);
54  std::vector<EdgeRing*> findShells(const geom::Envelope & ringEnv);
55 
56  EdgeRing* findEdgeRingContaining(EdgeRing* testER);
57 
58  void buildIndex();
59 
60  std::vector<EdgeRing*>& m_shells;
61  geos::index::strtree::STRtree m_shellIndex;
62 };
63 }
64 }
65 }
66 
67 #endif
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
Assigns hole rings to shell rings during polygonization.
Definition: HoleAssigner.h:38
A query-only R-tree created using the Sort-Tile-Recursive (STR) algorithm. For two-dimensional spatia...
Definition: STRtree.h:64
Represents a ring of PolygonizeDirectedEdge which form a ring of a polygon. The ring may be either an...
Definition: operation/polygonize/EdgeRing.h:66
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26