[geos-commits] r3249 - trunk/capi

svn_geos at osgeo.org svn_geos at osgeo.org
Mon Feb 28 06:32:25 EST 2011


Author: strk
Date: 2011-02-28 03:32:25 -0800 (Mon, 28 Feb 2011)
New Revision: 3249

Modified:
   trunk/capi/geos_c.cpp
   trunk/capi/geos_c.h.in
   trunk/capi/geos_ts_c.cpp
Log:
GEOSCovers and GEOSCoveredBy (ticket #396) by Alessandro Furieri

Modified: trunk/capi/geos_c.cpp
===================================================================
--- trunk/capi/geos_c.cpp	2011-02-25 16:05:47 UTC (rev 3248)
+++ trunk/capi/geos_c.cpp	2011-02-28 11:32:25 UTC (rev 3249)
@@ -166,7 +166,19 @@
     return GEOSOverlaps_r( handle, g1, g2 );
 }
 
+char
+GEOSCovers(const Geometry *g1, const Geometry *g2)
+{
+    return GEOSCovers_r( handle, g1, g2 );
+}
 
+char
+GEOSCoveredBy(const Geometry *g1, const Geometry *g2)
+{
+    return GEOSCoveredBy_r( handle, g1, g2 );
+}
+
+
 //-------------------------------------------------------------------
 // low-level relate functions
 //------------------------------------------------------------------

Modified: trunk/capi/geos_c.h.in
===================================================================
--- trunk/capi/geos_c.h.in	2011-02-25 16:05:47 UTC (rev 3248)
+++ trunk/capi/geos_c.h.in	2011-02-28 11:32:25 UTC (rev 3249)
@@ -642,6 +642,8 @@
 extern char GEOS_DLL GEOSOverlaps(const GEOSGeometry* g1, const GEOSGeometry* g2);
 extern char GEOS_DLL GEOSEquals(const GEOSGeometry* g1, const GEOSGeometry* g2);
 extern char GEOS_DLL GEOSEqualsExact(const GEOSGeometry* g1, const GEOSGeometry* g2, double tolerance);
+extern char GEOS_DLL GEOSCovers(const GEOSGeometry* g1, const GEOSGeometry* g2);
+extern char GEOS_DLL GEOSCoveredBy(const GEOSGeometry* g1, const GEOSGeometry* g2);
 
 extern char GEOS_DLL GEOSRelatePattern_r(GEOSContextHandle_t handle,
                                          const GEOSGeometry* g1,
@@ -678,6 +680,12 @@
                                        const GEOSGeometry* g1,
                                        const GEOSGeometry* g2,
                                        double tolerance);
+extern char GEOS_DLL GEOSCovers_r(GEOSContextHandle_t handle,
+                                  const GEOSGeometry* g1,
+                                  const GEOSGeometry* g2);
+extern char GEOS_DLL GEOSCoveredBy_r(GEOSContextHandle_t handle,
+                                  const GEOSGeometry* g1,
+                                  const GEOSGeometry* g2);
 
 /************************************************************************
  *

Modified: trunk/capi/geos_ts_c.cpp
===================================================================
--- trunk/capi/geos_ts_c.cpp	2011-02-25 16:05:47 UTC (rev 3248)
+++ trunk/capi/geos_ts_c.cpp	2011-02-28 11:32:25 UTC (rev 3249)
@@ -490,7 +490,71 @@
     return 2;
 }
 
+char
+GEOSCovers_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2)
+{
+    if ( 0 == extHandle )
+    {
+        return 2;
+    }
 
+    GEOSContextHandleInternal_t *handle = 0;
+    handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
+    if ( 0 == handle->initialized )
+    {
+        return 2;
+    }
+
+    try
+    {
+        bool result = g1->covers(g2);
+        return result;
+    }
+    catch (const std::exception &e)
+    {
+        handle->ERROR_MESSAGE("%s", e.what());
+    }
+    catch (...)
+    {
+        handle->ERROR_MESSAGE("Unknown exception thrown");
+    }
+    
+    return 2;
+}
+
+char
+GEOSCoveredBy_r(GEOSContextHandle_t extHandle, const Geometry *g1, const Geometry *g2)
+{
+    if ( 0 == extHandle )
+    {
+        return 2;
+    }
+
+    GEOSContextHandleInternal_t *handle = 0;
+    handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
+    if ( 0 == handle->initialized )
+    {
+        return 2;
+    }
+
+    try
+    {
+        bool result = g1->coveredBy(g2);
+        return result;
+    }
+    catch (const std::exception &e)
+    {
+        handle->ERROR_MESSAGE("%s", e.what());
+    }
+    catch (...)
+    {
+        handle->ERROR_MESSAGE("Unknown exception thrown");
+    }
+    
+    return 2;
+}
+
+
 //-------------------------------------------------------------------
 // low-level relate functions
 //------------------------------------------------------------------



More information about the geos-commits mailing list