[geos-commits] r3679 - in trunk: capi tests/unit/capi
svn_geos at osgeo.org
svn_geos at osgeo.org
Fri Jun 22 08:32:54 PDT 2012
Author: strk
Date: 2012-06-22 08:32:54 -0700 (Fri, 22 Jun 2012)
New Revision: 3679
Modified:
trunk/capi/geos_ts_c.cpp
trunk/tests/unit/capi/GEOSGetCentroidTest.cpp
Log:
Always return POINT from GEOSGetCentroid, even for EMPTY (#560)
Modified: trunk/capi/geos_ts_c.cpp
===================================================================
--- trunk/capi/geos_ts_c.cpp 2012-06-22 15:31:49 UTC (rev 3678)
+++ trunk/capi/geos_ts_c.cpp 2012-06-22 15:32:54 UTC (rev 3679)
@@ -2807,7 +2807,7 @@
if (0 == ret)
{
const GeometryFactory *gf = handle->geomFactory;
- return gf->createGeometryCollection();
+ return gf->createPoint();
}
return ret;
}
Modified: trunk/tests/unit/capi/GEOSGetCentroidTest.cpp
===================================================================
--- trunk/tests/unit/capi/GEOSGetCentroidTest.cpp 2012-06-22 15:31:49 UTC (rev 3678)
+++ trunk/tests/unit/capi/GEOSGetCentroidTest.cpp 2012-06-22 15:32:54 UTC (rev 3679)
@@ -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