]> granicus.if.org Git - postgis/commitdiff
Had isvalid raise a NOTICE with invalidity message.
authorSandro Santilli <strk@keybit.net>
Fri, 5 Nov 2004 11:44:40 +0000 (11:44 +0000)
committerSandro Santilli <strk@keybit.net>
Fri, 5 Nov 2004 11:44:40 +0000 (11:44 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@1084 b70326c6-7e19-0410-871a-916f4a2858ee

lwgeom/lwgeom_geos_wrapper.cpp

index 7a7ff07e858739df8c967ee925a2d455c699364f..30f44d3a0c729393fe2668c66e07cb83daf93a9d 100644 (file)
@@ -10,6 +10,7 @@
 #include "geos/geom.h"
 #include "geos/util.h"
 #if GEOS_FIRST_INTERFACE <= 3 && GEOS_LAST_INTERFACE >= 3
+#include "geos/opValid.h"
 #include "geos/opPolygonize.h"
 #endif // GEOS_FIRST_INTERFACE <= 3
 
@@ -896,9 +897,24 @@ char *GEOSrelate(Geometry *g1, Geometry*g2)
 
 char GEOSisvalid(Geometry *g1)
 {
+#if GEOS_FIRST_INTERFACE <= 3 && GEOS_LAST_INTERFACE >= 3
+       IsValidOp ivo(g1);
+#endif
+       bool result;
        try {
-               bool result;
-               result =g1->isValid();
+#if GEOS_FIRST_INTERFACE <= 3 && GEOS_LAST_INTERFACE >= 3
+               result = ivo.isValid();
+               if ( result == 0 )
+               {
+                       TopologyValidationError *err = ivo.getValidationError();
+                       if ( err ) {
+                               string errmsg = err->getMessage();
+                               NOTICE_MESSAGE((char *)errmsg.c_str());
+                       }
+               }
+#else // GEOS_INTERFACE 3 not supported
+               result = g1->isValid();
+#endif
                return result;
        }
        catch (GEOSException *ge)