From: Sandro Santilli Date: Fri, 5 Nov 2004 11:44:40 +0000 (+0000) Subject: Had isvalid raise a NOTICE with invalidity message. X-Git-Tag: pgis_1_0_0RC1~209 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d4c75cedc16d13987d1bc8497a1228fb40961026;p=postgis Had isvalid raise a NOTICE with invalidity message. git-svn-id: http://svn.osgeo.org/postgis/trunk@1084 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/lwgeom/lwgeom_geos_wrapper.cpp b/lwgeom/lwgeom_geos_wrapper.cpp index 7a7ff07e8..30f44d3a0 100644 --- a/lwgeom/lwgeom_geos_wrapper.cpp +++ b/lwgeom/lwgeom_geos_wrapper.cpp @@ -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)