]> granicus.if.org Git - postgis/commitdiff
Allow specifying validity checking flags in ST_isValidDetail [RT-SIGTA]
authorSandro Santilli <strk@keybit.net>
Tue, 15 Feb 2011 17:36:35 +0000 (17:36 +0000)
committerSandro Santilli <strk@keybit.net>
Tue, 15 Feb 2011 17:36:35 +0000 (17:36 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@6824 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/lwgeom_geos.c
postgis/postgis.sql.in.c

index a208e770b695d3f87666f9accfe8191aa04502ee..100c80a8452af1ce3965d7a464743bfdec9f7a95 100644 (file)
@@ -1891,6 +1891,7 @@ Datum isvaliddetail(PG_FUNCTION_ARGS)
        TupleDesc tupdesc;
        HeapTuple tuple;
        AttInMetadata *attinmeta;
+       int flags = 0;
 
        /*
         * Build a tuple description for a
@@ -1911,13 +1912,18 @@ Datum isvaliddetail(PG_FUNCTION_ARGS)
 
        geom = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
 
+       if ( PG_NARGS() > 1 && ! PG_ARGISNULL(1) ) {
+               flags = PG_GETARG_INT32(1);
+       }
+
        initGEOS(lwnotice, lwgeom_geos_error);
 
        g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
 
        if ( g1 )
        {
-               valid = GEOSisValidDetail(g1, &geos_reason, &geos_location);
+               valid = GEOSisValidDetail(g1, flags,
+                       &geos_reason, &geos_location);
                GEOSGeom_destroy((GEOSGeometry *)g1);
                if ( geos_reason )
                {
index 83624dd156aafa1edb11e63bf8bef9097416a3f8..751fbc73c400cee833538e55a59fa3c3e134952c 100644 (file)
@@ -2937,6 +2937,14 @@ CREATE OR REPLACE FUNCTION ST_IsValidDetail(geometry)
        LANGUAGE 'C' IMMUTABLE STRICT
        COST 100;
 
+-- Requires GEOS >= 3.3.0
+-- Availability: 2.0.0
+CREATE OR REPLACE FUNCTION ST_IsValidDetail(geometry, int4)
+       RETURNS valid_detail
+       AS 'MODULE_PATHNAME', 'isvaliddetail'
+       LANGUAGE 'C' IMMUTABLE STRICT
+       COST 100;
+
 #if POSTGIS_GEOS_VERSION >= 32
 -- Requires GEOS >= 3.2.0
 -- Availability: 1.5.0