From: Sandro Santilli Date: Tue, 15 Feb 2011 17:36:35 +0000 (+0000) Subject: Allow specifying validity checking flags in ST_isValidDetail [RT-SIGTA] X-Git-Tag: 2.0.0alpha1~1976 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=176baf9230b6a4b2624ea19053c06c487d5eef06;p=postgis Allow specifying validity checking flags in ST_isValidDetail [RT-SIGTA] git-svn-id: http://svn.osgeo.org/postgis/trunk@6824 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c index a208e770b..100c80a84 100644 --- a/postgis/lwgeom_geos.c +++ b/postgis/lwgeom_geos.c @@ -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 ) { diff --git a/postgis/postgis.sql.in.c b/postgis/postgis.sql.in.c index 83624dd15..751fbc73c 100644 --- a/postgis/postgis.sql.in.c +++ b/postgis/postgis.sql.in.c @@ -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