[geos-commits] r3678 - in branches/3.3: . capi tests/unit/capi

svn_geos at osgeo.org svn_geos at osgeo.org
Fri Jun 22 08:31:50 PDT 2012


Author: strk
Date: 2012-06-22 08:31:49 -0700 (Fri, 22 Jun 2012)
New Revision: 3678

Modified:
   branches/3.3/NEWS
   branches/3.3/capi/geos_ts_c.cpp
   branches/3.3/tests/unit/capi/GEOSGetCentroidTest.cpp
Log:
Always return POINT from GEOSGetCentroid, even for EMPTY (#560)

Modified: branches/3.3/NEWS
===================================================================
--- branches/3.3/NEWS	2012-06-22 15:03:33 UTC (rev 3677)
+++ branches/3.3/NEWS	2012-06-22 15:31:49 UTC (rev 3678)
@@ -4,6 +4,7 @@
 - Bug fixes / improvements
     - Correctly increment CAPI lib version from 3.3.3 (#558)
     - Port robustness fix to CentroidArea (#559)
+    - Always return POINT from GEOSGetCentroid, even for EMPTY (#560)
 
 Changes in 3.3.4
 2012-05-31

Modified: branches/3.3/capi/geos_ts_c.cpp
===================================================================
--- branches/3.3/capi/geos_ts_c.cpp	2012-06-22 15:03:33 UTC (rev 3677)
+++ branches/3.3/capi/geos_ts_c.cpp	2012-06-22 15:31:49 UTC (rev 3678)
@@ -2763,7 +2763,7 @@
         if (0 == ret)
         {
             const GeometryFactory *gf = handle->geomFactory;
-            return gf->createGeometryCollection();
+            return gf->createPoint();
         }
         return ret;
     }

Modified: branches/3.3/tests/unit/capi/GEOSGetCentroidTest.cpp
===================================================================
--- branches/3.3/tests/unit/capi/GEOSGetCentroidTest.cpp	2012-06-22 15:03:33 UTC (rev 3677)
+++ branches/3.3/tests/unit/capi/GEOSGetCentroidTest.cpp	2012-06-22 15:31:49 UTC (rev 3678)
@@ -151,5 +151,24 @@
 
     }
 
+    // Empty geometry -- see http://trac.osgeo.org/geos/ticket/560
+    template<>
+    template<>
+    void object::test<5>()
+    {
+        geom1_ = GEOSGeomFromWKT("LINESTRING EMPTY");
+
+        ensure( 0 != geom1_ );
+
+        geom2_ = GEOSGetCentroid(geom1_);
+
+        ensure( 0 != geom2_ );
+
+        wkt_ = GEOSWKTWriter_write(wktw_, geom2_);
+
+        ensure_equals(std::string(wkt_), std::string( "POINT EMPTY"));
+
+    }
+
 } // namespace tut
 



More information about the geos-commits mailing list