/********************************************************************** * * GEOS - Geometry Engine Open Source * http://geos.osgeo.org * * Copyright (C) 2019 Daniel Baston * * 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. * ********************************************************************** * * Last port: operation/polygonize/HoleAssigner.java 0b3c7e3eb0d3e * **********************************************************************/ #pragma once #include #include #include namespace geos { namespace operation { namespace polygonize { /** \brief * Assigns hole rings to shell rings during polygonization. * * Uses spatial indexing to improve performance of shell lookup. * * @author mdavis */ class GEOS_DLL HoleAssigner { public: /** * Assigns hole rings to shell rings * @param holes list of hole rings to assign * @param shells list of shell rings */ static void assignHolesToShells(std::vector & holes, std::vector & shells); private: explicit HoleAssigner(std::vector & shells) : m_shells(shells) { buildIndex(); } void assignHolesToShells(std::vector & holes); void assignHoleToShell(EdgeRing* holeER); std::vector findShells(const geom::Envelope & ringEnv); EdgeRing* findEdgeRingContaining(EdgeRing* testER); void buildIndex(); std::vector& m_shells; geos::index::strtree::TemplateSTRtree m_shellIndex; }; } } }