[geos-commits] r3294 - trunk/include/geos/operation/union

svn_geos at osgeo.org svn_geos at osgeo.org
Fri Apr 22 14:46:37 EDT 2011


Author: strk
Date: 2011-04-22 11:46:37 -0700 (Fri, 22 Apr 2011)
New Revision: 3294

Added:
   trunk/include/geos/operation/union/GeometryListHolder.h
Modified:
   trunk/include/geos/operation/union/CascadedPolygonUnion.h
   trunk/include/geos/operation/union/Makefile.am
Log:
Put GeometryListHolder in its own header file.

Modified: trunk/include/geos/operation/union/CascadedPolygonUnion.h
===================================================================
--- trunk/include/geos/operation/union/CascadedPolygonUnion.h	2011-04-22 13:51:38 UTC (rev 3293)
+++ trunk/include/geos/operation/union/CascadedPolygonUnion.h	2011-04-22 18:46:37 UTC (rev 3294)
@@ -20,11 +20,14 @@
 
 #ifndef GEOS_OP_UNION_CASCADEDPOLYGONUNION_H
 #define GEOS_OP_UNION_CASCADEDPOLYGONUNION_H
+
 #include <geos/export.h>
 
 #include <vector>
 #include <algorithm>
 
+#include "GeometryListHolder.h"
+
 // Forward declarations
 namespace geos {
     namespace geom {
@@ -46,44 +49,6 @@
 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 NULL;
-      return (*this)[index];
-    }
-
-private:
-    static void deleteItem(geom::Geometry* item);
-
-private:
-    std::vector<geom::Geometry*> ownedItems;
-};
-
-/**
  * \brief 
  * Provides an efficient method of unioning a collection of 
  * {@link Polygonal} geometries.

Added: trunk/include/geos/operation/union/GeometryListHolder.h
===================================================================
--- trunk/include/geos/operation/union/GeometryListHolder.h	                        (rev 0)
+++ trunk/include/geos/operation/union/GeometryListHolder.h	2011-04-22 18:46:37 UTC (rev 3294)
@@ -0,0 +1,73 @@
+/**********************************************************************
+ * $Id$
+ *
+ * GEOS - Geometry Engine Open Source
+ * http://geos.refractions.net
+ *
+ * Copyright (C) 2011 Sandro Santilli <strk at keybit.net>
+ * 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 NULL;
+      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

Modified: trunk/include/geos/operation/union/Makefile.am
===================================================================
--- trunk/include/geos/operation/union/Makefile.am	2011-04-22 13:51:38 UTC (rev 3293)
+++ trunk/include/geos/operation/union/Makefile.am	2011-04-22 18:46:37 UTC (rev 3294)
@@ -10,5 +10,6 @@
 
 geos_HEADERS = \
     CascadedPolygonUnion.h \
+    GeometryListHolder.h \
     PointGeometryUnion.h \
     UnaryUnionOp.h



More information about the geos-commits mailing list