[geos-commits] r3177 - in trunk: include/geos/geom/util src/geom/util

svn_geos at osgeo.org svn_geos at osgeo.org
Thu Feb 3 14:58:51 EST 2011


Author: strk
Date: 2011-02-03 11:58:51 -0800 (Thu, 03 Feb 2011)
New Revision: 3177

Modified:
   trunk/include/geos/geom/util/GeometryCombiner.h
   trunk/src/geom/util/GeometryCombiner.cpp
Log:
A step toward better const-correctness in GeometryCombiner interface

Modified: trunk/include/geos/geom/util/GeometryCombiner.h
===================================================================
--- trunk/include/geos/geom/util/GeometryCombiner.h	2011-02-03 19:58:41 UTC (rev 3176)
+++ trunk/include/geos/geom/util/GeometryCombiner.h	2011-02-03 19:58:51 UTC (rev 3177)
@@ -63,7 +63,7 @@
      * @param g1 a geometry to combine (ownership left to caller)
      * @return the combined geometry
      */
-    static Geometry* combine(Geometry* g0, Geometry* g1);
+    static Geometry* combine(const Geometry* g0, const Geometry* g1);
 
     /**
      * Combines three geometries.
@@ -73,7 +73,7 @@
      * @param g2 a geometry to combine (ownership left to caller)
      * @return the combined geometry
      */
-    static Geometry* combine(Geometry* g0, Geometry* g1, Geometry* g2);
+    static Geometry* combine(const Geometry* g0, const Geometry* g1, const Geometry* g2);
 
 private:
     GeometryFactory const* geomFactory;

Modified: trunk/src/geom/util/GeometryCombiner.cpp
===================================================================
--- trunk/src/geom/util/GeometryCombiner.cpp	2011-02-03 19:58:41 UTC (rev 3176)
+++ trunk/src/geom/util/GeometryCombiner.cpp	2011-02-03 19:58:51 UTC (rev 3177)
@@ -32,22 +32,23 @@
     return combiner.combine();
 }
 
-Geometry* GeometryCombiner::combine(Geometry* g0, Geometry* g1)
+Geometry* GeometryCombiner::combine(const Geometry* g0, const Geometry* g1)
 {
     std::vector<Geometry*> geoms;
-    geoms.push_back(g0);
-    geoms.push_back(g1);
+    geoms.push_back(const_cast<Geometry*>(g0));
+    geoms.push_back(const_cast<Geometry*>(g1));
 
     GeometryCombiner combiner(geoms);
     return combiner.combine();
 }
 
-Geometry* GeometryCombiner::combine(Geometry* g0, Geometry* g1, Geometry* g2)
+Geometry* GeometryCombiner::combine(const Geometry* g0, const Geometry* g1,
+                                    const Geometry* g2)
 {
     std::vector<Geometry*> geoms;
-    geoms.push_back(g0);
-    geoms.push_back(g1);
-    geoms.push_back(g2);
+    geoms.push_back(const_cast<Geometry*>(g0));
+    geoms.push_back(const_cast<Geometry*>(g1));
+    geoms.push_back(const_cast<Geometry*>(g2));
 
     GeometryCombiner combiner(geoms);
     return combiner.combine();



More information about the geos-commits mailing list