[geos-commits] [SCM] GEOS branch 3.13 updated. f92d697680a281f8cc26d5591b42ffa8efc7818b

git at osgeo.org git at osgeo.org
Wed Feb 12 16:15:22 PST 2025


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".

The branch, 3.13 has been updated
       via  f92d697680a281f8cc26d5591b42ffa8efc7818b (commit)
      from  d95a5158ff68eceb18a7327dea993e26b50aad8d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f92d697680a281f8cc26d5591b42ffa8efc7818b
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Wed Feb 12 15:58:41 2025 -0800

    Remove obsolete overlay files

diff --git a/include/geos/operation/overlay/MaximalEdgeRing.h b/include/geos/operation/overlay/MaximalEdgeRing.h
deleted file mode 100644
index ad918dfce..000000000
--- a/include/geos/operation/overlay/MaximalEdgeRing.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/**********************************************************************
- *
- * GEOS - Geometry Engine Open Source
- * http://geos.osgeo.org
- *
- * Copyright (C) 2006 Refractions Research Inc.
- *
- * 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/overlay/MaximalEdgeRing.java rev. 1.15 (JTS-1.10)
- *
- **********************************************************************/
-
-#pragma once
-
-#include <geos/export.h>
-
-#include <vector>
-
-#include <geos/geomgraph/EdgeRing.h> // for inheritance
-
-// Forward declarations
-namespace geos {
-namespace geom {
-class GeometryFactory;
-}
-namespace geomgraph {
-class DirectedEdge;
-//class EdgeRing;
-}
-namespace operation {
-namespace overlay {
-class MinimalEdgeRing;
-}
-}
-}
-
-namespace geos {
-namespace operation { // geos::operation
-namespace overlay { // geos::operation::overlay
-
-/** \brief
- * A ring of [DirectedEdges](@ref geomgraph::DirectedEdge) which may contain nodes of degree > 2.
- *
- * A MaximalEdgeRing may represent two different spatial entities:
- *
- * - a single polygon possibly containing inversions (if the ring is oriented CW)
- * - a single hole possibly containing exversions (if the ring is oriented CCW)
- *
- * If the MaximalEdgeRing represents a polygon,
- * the interior of the polygon is strongly connected.
- *
- * These are the form of rings used to define polygons under some spatial data models.
- * However, under the OGC SFS model, [MinimalEdgeRings](@ref MinimalEdgeRing) are required.
- * A MaximalEdgeRing can be converted to a list of MinimalEdgeRings using the
- * {@link #buildMinimalRings() } method.
- *
- * @see com.vividsolutions.jts.operation.overlay.MinimalEdgeRing
- */
-class GEOS_DLL MaximalEdgeRing: public geomgraph::EdgeRing {
-
-public:
-
-    MaximalEdgeRing(geomgraph::DirectedEdge* start,
-                    const geom::GeometryFactory* geometryFactory);
-    // throw(const TopologyException &)
-
-    ~MaximalEdgeRing() override = default;
-
-    geomgraph::DirectedEdge* getNext(geomgraph::DirectedEdge* de) override;
-
-    void setEdgeRing(geomgraph::DirectedEdge* de, geomgraph::EdgeRing* er) override;
-
-    /// \brief
-    /// This function returns a newly allocated vector of
-    /// pointers to newly allocated MinimalEdgeRing objects.
-    ///
-    /// @deprecated pass the vector yourself instead
-    ///
-    std::vector<MinimalEdgeRing*>* buildMinimalRings();
-
-    /// \brief
-    /// This function pushes pointers to newly allocated  MinimalEdgeRing
-    /// objects to the provided vector.
-    ///
-    void buildMinimalRings(std::vector<MinimalEdgeRing*>& minEdgeRings);
-    void buildMinimalRings(std::vector<EdgeRing*>& minEdgeRings);
-
-    /// \brief
-    /// For all nodes in this EdgeRing,
-    /// link the DirectedEdges at the node to form minimalEdgeRings
-    ///
-    void linkDirectedEdgesForMinimalEdgeRings();
-};
-
-
-} // namespace geos::operation::overlay
-} // namespace geos::operation
-} // namespace geos
-
diff --git a/include/geos/operation/overlay/MinimalEdgeRing.h b/include/geos/operation/overlay/MinimalEdgeRing.h
deleted file mode 100644
index c2df90eab..000000000
--- a/include/geos/operation/overlay/MinimalEdgeRing.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/**********************************************************************
- *
- * GEOS - Geometry Engine Open Source
- * http://geos.osgeo.org
- *
- * Copyright (C) 2006 Refractions Research Inc.
- *
- * 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/overlay/MinimalEdgeRing.java rev. 1.13 (JTS-1.10)
- *
- **********************************************************************/
-
-#pragma once
-
-
-#include <geos/export.h>
-
-#include <geos/geomgraph/EdgeRing.h> // for inheritance
-#include <geos/geomgraph/DirectedEdge.h> // for inlines
-
-#include <vector>
-
-// Forward declarations
-namespace geos {
-namespace geom {
-class GeometryFactory;
-}
-namespace geomgraph {
-class DirectedEdge;
-class EdgeRing;
-}
-}
-
-namespace geos {
-namespace operation { // geos::operation
-namespace overlay { // geos::operation::overlay
-
-/** \brief
- * A ring of [Edges](@ref geomgraph::Edge) with the property that no node
- * has degree greater than 2.
- *
- * These are the form of rings required to represent polygons
- * under the OGC SFS spatial data model.
- *
- * @see operation::overlay::MaximalEdgeRing
- *
- */
-class GEOS_DLL MinimalEdgeRing: public geomgraph::EdgeRing {
-
-public:
-
-    MinimalEdgeRing(geomgraph::DirectedEdge* start,
-                    const geom::GeometryFactory* geometryFactory);
-
-    ~MinimalEdgeRing() override {};
-
-    geomgraph::DirectedEdge* getNext(geomgraph::DirectedEdge* de) override
-    {
-        return de->getNextMin();
-    };
-
-    void setEdgeRing(geomgraph::DirectedEdge* de,
-                     geomgraph::EdgeRing* er) override
-    {
-        de->setMinEdgeRing(er);
-    };
-
-};
-
-
-} // namespace geos::operation::overlay
-} // namespace geos::operation
-} // namespace geos
-
diff --git a/include/geos/operation/overlay/OverlayNodeFactory.h b/include/geos/operation/overlay/OverlayNodeFactory.h
deleted file mode 100644
index 74ba8d955..000000000
--- a/include/geos/operation/overlay/OverlayNodeFactory.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/**********************************************************************
- *
- * GEOS - Geometry Engine Open Source
- * http://geos.osgeo.org
- *
- * Copyright (C) 2006 Refractions Research Inc.
- *
- * 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/overlay/OverlayNodeFactory.java rev. 1.11 (JTS-1.10)
- *
- **********************************************************************/
-
-#pragma once
-
-#include <geos/export.h>
-
-#include <vector>
-
-#include <geos/geomgraph/NodeFactory.h> // for inheritance
-
-// Forward declarations
-namespace geos {
-namespace geom {
-class Coordinate;
-}
-namespace geomgraph {
-class Node;
-}
-}
-
-namespace geos {
-namespace operation { // geos::operation
-namespace overlay { // geos::operation::overlay
-
-/** \brief
- * Creates nodes for use in the geomgraph::PlanarGraph constructed during
- * overlay operations. NOTE: also used by operation::valid
- */
-class GEOS_DLL OverlayNodeFactory: public geomgraph::NodeFactory {
-public:
-    OverlayNodeFactory(): geomgraph::NodeFactory() {}
-    geomgraph::Node* createNode(const geom::Coordinate& coord) const override;
-    static const geomgraph::NodeFactory& instance();
-};
-
-
-} // namespace geos::operation::overlay
-} // namespace geos::operation
-} // namespace geos
-
diff --git a/include/geos/operation/overlay/PolygonBuilder.h b/include/geos/operation/overlay/PolygonBuilder.h
deleted file mode 100644
index e39e9b6c0..000000000
--- a/include/geos/operation/overlay/PolygonBuilder.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/**********************************************************************
- *
- * GEOS - Geometry Engine Open Source
- * http://geos.osgeo.org
- *
- * Copyright (C) 2006 Refractions Research Inc.
- *
- * 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/overlay/PolygonBuilder.java rev. 1.20 (JTS-1.10)
- *
- **********************************************************************/
-
-#pragma once
-
-#include <geos/export.h>
-#include <geos/algorithm/locate/IndexedPointInAreaLocator.h>
-
-#include <vector>
-
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
-#endif
-
-// Forward declarations
-namespace geos {
-namespace geom {
-class Geometry;
-class Coordinate;
-class GeometryFactory;
-}
-namespace geomgraph {
-class EdgeRing;
-class Node;
-class PlanarGraph;
-class DirectedEdge;
-}
-namespace operation {
-namespace overlay {
-class MaximalEdgeRing;
-class MinimalEdgeRing;
-}
-}
-}
-
-namespace geos {
-namespace operation { // geos::operation
-namespace overlay { // geos::operation::overlay
-
-/** \brief
- * Forms Polygon out of a graph of geomgraph::DirectedEdge.
- *
- * The edges to use are marked as being in the result Area.
- */
-class GEOS_DLL PolygonBuilder {
-public:
-
-    PolygonBuilder(const geom::GeometryFactory* newGeometryFactory);
-
-    ~PolygonBuilder();
-
-    /**
-     * Add a complete graph.
-     * The graph is assumed to contain one or more polygons,
-     * possibly with holes.
-     */
-    void add(geomgraph::PlanarGraph* graph);
-    // throw(const TopologyException &)
-
-    /**
-     * Add a set of edges and nodes, which form a graph.
-     * The graph is assumed to contain one or more polygons,
-     * possibly with holes.
-     */
-    void add(const std::vector<geomgraph::DirectedEdge*>* dirEdges,
-             const std::vector<geomgraph::Node*>* nodes);
-    // throw(const TopologyException &)
-
-    std::vector<std::unique_ptr<geom::Geometry>> getPolygons();
-
-private:
-
-    const geom::GeometryFactory* geometryFactory;
-
-    std::vector<geomgraph::EdgeRing*> shellList;
-
-    /**
-     * For all DirectedEdges in result, form them into MaximalEdgeRings
-     *
-     * @param maxEdgeRings
-     *   Formed MaximalEdgeRings will be pushed to this vector.
-     *   Ownership of the elements is transferred to caller.
-     */
-    void buildMaximalEdgeRings(
-        const std::vector<geomgraph::DirectedEdge*>* dirEdges,
-        std::vector<MaximalEdgeRing*>& maxEdgeRings);
-    // throw(const TopologyException &)
-
-    void buildMinimalEdgeRings(
-        std::vector<MaximalEdgeRing*>& maxEdgeRings,
-        std::vector<geomgraph::EdgeRing*>& newShellList,
-        std::vector<geomgraph::EdgeRing*>& freeHoleList,
-        std::vector<MaximalEdgeRing*>& edgeRings);
-
-    /**
-     * This method takes a list of MinimalEdgeRings derived from a
-     * MaximalEdgeRing, and tests whether they form a Polygon.
-     * This is the case if there is a single shell
-     * in the list.  In this case the shell is returned.
-     * The other possibility is that they are a series of connected
-     * holes, in which case no shell is returned.
-     *
-     * @return the shell geomgraph::EdgeRing, if there is one
-     * @return NULL, if all the rings are holes
-     */
-    geomgraph::EdgeRing* findShell(std::vector<MinimalEdgeRing*>* minEdgeRings);
-
-    /**
-     * This method assigns the holes for a Polygon (formed from a list of
-     * MinimalEdgeRings) to its shell.
-     * Determining the holes for a MinimalEdgeRing polygon serves two
-     * purposes:
-     *
-     *  - it is faster than using a point-in-polygon check later on.
-     *  - it ensures correctness, since if the PIP test was used the point
-     *    chosen might lie on the shell, which might return an incorrect
-     *    result from the PIP test
-     */
-    void placePolygonHoles(geomgraph::EdgeRing* shell,
-                           std::vector<MinimalEdgeRing*>* minEdgeRings);
-
-    /**
-     * For all rings in the input list,
-     * determine whether the ring is a shell or a hole
-     * and add it to the appropriate list.
-     * Due to the way the DirectedEdges were linked,
-     * a ring is a shell if it is oriented CW, a hole otherwise.
-     */
-    void sortShellsAndHoles(std::vector<MaximalEdgeRing*>& edgeRings,
-                            std::vector<geomgraph::EdgeRing*>& newShellList,
-                            std::vector<geomgraph::EdgeRing*>& freeHoleList);
-
-    struct FastPIPRing {
-        geomgraph::EdgeRing* edgeRing;
-        algorithm::locate::IndexedPointInAreaLocator* pipLocator;
-    };
-
-    /** \brief
-     * This method determines finds a containing shell for all holes
-     * which have not yet been assigned to a shell.
-     *
-     * These "free" holes should all be <b>properly</b> contained in
-     * their parent shells, so it is safe to use the
-     * <code>findEdgeRingContaining</code> method.
-     * This is the case because any holes which are NOT
-     * properly contained (i.e. are connected to their
-     * parent shell) would have formed part of a MaximalEdgeRing
-     * and been handled in a previous step.
-     *
-     * @throws TopologyException if a hole cannot be assigned to a shell
-     */
-    void placeFreeHoles(std::vector<FastPIPRing>& newShellList,
-                        std::vector<geomgraph::EdgeRing*>& freeHoleList);
-    // throw(const TopologyException&)
-
-    /** \brief
-     * Find the innermost enclosing shell geomgraph::EdgeRing containing the
-     * argument geomgraph::EdgeRing, if any.
-     *
-     * The innermost enclosing ring is the <i>smallest</i> enclosing ring.
-     * The algorithm used depends on the fact that:
-     *
-     * ring A contains ring B iff envelope(ring A)
-     * contains envelope(ring B)
-     *
-     * This routine is only safe to use if the chosen point of the hole
-     * is known to be properly contained in a shell
-     * (which is guaranteed to be the case if the hole does not touch
-     * its shell)
-     *
-     * @return containing geomgraph::EdgeRing, if there is one
-     * @return NULL if no containing geomgraph::EdgeRing is found
-     */
-    geomgraph::EdgeRing* findEdgeRingContaining(geomgraph::EdgeRing* testEr,
-            std::vector<FastPIPRing>& newShellList);
-
-    std::vector<std::unique_ptr<geom::Geometry>> computePolygons(
-        std::vector<geomgraph::EdgeRing*>& newShellList);
-
-    /**
-     * Checks the current set of shells (with their associated holes) to
-     * see if any of them contain the point.
-     */
-
-};
-
-} // namespace geos::operation::overlay
-} // namespace geos::operation
-} // namespace geos
-
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
diff --git a/src/operation/overlay/MaximalEdgeRing.cpp b/src/operation/overlay/MaximalEdgeRing.cpp
deleted file mode 100644
index 6221944e1..000000000
--- a/src/operation/overlay/MaximalEdgeRing.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/**********************************************************************
- *
- * GEOS - Geometry Engine Open Source
- * http://geos.osgeo.org
- *
- * Copyright (C) 2005-2006 Refractions Research Inc.
- * Copyright (C) 2001-2002 Vivid Solutions Inc.
- *
- * 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/overlay/MaximalEdgeRing.java rev. 1.15 (JTS-1.10)
- *
- **********************************************************************/
-
-#include <geos/operation/overlay/MaximalEdgeRing.h>
-#include <geos/operation/overlay/MinimalEdgeRing.h>
-#include <geos/geomgraph/EdgeRing.h>
-#include <geos/geomgraph/DirectedEdge.h>
-#include <geos/geomgraph/Node.h>
-#include <geos/geomgraph/EdgeEndStar.h>
-#include <geos/geomgraph/DirectedEdgeStar.h>
-#include <geos/util.h>
-
-#include <cassert>
-#include <vector>
-
-#ifndef GEOS_DEBUG
-#define GEOS_DEBUG 0
-#endif
-
-#if GEOS_DEBUG
-#include <iostream>
-#endif
-
-
-using namespace geos::geomgraph;
-using namespace geos::geom;
-
-namespace geos {
-namespace operation { // geos.operation
-namespace overlay { // geos.operation.overlay
-
-/*public*/
-MaximalEdgeRing::MaximalEdgeRing(DirectedEdge* start,
-                                 const GeometryFactory* p_geometryFactory)
-// throw(const TopologyException &)
-    :
-    EdgeRing(start, p_geometryFactory)
-{
-    computePoints(start);
-    computeRing();
-#if GEOS_DEBUG
-    std::cerr << "MaximalEdgeRing[" << this << "] ctor" << std::endl;
-#endif
-}
-
-/*public*/
-DirectedEdge*
-MaximalEdgeRing::getNext(DirectedEdge* de)
-{
-    return de->getNext();
-}
-
-/*public*/
-void
-MaximalEdgeRing::setEdgeRing(DirectedEdge* de, EdgeRing* er)
-{
-    de->setEdgeRing(er);
-}
-
-/*public*/
-void
-MaximalEdgeRing::linkDirectedEdgesForMinimalEdgeRings()
-{
-    DirectedEdge* de = startDe;
-    do {
-        Node* node = de->getNode();
-        EdgeEndStar* ees = node->getEdges();
-
-        DirectedEdgeStar* des = detail::down_cast<DirectedEdgeStar*>(ees);
-
-        des->linkMinimalDirectedEdges(this);
-
-        de = de->getNext();
-
-    }
-    while(de != startDe);
-}
-
-/*public*/
-std::vector<MinimalEdgeRing*>*
-MaximalEdgeRing::buildMinimalRings()
-{
-    std::vector<MinimalEdgeRing*>* minEdgeRings = new std::vector<MinimalEdgeRing*>;
-    buildMinimalRings(*minEdgeRings);
-    return minEdgeRings;
-}
-
-/*public*/
-void
-MaximalEdgeRing::buildMinimalRings(std::vector<MinimalEdgeRing*>& minEdgeRings)
-{
-    DirectedEdge* de = startDe;
-    do {
-        if(de->getMinEdgeRing() == nullptr) {
-            MinimalEdgeRing* minEr = new MinimalEdgeRing(de, geometryFactory);
-            minEdgeRings.push_back(minEr);
-        }
-        de = de->getNext();
-    }
-    while(de != startDe);
-}
-
-/*public*/
-void
-MaximalEdgeRing::buildMinimalRings(std::vector<EdgeRing*>& minEdgeRings)
-{
-    DirectedEdge* de = startDe;
-    do {
-        if(de->getMinEdgeRing() == nullptr) {
-            MinimalEdgeRing* minEr = new MinimalEdgeRing(de, geometryFactory);
-            minEdgeRings.push_back(minEr);
-        }
-        de = de->getNext();
-    }
-    while(de != startDe);
-}
-
-} // namespace geos.operation.overlay
-} // namespace geos.operation
-} // namespace geos
diff --git a/src/operation/overlay/MinimalEdgeRing.cpp b/src/operation/overlay/MinimalEdgeRing.cpp
deleted file mode 100644
index fd5cc2e72..000000000
--- a/src/operation/overlay/MinimalEdgeRing.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/**********************************************************************
- *
- * GEOS - Geometry Engine Open Source
- * http://geos.osgeo.org
- *
- * Copyright (C) 2001-2002 Vivid Solutions Inc.
- * Copyright (C) 2005 Refractions Research Inc.
- *
- * 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/overlay/MinimalEdgeRing.java rev. 1.13 (JTS-1.10)
- *
- **********************************************************************/
-
-#include <geos/operation/overlay/MinimalEdgeRing.h>
-#include <geos/geomgraph/EdgeRing.h>
-
-
-namespace geos {
-namespace operation { // geos.operation
-namespace overlay { // geos.operation.overlay
-
-
-MinimalEdgeRing::MinimalEdgeRing(geomgraph::DirectedEdge* start,
-                                 const geom::GeometryFactory* p_geometryFactory)
-    :
-    geomgraph::EdgeRing(start, p_geometryFactory)
-{
-    computePoints(start);
-    computeRing();
-}
-
-
-} // namespace geos.operation.overlay
-} // namespace geos.operation
-} // namespace geos
-
diff --git a/src/operation/overlay/OverlayNodeFactory.cpp b/src/operation/overlay/OverlayNodeFactory.cpp
deleted file mode 100644
index 095008da5..000000000
--- a/src/operation/overlay/OverlayNodeFactory.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/**********************************************************************
- *
- * GEOS - Geometry Engine Open Source
- * http://geos.osgeo.org
- *
- * Copyright (C) 2001-2002 Vivid Solutions Inc.
- * Copyright (C) 2005 Refractions Research Inc.
- *
- * 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/overlay/OverlayNodeFactory.java rev. 1.11 (JTS-1.10)
- *
- **********************************************************************/
-
-#include <geos/operation/overlay/OverlayNodeFactory.h>
-#include <geos/geomgraph/Node.h>
-#include <geos/geomgraph/DirectedEdgeStar.h>
-
-using namespace geos::geomgraph;
-
-namespace geos {
-namespace operation { // geos.operation
-namespace overlay { // geos.operation.overlay
-
-Node*
-OverlayNodeFactory::createNode(const geom::Coordinate& coord) const
-{
-    return new Node(coord, new DirectedEdgeStar());
-}
-
-const NodeFactory&
-OverlayNodeFactory::instance()
-{
-    static OverlayNodeFactory onf;
-    return onf;
-}
-
-} // namespace geos.operation.overlay
-} // namespace geos.operation
-} // namespace geos
-
diff --git a/src/operation/overlay/PolygonBuilder.cpp b/src/operation/overlay/PolygonBuilder.cpp
deleted file mode 100644
index e0223b432..000000000
--- a/src/operation/overlay/PolygonBuilder.cpp
+++ /dev/null
@@ -1,383 +0,0 @@
-/**********************************************************************
- *
- * GEOS - Geometry Engine Open Source
- * http://geos.osgeo.org
- *
- * Copyright (C) 2001-2002 Vivid Solutions Inc.
- * Copyright (C) 2005 Refractions Research Inc.
- *
- * 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/overlay/PolygonBuilder.java rev. 1.20 (JTS-1.10)
- *
- **********************************************************************/
-
-#include <geos/operation/overlay/PolygonBuilder.h>
-#include <geos/operation/overlay/MaximalEdgeRing.h>
-#include <geos/operation/overlay/MinimalEdgeRing.h>
-#include <geos/operation/polygonize/EdgeRing.h>
-#include <geos/geomgraph/Node.h>
-#include <geos/geomgraph/NodeMap.h>
-#include <geos/geomgraph/DirectedEdgeStar.h>
-#include <geos/geomgraph/PlanarGraph.h>
-#include <geos/geom/GeometryFactory.h>
-#include <geos/geom/LinearRing.h>
-#include <geos/geom/Polygon.h>
-#include <geos/algorithm/PointLocation.h>
-#include <geos/util/TopologyException.h>
-#include <geos/util/GEOSException.h>
-#include <geos/util.h>
-
-
-#include <vector>
-#include <cassert>
-
-#ifndef GEOS_DEBUG
-#define GEOS_DEBUG 0
-#endif
-
-#if GEOS_DEBUG
-#include <iostream>
-#endif
-
-using namespace geos::geomgraph;
-using namespace geos::algorithm;
-using namespace geos::geom;
-
-namespace geos {
-namespace operation { // geos.operation
-namespace overlay { // geos.operation.overlay
-
-PolygonBuilder::PolygonBuilder(const GeometryFactory* newGeometryFactory)
-    :
-    geometryFactory(newGeometryFactory)
-{
-}
-
-PolygonBuilder::~PolygonBuilder()
-{
-    for(std::size_t i = 0, n = shellList.size(); i < n; ++i) {
-        delete shellList[i];
-    }
-}
-
-/*public*/
-void
-PolygonBuilder::add(PlanarGraph* graph)
-//throw(TopologyException *)
-{
-    const std::vector<EdgeEnd*>* eeptr = graph->getEdgeEnds();
-    assert(eeptr);
-    const std::vector<EdgeEnd*>& ee = *eeptr;
-
-    std::size_t eeSize = ee.size();
-
-#if GEOS_DEBUG
-    std::cerr << __FUNCTION__ << ": PlanarGraph has " << eeSize << " EdgeEnds" << std::endl;
-#endif
-
-    std::vector<DirectedEdge*> dirEdges(eeSize);
-    for(std::size_t i = 0; i < eeSize; ++i) {
-        DirectedEdge* de = detail::down_cast<DirectedEdge*>(ee[i]);
-        dirEdges[i] = de;
-    }
-
-    const auto& nodeMap = graph->getNodeMap()->nodeMap;
-    std::vector<Node*> nodes;
-    nodes.reserve(nodeMap.size());
-    for(const auto& nodeIt: nodeMap) {
-        Node* node = nodeIt.second.get();
-        nodes.push_back(node);
-    }
-
-    add(&dirEdges, &nodes); // might throw a TopologyException *
-}
-
-/*public*/
-void
-PolygonBuilder::add(const std::vector<DirectedEdge*>* dirEdges,
-                    const std::vector<Node*>* nodes)
-//throw(TopologyException *)
-{
-    PlanarGraph::linkResultDirectedEdges(nodes->begin(), nodes->end());
-
-    std::vector<MaximalEdgeRing*> maxEdgeRings;
-    buildMaximalEdgeRings(dirEdges, maxEdgeRings);
-
-    std::vector<EdgeRing*> freeHoleList;
-    std::vector<MaximalEdgeRing*> edgeRings;
-    buildMinimalEdgeRings(maxEdgeRings, shellList, freeHoleList, edgeRings);
-
-    sortShellsAndHoles(edgeRings, shellList, freeHoleList);
-
-    std::vector<FastPIPRing> indexedshellist;
-    for(auto const& shell : shellList) {
-        FastPIPRing pipRing { shell, new geos::algorithm::locate::IndexedPointInAreaLocator(*shell->getLinearRing()) };
-        indexedshellist.push_back(pipRing);
-    }
-    placeFreeHoles(indexedshellist, freeHoleList);
-    //Assert: every hole on freeHoleList has a shell assigned to it
-
-    for(auto const& shell : indexedshellist) {
-        delete shell.pipLocator;
-    }
-}
-
-/*public*/
-std::vector<std::unique_ptr<Geometry>>
-PolygonBuilder::getPolygons()
-{
-    std::vector<std::unique_ptr<Geometry>> resultPolyList = computePolygons(shellList);
-    return resultPolyList;
-}
-
-
-/*private*/
-void
-PolygonBuilder::buildMaximalEdgeRings(const std::vector<DirectedEdge*>* dirEdges,
-                                      std::vector<MaximalEdgeRing*>& maxEdgeRings)
-// throw(const TopologyException &)
-{
-#if GEOS_DEBUG
-    std::cerr << "PolygonBuilder::buildMaximalEdgeRings got " << dirEdges->size() << " dirEdges" << std::endl;
-#endif
-
-    std::vector<MaximalEdgeRing*>::size_type oldSize = maxEdgeRings.size();
-
-    for(std::size_t i = 0, n = dirEdges->size(); i < n; i++) {
-        DirectedEdge* de = (*dirEdges)[i];
-#if GEOS_DEBUG
-        std::cerr << "  dirEdge " << i << std::endl
-             << de->printEdge() << std::endl
-             << " inResult:" << de->isInResult() << std::endl
-             << " isArea:" << de->getLabel().isArea() << std::endl;
-#endif
-        if(de->isInResult() && de->getLabel().isArea()) {
-            // if this edge has not yet been processed
-            if(de->getEdgeRing() == nullptr) {
-                MaximalEdgeRing* er;
-                try {
-                    // MaximalEdgeRing constructor may throw
-                    er = new MaximalEdgeRing(de, geometryFactory);
-                }
-                catch(util::GEOSException&) {
-                    // cleanup if that happens (see stmlf-cases-20061020.xml)
-                    for(std::size_t p_i = oldSize, p_n = maxEdgeRings.size(); p_i < p_n; p_i++) {
-                        delete maxEdgeRings[p_i];
-                    }
-                    //cerr << "Exception! " << e.what() << std::endl;
-                    throw;
-                }
-                maxEdgeRings.push_back(er);
-                er->setInResult();
-                //System.out.println("max node degree=" + er.getMaxDegree());
-            }
-        }
-    }
-#if GEOS_DEBUG
-    std::cerr << "  pushed " << maxEdgeRings.size() - oldSize << " maxEdgeRings" << std::endl;
-#endif
-}
-
-/*private*/
-void
-PolygonBuilder::buildMinimalEdgeRings(
-    std::vector<MaximalEdgeRing*>& maxEdgeRings,
-    std::vector<EdgeRing*>& newShellList, std::vector<EdgeRing*>& freeHoleList,
-    std::vector<MaximalEdgeRing*>& edgeRings)
-{
-    for(std::size_t i = 0, n = maxEdgeRings.size(); i < n; ++i) {
-        MaximalEdgeRing* er = maxEdgeRings[i];
-#if GEOS_DEBUG
-        std::cerr << "buildMinimalEdgeRings: maxEdgeRing " << i << " has " << er->getMaxNodeDegree() << " maxNodeDegree" << std::endl;
-#endif
-        if(er->getMaxNodeDegree() > 2) {
-            er->linkDirectedEdgesForMinimalEdgeRings();
-            std::vector<MinimalEdgeRing*> minEdgeRings;
-            er->buildMinimalRings(minEdgeRings);
-            // at this point we can go ahead and attempt to place
-            // holes, if this EdgeRing is a polygon
-            EdgeRing* shell = findShell(&minEdgeRings);
-            if(shell != nullptr) {
-                placePolygonHoles(shell, &minEdgeRings);
-                newShellList.push_back(shell);
-            }
-            else {
-                freeHoleList.insert(freeHoleList.end(),
-                                    minEdgeRings.begin(),
-                                    minEdgeRings.end());
-            }
-            delete er;
-        }
-        else {
-            edgeRings.push_back(er);
-        }
-    }
-}
-
-/*private*/
-EdgeRing*
-PolygonBuilder::findShell(std::vector<MinimalEdgeRing*>* minEdgeRings)
-{
-    int shellCount = 0;
-    EdgeRing* shell = nullptr;
-
-#if GEOS_DEBUG
-    std::cerr << "PolygonBuilder::findShell got " << minEdgeRings->size() << " minEdgeRings" << std::endl;
-#endif
-
-    for(std::size_t i = 0, n = minEdgeRings->size(); i < n; ++i) {
-        EdgeRing* er = (*minEdgeRings)[i];
-        if(! er->isHole()) {
-            shell = er;
-            ++shellCount;
-        }
-    }
-
-    if(shellCount > 1) {
-        throw util::TopologyException("found two shells in MinimalEdgeRing list");
-    }
-
-    return shell;
-}
-
-/*private*/
-void
-PolygonBuilder::placePolygonHoles(EdgeRing* shell,
-                                  std::vector<MinimalEdgeRing*>* minEdgeRings)
-{
-    for(std::size_t i = 0, n = minEdgeRings->size(); i < n; ++i) {
-        MinimalEdgeRing* er = (*minEdgeRings)[i];
-        if(er->isHole()) {
-            er->setShell(shell);
-        }
-    }
-}
-
-/*private*/
-void
-PolygonBuilder::sortShellsAndHoles(std::vector<MaximalEdgeRing*>& edgeRings,
-                                   std::vector<EdgeRing*>& newShellList, std::vector<EdgeRing*>& freeHoleList)
-{
-    for(std::size_t i = 0, n = edgeRings.size(); i < n; i++) {
-        EdgeRing* er = edgeRings[i];
-        //er->setInResult();
-        if(er->isHole()) {
-            freeHoleList.push_back(er);
-        }
-        else {
-            newShellList.push_back(er);
-        }
-    }
-}
-
-/*private*/
-void
-PolygonBuilder::placeFreeHoles(std::vector<FastPIPRing>& newShellList,
-                               std::vector<EdgeRing*>& freeHoleList)
-{
-    for(std::vector<EdgeRing*>::iterator
-            it = freeHoleList.begin(), itEnd = freeHoleList.end();
-            it != itEnd;
-            ++it) {
-        EdgeRing* hole = *it;
-        // only place this hole if it doesn't yet have a shell
-        if(hole->getShell() == nullptr) {
-            EdgeRing* shell = findEdgeRingContaining(hole, newShellList);
-            if(shell == nullptr) {
-#if GEOS_DEBUG
-                std::cerr << "CREATE TABLE shells (g geometry);" << std::endl;
-                std::cerr << "CREATE TABLE hole (g geometry);" << std::endl;
-                for(std::vector<FastPIPRing>::iterator rIt = newShellList.begin(),
-                        rEnd = newShellList.end(); rIt != rEnd; rIt++) {
-                    std::unique_ptr<Geometry> geom = (*rIt).edgeRing->toPolygon(geometryFactory);
-                    std::cerr << "INSERT INTO shells VALUES ('"
-                              << *geom
-                              << "');" << std::endl;
-                }
-                std::unique_ptr<Geometry> geom = hole->toPolygon(geometryFactory);
-                std::cerr << "INSERT INTO hole VALUES ('"
-                          << *geom
-                          << "');" << std::endl;
-#endif
-                //assert(shell!=NULL); // unable to assign hole to a shell
-                throw util::TopologyException("unable to assign hole to a shell");
-            }
-
-            hole->setShell(shell);
-        }
-    }
-}
-
-/*private*/
-EdgeRing*
-PolygonBuilder::findEdgeRingContaining(EdgeRing* testEr,
-                                       std::vector<FastPIPRing>& newShellList)
-{
-    LinearRing* testRing = testEr->getLinearRing();
-    const Envelope* testEnv = testRing->getEnvelopeInternal();
-    EdgeRing* minShell = nullptr;
-    const Envelope* minShellEnv = nullptr;
-
-    for(auto const& tryShell : newShellList) {
-        LinearRing* tryShellRing = tryShell.edgeRing->getLinearRing();
-        const Envelope* tryShellEnv = tryShellRing->getEnvelopeInternal();
-        // the hole envelope cannot equal the shell envelope
-        // (also guards against testing rings against themselves)
-        if(tryShellEnv->equals(testEnv)) {
-            continue;
-        }
-        // hole must be contained in shell
-        if(!tryShellEnv->contains(testEnv)) {
-            continue;
-        }
-
-        const CoordinateSequence* tsrcs = tryShellRing->getCoordinatesRO();
-        const Coordinate& testPt = operation::polygonize::EdgeRing::ptNotInList(testRing->getCoordinatesRO(), tsrcs);
-
-        bool isContained = false;
-        if(tryShell.pipLocator->locate(&testPt) != Location::EXTERIOR) {
-            isContained = true;
-        }
-
-        // check if this new containing ring is smaller than
-        // the current minimum ring
-        if(isContained) {
-            if(minShell == nullptr
-                    || minShellEnv->contains(tryShellEnv)) {
-                minShell = tryShell.edgeRing;
-                minShellEnv = minShell->getLinearRing()->getEnvelopeInternal();
-            }
-        }
-    }
-    return minShell;
-}
-
-/*private*/
-std::vector<std::unique_ptr<Geometry>>
-PolygonBuilder::computePolygons(std::vector<EdgeRing*>& newShellList)
-{
-#if GEOS_DEBUG
-    std::cerr << "PolygonBuilder::computePolygons: got " << newShellList.size() << " shells" << std::endl;
-#endif
-    std::vector<std::unique_ptr<Geometry>> resultPolyList;
-
-    // add Polygons for all shells
-    for(std::size_t i = 0, n = newShellList.size(); i < n; i++) {
-        EdgeRing* er = newShellList[i];
-        auto poly = er->toPolygon(geometryFactory);
-        resultPolyList.push_back(std::move(poly));
-    }
-    return resultPolyList;
-}
-
-
-} // namespace geos.operation.overlay
-} // namespace geos.operation
-} // namespace geos
-

-----------------------------------------------------------------------

Summary of changes:
 include/geos/operation/overlay/MaximalEdgeRing.h   | 105 ------
 include/geos/operation/overlay/MinimalEdgeRing.h   |  80 -----
 .../geos/operation/overlay/OverlayNodeFactory.h    |  56 ---
 include/geos/operation/overlay/PolygonBuilder.h    | 210 -----------
 src/operation/overlay/MaximalEdgeRing.cpp          | 136 --------
 src/operation/overlay/MinimalEdgeRing.cpp          |  42 ---
 src/operation/overlay/OverlayNodeFactory.cpp       |  46 ---
 src/operation/overlay/PolygonBuilder.cpp           | 383 ---------------------
 8 files changed, 1058 deletions(-)
 delete mode 100644 include/geos/operation/overlay/MaximalEdgeRing.h
 delete mode 100644 include/geos/operation/overlay/MinimalEdgeRing.h
 delete mode 100644 include/geos/operation/overlay/OverlayNodeFactory.h
 delete mode 100644 include/geos/operation/overlay/PolygonBuilder.h
 delete mode 100644 src/operation/overlay/MaximalEdgeRing.cpp
 delete mode 100644 src/operation/overlay/MinimalEdgeRing.cpp
 delete mode 100644 src/operation/overlay/OverlayNodeFactory.cpp
 delete mode 100644 src/operation/overlay/PolygonBuilder.cpp


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list