GEOS  3.14.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 #pragma once
20 
21 #include <geos/operation/polygonize/EdgeRing.h>
22 #include <geos/index/strtree/TemplateSTRtree.h>
23 
24 #include <vector>
25 
26 namespace geos {
27 namespace operation {
28 namespace polygonize {
29 
37 class GEOS_DLL HoleAssigner {
38 public:
44  static void assignHolesToShells(std::vector<EdgeRing*> & holes, std::vector<EdgeRing*> & shells);
45 
46 private:
47  explicit HoleAssigner(std::vector<EdgeRing*> & shells) : m_shells(shells) {
48  buildIndex();
49  }
50 
51  void assignHolesToShells(std::vector<EdgeRing*> & holes);
52  void assignHoleToShell(EdgeRing* holeER);
53  std::vector<EdgeRing*> findShells(const geom::Envelope & ringEnv);
54 
55  EdgeRing* findEdgeRingContaining(EdgeRing* testER);
56 
57  void buildIndex();
58 
59  std::vector<EdgeRing*>& m_shells;
60  geos::index::strtree::TemplateSTRtree<EdgeRing*> m_shellIndex;
61 };
62 }
63 }
64 }
65 
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:59
Represents a ring of PolygonizeDirectedEdge which form a ring of a polygon. The ring may be either an...
Definition: operation/polygonize/EdgeRing.h:59
Assigns hole rings to shell rings during polygonization.
Definition: HoleAssigner.h:37
static void assignHolesToShells(std::vector< EdgeRing * > &holes, std::vector< EdgeRing * > &shells)
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25