[geos-commits] [SCM] GEOS branch main updated. 156f66840b5814c944d2987bc38a25995a2ad00c

git at osgeo.org git at osgeo.org
Thu Jul 15 10:51:30 PDT 2021


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, main has been updated
       via  156f66840b5814c944d2987bc38a25995a2ad00c (commit)
      from  f4d05b230d75bb85624c147c0a51d4987f069218 (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 156f66840b5814c944d2987bc38a25995a2ad00c
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Thu Jul 15 10:38:12 2021 -0700

    Clean out unused code from CascadedPolygonUnion

diff --git a/include/geos/operation/union/CascadedPolygonUnion.h b/include/geos/operation/union/CascadedPolygonUnion.h
index b7c5d9f..0bcf394 100644
--- a/include/geos/operation/union/CascadedPolygonUnion.h
+++ b/include/geos/operation/union/CascadedPolygonUnion.h
@@ -18,16 +18,10 @@
  *
  **********************************************************************/
 
-#ifndef GEOS_OP_UNION_CASCADEDPOLYGONUNION_H
-#define GEOS_OP_UNION_CASCADEDPOLYGONUNION_H
+#pragma once
 
 #include <geos/export.h>
 
-#include <vector>
-#include <algorithm>
-#include <memory>
-
-#include <geos/operation/union/GeometryListHolder.h>
 #include <geos/operation/union/UnionStrategy.h>
 
 // Forward declarations
@@ -39,11 +33,6 @@ class Polygon;
 class MultiPolygon;
 class Envelope;
 }
-namespace index {
-namespace strtree {
-class ItemsList;
-}
-}
 }
 
 namespace geos {
@@ -255,4 +244,3 @@ private:
 } // namespace geos::operation
 } // namespace geos
 
-#endif
diff --git a/include/geos/operation/union/GeometryListHolder.h b/include/geos/operation/union/GeometryListHolder.h
deleted file mode 100644
index 1498da0..0000000
--- a/include/geos/operation/union/GeometryListHolder.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/**********************************************************************
- *
- * GEOS - Geometry Engine Open Source
- * http://geos.osgeo.org
- *
- * Copyright (C) 2011 Sandro Santilli <strk at kbt.io>
- * 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.
- *
- **********************************************************************/
-
-#ifndef GEOS_OP_UNION_GEOMETRYLISTHOLDER_H
-#define GEOS_OP_UNION_GEOMETRYLISTHOLDER_H
-
-// Forward declarations
-namespace geos {
-namespace geom {
-class Geometry;
-}
-}
-
-namespace geos {
-namespace operation { // geos::operation
-namespace geounion {  // geos::operation::geounion
-
-/**
- * \brief Helper class holding Geometries, part of which are held by reference
- *        others are held exclusively.
- */
-class GeometryListHolder : public std::vector<geom::Geometry*> {
-private:
-    typedef std::vector<geom::Geometry*> base_type;
-
-public:
-    GeometryListHolder() {}
-    ~GeometryListHolder()
-    {
-        std::for_each(ownedItems.begin(), ownedItems.end(),
-                      &GeometryListHolder::deleteItem);
-    }
-
-    // items need to be deleted in the end
-    void
-    push_back_owned(geom::Geometry* item)
-    {
-        this->base_type::push_back(item);
-        ownedItems.push_back(item);
-    }
-
-    geom::Geometry*
-    getGeometry(std::size_t index)
-    {
-        if(index >= this->base_type::size()) {
-            return nullptr;
-        }
-        return (*this)[index];
-    }
-
-private:
-    static void deleteItem(geom::Geometry* item);
-
-private:
-    std::vector<geom::Geometry*> ownedItems;
-};
-
-} // namespace geos::operation::union
-} // namespace geos::operation
-} // namespace geos
-
-#endif
diff --git a/src/operation/union/CascadedPolygonUnion.cpp b/src/operation/union/CascadedPolygonUnion.cpp
index 3741dd9..c30c6f7 100644
--- a/src/operation/union/CascadedPolygonUnion.cpp
+++ b/src/operation/union/CascadedPolygonUnion.cpp
@@ -18,99 +18,29 @@
  *
  **********************************************************************/
 
-
-#include <geos/operation/union/CascadedPolygonUnion.h>
-#include <geos/operation/union/OverlapUnion.h>
-#include <geos/operation/overlay/OverlayOp.h>
-#include <geos/geom/HeuristicOverlay.h>
-#include <geos/geom/Dimension.h>
 #include <geos/geom/Geometry.h>
 #include <geos/geom/GeometryFactory.h>
-#include <geos/geom/Polygon.h>
+#include <geos/geom/HeuristicOverlay.h>
 #include <geos/geom/MultiPolygon.h>
-#include <geos/geom/util/PolygonExtracter.h>
+#include <geos/geom/Polygon.h>
 #include <geos/index/strtree/TemplateSTRtree.h>
+#include <geos/operation/overlay/OverlayOp.h>
+#include <geos/operation/union/CascadedPolygonUnion.h>
+#include <geos/operation/valid/IsValidOp.h>
+#include <geos/operation/valid/IsSimpleOp.h>
+#include <geos/util/TopologyException.h>
 
 // std
 #include <cassert>
 #include <cstddef>
-#include <memory>
-#include <vector>
 #include <sstream>
-
-#include <geos/operation/valid/IsValidOp.h>
-#include <geos/operation/valid/IsSimpleOp.h>
-#include <geos/algorithm/BoundaryNodeRule.h>
-#include <geos/util/TopologyException.h>
 #include <string>
-#include <iomanip>
-
-//#define GEOS_DEBUG_CASCADED_UNION 1
-//#define GEOS_DEBUG_CASCADED_UNION_PRINT_INVALID 1
-
-namespace {
-
-#if GEOS_DEBUG
-inline bool
-check_valid(const geos::geom::Geometry& g, const std::string& label, bool doThrow = false, bool validOnly = false)
-{
-    using namespace geos;
-
-    if(g.isLineal()) {
-        if(! validOnly) {
-            operation::valid::IsSimpleOp sop(g, algorithm::BoundaryNodeRule::getBoundaryEndPoint());
-            if(! sop.isSimple()) {
-                if(doThrow) {
-                    throw geos::util::TopologyException(
-                        label + " is not simple");
-                }
-                return false;
-            }
-        }
-    }
-    else {
-        operation::valid::IsValidOp ivo(&g);
-        if(! ivo.isValid()) {
-            using operation::valid::TopologyValidationError;
-            TopologyValidationError* err = ivo.getValidationError();
-#ifdef GEOS_DEBUG_CASCADED_UNION
-            std::cerr << label << " is INVALID: "
-                      << err->toString()
-                      << " (" << std::setprecision(20)
-                      << err->getCoordinate() << ")"
-                      << std::endl
-#ifdef GEOS_DEBUG_CASCADED_UNION_PRINT_INVALID
-                      << "<a>" << std::endl
-                      << g.toString() << std::endl
-                      << "</a>" << std::endl
-#endif
-                      ;
-#endif // GEOS_DEBUG_CASCADED_UNION
-            if(doThrow) {
-                throw geos::util::TopologyException(
-                    label + " is invalid: " + err->toString(),
-                    err->getCoordinate());
-            }
-            return false;
-        }
-    }
-    return true;
-}
-#endif
-
-} // anonymous namespace
 
 
 namespace geos {
 namespace operation { // geos.operation
 namespace geounion {  // geos.operation.geounion
 
-// ////////////////////////////////////////////////////////////////////////////
-void
-GeometryListHolder::deleteItem(geom::Geometry* item)
-{
-    delete item;
-}
 
 // ////////////////////////////////////////////////////////////////////////////
 std::unique_ptr<geom::Geometry>
@@ -266,15 +196,13 @@ CascadedPolygonUnion::restrictToPolygons(std::unique_ptr<geom::Geometry> g)
 
 /************************************************************************/
 
-using operation::overlay::OverlayOp;
-
 std::unique_ptr<geom::Geometry>
 ClassicUnionStrategy::Union(const geom::Geometry* g0, const geom::Geometry* g1)
 {
     // TODO make an rvalue overload for this that can consume its inputs.
     // At a minimum, a copy in the buffer fallback can be eliminated.
     try {
-        return geom::HeuristicOverlay(g0, g1, overlay::OverlayOp::opUNION);
+        return geom::HeuristicOverlay(g0, g1, operation::overlay::OverlayOp::opUNION);
     }
     catch (const util::TopologyException &ex) {
         ::geos::ignore_unused_variable_warning(ex);

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

Summary of changes:
 .../geos/operation/union/CascadedPolygonUnion.h    | 14 +---
 include/geos/operation/union/GeometryListHolder.h  | 74 ------------------
 src/operation/union/CascadedPolygonUnion.cpp       | 88 ++--------------------
 3 files changed, 9 insertions(+), 167 deletions(-)
 delete mode 100644 include/geos/operation/union/GeometryListHolder.h


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list