[postgis-commits] svn - r2735 - in trunk: lwgeom regress

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Mon Jan 28 17:24:35 PST 2008


Author: benjubb
Date: 2008-01-28 17:24:34 -0800 (Mon, 28 Jan 2008)
New Revision: 2735

Modified:
   trunk/lwgeom/lwgeom_geos_c.c
   trunk/lwgeom/lwpostgis.sql.in
   trunk/regress/Makefile
   trunk/regress/regress_ogc_prep.sql
   trunk/regress/regress_ogc_prep_expected
Log:
Changed the interface for the GEOS prepared predicates.  
ST_contains, ST_containsProperly, ST_covers, and ST_intersects are now overloaded.  
The new arguments style is ( geometry, geometry, integer).  The third argument is used to determine when the first argument changes.  The assumption is that when the third argument changes, the first argument is assumed to have changed too.  This side-steps the issue of determining when the identity of the first geometry changes.




Modified: trunk/lwgeom/lwgeom_geos_c.c
===================================================================
--- trunk/lwgeom/lwgeom_geos_c.c	2008-01-22 19:44:25 UTC (rev 2734)
+++ trunk/lwgeom/lwgeom_geos_c.c	2008-01-29 01:24:34 UTC (rev 2735)
@@ -3605,8 +3605,7 @@
 
 typedef struct
 {
-	Size 					serialized_geom_length;
-	uchar * 				serialized_geom;
+	int32					key;
 	GEOSPreparedGeometry * 	prepared_geom;
 } PREPARED_GEOM_CACHE;
 
@@ -3620,24 +3619,25 @@
  * get cache
  * if cache not exist
  *   create cache 
- *   geom1 into cache
+ *   key into cache
  *
- * else if geom1 matches cached geom1
+ * else if key matches cached key
  *    if cached prepared not exist
  *        geom1 prepared into cache
  *    
  * else
- *   geom1 into cache
+ *   key into cache
+ *   clear prepared cache
  */
 PREPARED_GEOM_CACHE *
 get_prepared_geometry_cache( 
 	PREPARED_GEOM_CACHE * 	cache, 
-	uchar * 				serialized_geom, 
-	Size 					serialized_geom_length)
+	uchar * 				serialized_geom,
+	int32					key )
 {
 	GEOSGeom g;
 
-	if ( !cache || !cache->serialized_geom )
+	if ( !cache )
 	{
 		#ifdef PGIS_DEBUG
 		lwnotice( "get_prepared_geometry_cache: creating cache: %x", cache);
@@ -3646,12 +3646,9 @@
 		cache = lwalloc( sizeof( PREPARED_GEOM_CACHE ));
 		
 		cache->prepared_geom = 0;
-		cache->serialized_geom_length = serialized_geom_length;
-		cache->serialized_geom = lwalloc(serialized_geom_length);
-        memcpy( cache->serialized_geom, serialized_geom, serialized_geom_length); 
+		cache->key = key;
 	}
-	else if ( serialized_geom_length == cache->serialized_geom_length 
-		&& 0 == memcmp( cache->serialized_geom, serialized_geom, cache->serialized_geom_length ))
+	else if ( cache->key == key )
 	{
 		if ( !cache->prepared_geom )
 		{
@@ -3675,21 +3672,16 @@
 		lwnotice("get_prepared_geometry_cache: obj NOT in cache");
 		#endif
 
-		lwfree( cache->serialized_geom);
-		cache->serialized_geom = 0;
-		
 		GEOSPreparedGeom_destroy( cache->prepared_geom);
-		cache->prepared_geom = 0;
 
-		cache->serialized_geom_length = serialized_geom_length;
-		cache->serialized_geom = lwalloc(serialized_geom_length);
-        memcpy( cache->serialized_geom, serialized_geom, serialized_geom_length); 
+		cache->prepared_geom = 0;
+		cache->key = key;
 	}
 	
 	return cache;
 }
 
-#endif
+#endif /* PREPARED_GEOM */
 
 
 PG_FUNCTION_INFO_V1(containsPrepared);
@@ -3700,7 +3692,6 @@
 	PG_RETURN_NULL(); /* never get here */
 
 #else
-    Size 					arg1_length;
 	PG_LWGEOM *				geom1;
 	PG_LWGEOM *				geom2;
 	GEOSGeom 				g1, g2;
@@ -3709,14 +3700,13 @@
 	BOX2DFLOAT4 			box1, box2;
 	PREPARED_GEOM_CACHE *	prep_cache;
 	MemoryContext 			old_context;
+	int32					surrogate_key;
 
-    /*arg1_length = toast_raw_datum_size(PG_GETARG_DATUM(0)) - VARHDRSZ;*/
-
 	geom1 = (PG_LWGEOM *)  PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
 	geom2 = (PG_LWGEOM *)  PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
-
-	arg1_length = VARSIZE(geom1) - VARHDRSZ;
 	
+	surrogate_key = PG_GETARG_INT32(2);
+	
 	errorIfGeometryCollection(geom1,geom2);
 	errorIfSRIDMismatch(pglwgeom_getSRID(geom1), pglwgeom_getSRID(geom2));
 
@@ -3737,7 +3727,7 @@
 	old_context = MemoryContextSwitchTo(fcinfo->flinfo->fn_mcxt);
 	prep_cache =  fcinfo->flinfo->fn_extra;
 
-	prep_cache = get_prepared_geometry_cache( prep_cache, geom1, arg1_length);
+	prep_cache = get_prepared_geometry_cache( prep_cache, geom1, surrogate_key);
 
 	fcinfo->flinfo->fn_extra = prep_cache;
 	MemoryContextSwitchTo(old_context);
@@ -3772,7 +3762,7 @@
 	PG_FREE_IF_COPY(geom2, 1);
 
 	PG_RETURN_BOOL(result);
-#endif
+#endif /* PREPARED_GEOM */
 }
 
 PG_FUNCTION_INFO_V1(containsProperlyPrepared);
@@ -3783,7 +3773,6 @@
 	PG_RETURN_NULL(); /* never get here */
 
 #else
-    Size 					arg1_length;
 	PG_LWGEOM *				geom1;
 	PG_LWGEOM *				geom2;
 	GEOSGeom 				g1, g2;
@@ -3792,14 +3781,13 @@
 	BOX2DFLOAT4 			box1, box2;
 	PREPARED_GEOM_CACHE *	prep_cache;
 	MemoryContext 			old_context;
+	int32					surrogate_key;
 
-    /*arg1_length = toast_raw_datum_size(PG_GETARG_DATUM(0)) - VARHDRSZ;*/
-
 	geom1 = (PG_LWGEOM *)  PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
 	geom2 = (PG_LWGEOM *)  PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
-
-	arg1_length = VARSIZE(geom1) - VARHDRSZ;
 	
+	surrogate_key = PG_GETARG_INT32(2);
+	
 	errorIfGeometryCollection(geom1,geom2);
 	errorIfSRIDMismatch(pglwgeom_getSRID(geom1), pglwgeom_getSRID(geom2));
 
@@ -3820,7 +3808,7 @@
 	old_context = MemoryContextSwitchTo(fcinfo->flinfo->fn_mcxt);
 	prep_cache =  fcinfo->flinfo->fn_extra;
 	
-	prep_cache = get_prepared_geometry_cache( prep_cache, geom1, arg1_length);
+	prep_cache = get_prepared_geometry_cache( prep_cache, geom1, surrogate_key);
 	
 	fcinfo->flinfo->fn_extra = prep_cache;
 	MemoryContextSwitchTo( old_context);
@@ -3855,7 +3843,7 @@
 	PG_FREE_IF_COPY(geom2, 1);
 
 	PG_RETURN_BOOL(result);
-#endif
+#endif /* PREPARED_GEOM */
 }
 
 PG_FUNCTION_INFO_V1(coversPrepared);
@@ -3866,7 +3854,6 @@
 	PG_RETURN_NULL(); /* never get here */
 
 #else
-    Size 					arg1_length;
 	PG_LWGEOM *				geom1;
 	PG_LWGEOM *				geom2;
 	GEOSGeom 				g1, g2;
@@ -3875,14 +3862,13 @@
 	BOX2DFLOAT4 			box1, box2;
 	PREPARED_GEOM_CACHE *	prep_cache;
 	MemoryContext 			old_context;
+	int32					surrogate_key;
 
-    /*arg1_length = toast_raw_datum_size(PG_GETARG_DATUM(0)) - VARHDRSZ;*/
-
 	geom1 = (PG_LWGEOM *)  PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
 	geom2 = (PG_LWGEOM *)  PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
-
-	arg1_length = VARSIZE(geom1) - VARHDRSZ;
 	
+	surrogate_key = PG_GETARG_INT32(2);
+	
 	errorIfGeometryCollection(geom1,geom2);
 	errorIfSRIDMismatch(pglwgeom_getSRID(geom1), pglwgeom_getSRID(geom2));
 
@@ -3903,7 +3889,7 @@
 	old_context = MemoryContextSwitchTo(fcinfo->flinfo->fn_mcxt);
 	prep_cache =  fcinfo->flinfo->fn_extra;
 
-	prep_cache = get_prepared_geometry_cache( prep_cache, geom1, arg1_length);
+	prep_cache = get_prepared_geometry_cache( prep_cache, geom1, surrogate_key);
 
 	fcinfo->flinfo->fn_extra = prep_cache;
 	MemoryContextSwitchTo(old_context);
@@ -3938,7 +3924,7 @@
 	PG_FREE_IF_COPY(geom2, 1);
 
 	PG_RETURN_BOOL(result);
-#endif
+#endif /* PREPARED_GEOM */
 }
 
 PG_FUNCTION_INFO_V1(intersectsPrepared);
@@ -3949,7 +3935,6 @@
 	PG_RETURN_NULL(); /* never get here */
 
 #else
-    Size 					arg1_length;
 	PG_LWGEOM *				geom1;
 	PG_LWGEOM *				geom2;
 	GEOSGeom 				g1, g2;
@@ -3958,14 +3943,13 @@
 	BOX2DFLOAT4 			box1, box2;
 	PREPARED_GEOM_CACHE *	prep_cache;
 	MemoryContext 			old_context;
+	int32					surrogate_key;
 
-    /*arg1_length = toast_raw_datum_size(PG_GETARG_DATUM(0)) - VARHDRSZ;*/
-
 	geom1 = (PG_LWGEOM *)  PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
 	geom2 = (PG_LWGEOM *)  PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
-
-	arg1_length = VARSIZE(geom1) - VARHDRSZ;
 	
+	surrogate_key = PG_GETARG_INT32(2);
+	
 	errorIfGeometryCollection(geom1,geom2);
 	errorIfSRIDMismatch(pglwgeom_getSRID(geom1), pglwgeom_getSRID(geom2));
 
@@ -3986,7 +3970,7 @@
 	old_context = MemoryContextSwitchTo(fcinfo->flinfo->fn_mcxt);
 	prep_cache =  fcinfo->flinfo->fn_extra;
 
-	prep_cache = get_prepared_geometry_cache( prep_cache, geom1, arg1_length);
+	prep_cache = get_prepared_geometry_cache( prep_cache, geom1, surrogate_key);
 
 	fcinfo->flinfo->fn_extra = prep_cache;
 	MemoryContextSwitchTo(old_context);
@@ -4021,6 +4005,6 @@
 	PG_FREE_IF_COPY(geom2, 1);
 
 	PG_RETURN_BOOL(result);
-#endif
+#endif /* PREPARED_GEOM */
 }
 

Modified: trunk/lwgeom/lwpostgis.sql.in
===================================================================
--- trunk/lwgeom/lwpostgis.sql.in	2008-01-22 19:44:25 UTC (rev 2734)
+++ trunk/lwgeom/lwpostgis.sql.in	2008-01-29 01:24:34 UTC (rev 2735)
@@ -4633,32 +4633,32 @@
 
 -----------------------------------------------------------------------
 -- Prepared Geometry Predicates
--- requires GEOS 3.2.0-CAPI-1.5.0
+-- requires GEOS 3.1.0-CAPI-1.5.0 or better
 -----------------------------------------------------------------------
-	
-CREATEFUNCTION _ST_ContainsPrepared(geometry,geometry)
+
+CREATEFUNCTION _ST_ContainsPrepared(geometry,geometry,integer)
     RETURNS boolean
     AS '@MODULE_FILENAME@','containsPrepared'
     LANGUAGE 'C' _IMMUTABLE_STRICT; -- WITH (isstrict,iscachable);
 
 -- Availability: 1.3.3
 -- Inlines index magic
-CREATEFUNCTION ST_ContainsPrepared(geometry,geometry)
+CREATEFUNCTION ST_Contains(geometry,geometry,integer)
     RETURNS boolean
-    AS 'SELECT $1 && $2 AND _ST_ContainsPrepared($1,$2)'
+    AS 'SELECT $1 && $2 AND _ST_ContainsPrepared($1,$2,$3)'
     LANGUAGE 'SQL' _IMMUTABLE; -- WITH (iscachable);
 
 	
-CREATEFUNCTION _ST_ContainsProperlyPrepared(geometry,geometry)
+CREATEFUNCTION _ST_ContainsProperlyPrepared(geometry,geometry,integer)
     RETURNS boolean
     AS '@MODULE_FILENAME@','containsProperlyPrepared'
     LANGUAGE 'C' _IMMUTABLE_STRICT; -- WITH (isstrict,iscachable);
 
 -- Availability: 1.3.3
 -- Inlines index magic
-CREATEFUNCTION ST_ContainsProperlyPrepared(geometry,geometry)
+CREATEFUNCTION ST_ContainsProperly(geometry,geometry,integer)
     RETURNS boolean
-    AS 'SELECT $1 && $2 AND _ST_ContainsProperlyPrepared($1,$2)'
+    AS 'SELECT $1 && $2 AND _ST_ContainsProperlyPrepared($1,$2,$3)'
     LANGUAGE 'SQL' _IMMUTABLE; -- WITH (iscachable);
 
 	
@@ -4670,29 +4670,29 @@
     LANGUAGE 'SQL' IMMUTABLE; 
 
 	
-CREATEFUNCTION _ST_CoversPrepared(geometry,geometry)
+CREATEFUNCTION _ST_CoversPrepared(geometry,geometry,integer)
     RETURNS boolean
     AS '@MODULE_FILENAME@','coversPrepared'
     LANGUAGE 'C' _IMMUTABLE_STRICT; -- WITH (isstrict,iscachable);
 	
 -- Availability: 1.3.3
 -- Inlines index magic
-CREATEFUNCTION ST_CoversPrepared(geometry,geometry)
+CREATEFUNCTION ST_Covers(geometry,geometry,integer)
     RETURNS boolean
-    AS 'SELECT $1 && $2 AND _ST_CoversPrepared($1,$2)'
+    AS 'SELECT $1 && $2 AND _ST_CoversPrepared($1,$2,$3)'
     LANGUAGE 'SQL' _IMMUTABLE; -- WITH (iscachable);
 
 	
-CREATEFUNCTION _ST_IntersectsPrepared(geometry,geometry)
+CREATEFUNCTION _ST_IntersectsPrepared(geometry,geometry,integer)
     RETURNS boolean
     AS '@MODULE_FILENAME@','intersectsPrepared'
     LANGUAGE 'C' _IMMUTABLE_STRICT; -- WITH (isstrict,iscachable);
 	
 -- Availability: 1.3.3
 -- Inlines index magic
-CREATEFUNCTION ST_IntersectsPrepared(geometry,geometry)
+CREATEFUNCTION ST_Intersects(geometry,geometry,integer)
     RETURNS boolean
-    AS 'SELECT $1 && $2 AND _ST_IntersectsPrepared($1,$2)'
+    AS 'SELECT $1 && $2 AND _ST_IntersectsPrepared($1,$2,$3)'
     LANGUAGE 'SQL' _IMMUTABLE; -- WITH (iscachable);
 
 -----------------------------------------------------------------------

Modified: trunk/regress/Makefile
===================================================================
--- trunk/regress/Makefile	2008-01-22 19:44:25 UTC (rev 2734)
+++ trunk/regress/Makefile	2008-01-29 01:24:34 UTC (rev 2735)
@@ -35,7 +35,7 @@
 	sql-mm-curvepoly \
 	sql-mm-general \
 	sql-mm-multicurve \
-	sql-mm-multisurface 
+	sql-mm-multisurface
 
 PREPROC = \
 	sql-mm-circularstring_expected \
@@ -45,7 +45,7 @@
 	sql-mm-multisurface_expected
 
 ifeq ($(USE_GEOS),1)
-	TESTS += regress_ogc regress_bdpoly
+	TESTS += regress_ogc regress_bdpoly regress_ogc_prep
 endif
 
 ifeq ($(USE_PROJ),1)

Modified: trunk/regress/regress_ogc_prep.sql
===================================================================
--- trunk/regress/regress_ogc_prep.sql	2008-01-22 19:44:25 UTC (rev 2734)
+++ trunk/regress/regress_ogc_prep.sql	2008-01-29 01:24:34 UTC (rev 2735)
@@ -3,175 +3,199 @@
 ---
 ---
 
-SELECT 'intersects', ST_intersectsPrepared('LINESTRING(0 10, 0 -10)', p) from ( values 
+SELECT 'intersects', ST_intersects('LINESTRING(0 10, 0 -10)', p, 0) from ( values 
 ('LINESTRING(0 0, 1 1)'),('LINESTRING(0 0, 1 1)'),('LINESTRING(0 0, 1 1)')
 ) as v(p);
 -- PIP - point within polygon
-SELECT 'intersects100', ST_intersectsPrepared('POINT(5 5)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
+SELECT 'intersects100', ST_intersects('POINT(5 5)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 0);
 -- PIP - point on polygon vertex
-SELECT 'intersects101', ST_intersectsPrepared('POINT(0 0)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
+SELECT 'intersects101', ST_intersects('POINT(0 0)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 0);
 -- PIP - point outside polygon
-SELECT 'intersects102', ST_intersectsPrepared('POINT(-1 0)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
+SELECT 'intersects102', ST_intersects('POINT(-1 0)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 0);
 -- PIP - point on polygon edge
-SELECT 'intersects103', ST_intersectsPrepared('POINT(0 5)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
+SELECT 'intersects103', ST_intersects('POINT(0 5)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 0);
 -- PIP - point in line with polygon edge
-SELECT 'intersects104', ST_intersectsPrepared('POINT(0 12)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
+SELECT 'intersects104', ST_intersects('POINT(0 12)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 0);
 -- PIP - point vertically aligned with polygon vertex 
-SELECT 'intersects105', ST_intersectsPrepared(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
+SELECT 'intersects105', ST_intersects(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), 0);
 -- PIP - repeated vertex
-SELECT 'intersects106', ST_intersectsPrepared(ST_GeomFromText('POINT(521543 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
+SELECT 'intersects106', ST_intersects(ST_GeomFromText('POINT(521543 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), 0);
 -- PIP - point within polygon
-SELECT 'intersects150', ST_intersectsPrepared('POINT(5 5)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
+SELECT 'intersects150', ST_intersects('POINT(5 5)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 0);
 -- PIP - point on polygon vertex
-SELECT 'intersects151', ST_intersectsPrepared('POINT(0 0)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
+SELECT 'intersects151', ST_intersects('POINT(0 0)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 0);
 -- PIP - point outside polygon
-SELECT 'intersects152', ST_intersectsPrepared('POINT(-1 0)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
+SELECT 'intersects152', ST_intersects('POINT(-1 0)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 0);
 -- PIP - point on polygon edge
-SELECT 'intersects153', ST_intersectsPrepared('POINT(0 5)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
+SELECT 'intersects153', ST_intersects('POINT(0 5)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 0);
 -- PIP - point in line with polygon edge
-SELECT 'intersects154', ST_intersectsPrepared('POINT(0 12)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
+SELECT 'intersects154', ST_intersects('POINT(0 12)', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', 0);
 -- PIP - point vertically aligned with polygon vertex 
-SELECT 'intersects155', ST_intersectsPrepared(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
+SELECT 'intersects155', ST_intersects(ST_GeomFromText('POINT(521513 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), 0);
 -- PIP - repeated vertex
-SELECT 'intersects156', ST_intersectsPrepared(ST_GeomFromText('POINT(521543 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631));
+SELECT 'intersects156', ST_intersects(ST_GeomFromText('POINT(521543 5377804)', 32631), ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), 0);
 
-SELECT 'intersects200', ST_intersectsPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'intersects200', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('POINT(5 5)'),('POINT(5 5)'),('POINT(5 5)') 
 ) as v(p);
 -- PIP - point on vertex of polygon
-SELECT 'intersects201', ST_intersectsPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'intersects201', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('POINT(0 0)'),('POINT(0 0)'),('POINT(0 0)')
 ) as v(p);
 -- PIP - point outside polygon
-SELECT 'intersects202', ST_intersectsPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'intersects202', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('POINT(-1 0)'),('POINT(-1 0)'),('POINT(-1 0)')
 ) as v(p);
 -- PIP - point on edge of polygon
-SELECT 'intersects203', ST_intersectsPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'intersects203', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('POINT(0 5)'),('POINT(0 5)'),('POINT(0 5)')
 ) as v(p);
 -- PIP - point in line with polygon edge
-SELECT 'intersects204', ST_intersectsPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'intersects204', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('POINT(0 12)'),('POINT(0 12)'),('POINT(0 12)')
 ) as v(p);
 -- PIP - point vertically aligned with polygon vertex 
-SELECT 'intersects205', ST_intersectsPrepared(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), p) from ( values 
+SELECT 'intersects205', ST_intersects(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), p, 0) from ( values 
 (ST_GeomFromText('POINT(521513 5377804)', 32631)),(ST_GeomFromText('POINT(521513 5377804)', 32631)),(ST_GeomFromText('POINT(521513 5377804)', 32631))
 ) as v(p);
 -- PIP - repeated vertex 
-SELECT 'intersects206', ST_intersectsPrepared(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), p) from ( values 
+SELECT 'intersects206', ST_intersects(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), p, 0) from ( values 
 (ST_GeomFromText('POINT(521513 5377804)', 32631)),(ST_GeomFromText('POINT(521513 5377804)', 32631)),(ST_GeomFromText('POINT(521513 5377804)', 32631))
 ) as v(p);
-SELECT 'intersects210', ST_intersectsPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'intersects210', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)')
 ) as v(p);
-SELECT 'intersects211', ST_intersectsPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'intersects211', ST_intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)')
 ) as v(p);
 
 
 -- PIP - point within polygon
-SELECT 'contains100', ST_ContainsPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'contains100', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('POINT(5 5)'),('POINT(5 5)'),('POINT(5 5)')
 ) as v(p);
 -- PIP - point on vertex of polygon
-SELECT 'contains101', ST_ContainsPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'contains101', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('POINT(0 0)'),('POINT(0 0)'),('POINT(0 0)')
 ) as v(p);
 -- PIP - point outside polygon
-SELECT 'contains102', ST_ContainsPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'contains102', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('POINT(-1 0)'),('POINT(-1 0)'),('POINT(-1 0)')
 ) as v(p);
+-- PIP - point on edge of rect
+SELECT 'contains103', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
+('POINT(0 5)'),('POINT(0 5)'),('POINT(0 5)')
+) as v(p);
+-- PIP - point on other edge of rect
+SELECT 'contains103a', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
+('POINT(5 0)'),('POINT(5 0)'),('POINT(5 0)')
+) as v(p);
 -- PIP - point on edge of polygon
-SELECT 'contains103', ST_ContainsPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'contains103b', ST_Contains('POLYGON((0 0, 0 10, 10 10, 15 0, 0 0))', p, 0) from ( values 
 ('POINT(0 5)'),('POINT(0 5)'),('POINT(0 5)')
 ) as v(p);
+-- PIP - point on other edge of polygon
+SELECT 'contains103c', ST_Contains('POLYGON((0 0, 0 10, 10 10, 15 0, 0 0))', p, 0) from ( values 
+('POINT(5 0)'),('POINT(5 0)'),('POINT(5 0)')
+) as v(p);
 -- PIP - point in line with polygon edge
-SELECT 'contains104', ST_ContainsPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'contains104', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('POINT(0 12)'),('POINT(0 12)'),('POINT(0 12)')
 ) as v(p);
 -- PIP - point vertically aligned with polygon vertex 
-SELECT 'contains105', ST_ContainsPrepared(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), p) from ( values 
+SELECT 'contains105', ST_Contains(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), p, 0) from ( values 
 (ST_GeomFromText('POINT(521513 5377804)', 32631)),(ST_GeomFromText('POINT(521513 5377804)', 32631)),(ST_GeomFromText('POINT(521513 5377804)', 32631))
 ) as v(p);
 -- PIP - repeated vertex 
-SELECT 'contains106', ST_ContainsPrepared(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), p) from ( values 
+SELECT 'contains106', ST_Contains(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), p, 0) from ( values 
 (ST_GeomFromText('POINT(521513 5377804)', 32631)),(ST_GeomFromText('POINT(521513 5377804)', 32631)),(ST_GeomFromText('POINT(521513 5377804)', 32631))
 ) as v(p);
-SELECT 'contains110', ST_ContainsPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'contains110', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)')
 ) as v(p);
-SELECT 'contains111', ST_ContainsPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'contains111', ST_Contains('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)')
 ) as v(p);
 
 -- PIP - point within polygon
-SELECT 'containsproperly100', ST_ContainsProperlyPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'containsproperly100', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('POINT(5 5)'),('POINT(5 5)'),('POINT(5 5)')
 ) as v(p);
 -- PIP - point on vertex of polygon
-SELECT 'containsproperly101', ST_ContainsProperlyPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'containsproperly101', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('POINT(0 0)'),('POINT(0 0)'),('POINT(0 0)')
 ) as v(p);
 -- PIP - point outside polygon
-SELECT 'containsproperly102', ST_ContainsProperlyPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'containsproperly102', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('POINT(-1 0)'),('POINT(-1 0)'),('POINT(-1 0)')
 ) as v(p);
+-- PIP - point on edge of rect
+SELECT 'containsproperly103', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
+('POINT(0 5)'),('POINT(0 5)'),('POINT(0 5)')
+) as v(p);
+-- PIP - point on other edge of rect
+SELECT 'containsproperly103a', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
+('POINT(5 0)'),('POINT(5 0)'),('POINT(5 0)')
+) as v(p);
 -- PIP - point on edge of polygon
-SELECT 'containsproperly103', ST_ContainsProperlyPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'containsproperly103b', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 15 0, 0 0))', p, 0) from ( values 
 ('POINT(0 5)'),('POINT(0 5)'),('POINT(0 5)')
 ) as v(p);
+-- PIP - point on other edge of polygon
+SELECT 'containsproperly103c', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 15 0, 0 0))', p, 0) from ( values 
+('POINT(5 0)'),('POINT(5 0)'),('POINT(5 0)')
+) as v(p);
 -- PIP - point in line with polygon edge
-SELECT 'containsproperly104', ST_ContainsProperlyPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'containsproperly104', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('POINT(0 12)'),('POINT(0 12)'),('POINT(0 12)')
 ) as v(p);
 -- PIP - point vertically aligned with polygon vertex 
-SELECT 'containsproperly105', ST_ContainsProperlyPrepared(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), p) from ( values 
+SELECT 'containsproperly105', ST_ContainsProperly(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), p, 0) from ( values 
 (ST_GeomFromText('POINT(521513 5377804)', 32631)),(ST_GeomFromText('POINT(521513 5377804)', 32631)),(ST_GeomFromText('POINT(521513 5377804)', 32631))
 ) as v(p);
 -- PIP - repeated vertex 
-SELECT 'containsproperly106', ST_ContainsProperlyPrepared(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), p) from ( values 
+SELECT 'containsproperly106', ST_ContainsProperly(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), p, 0) from ( values 
 (ST_GeomFromText('POINT(521513 5377804)', 32631)),(ST_GeomFromText('POINT(521513 5377804)', 32631)),(ST_GeomFromText('POINT(521513 5377804)', 32631))
 ) as v(p);
-SELECT 'containsproperly110', ST_ContainsProperlyPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'containsproperly110', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)')
 ) as v(p);
-SELECT 'containsproperly111', ST_ContainsProperlyPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'containsproperly111', ST_ContainsProperly('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)')
 ) as v(p);
 
 -- Covers cases
-SELECT 'covers100', ST_CoversPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'covers100', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)'),('LINESTRING(1 10, 9 10, 9 8)')
 ) as v(p);
-SELECT 'covers101', ST_CoversPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'covers101', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)'),('LINESTRING(1 10, 10 10, 10 8)')
 ) as v(p);
 -- PIP - point within polygon
-SELECT 'covers102', ST_CoversPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'covers102', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('POINT(5 5)'),('POINT(5 5)'),('POINT(5 5)')
 ) as v(p);
 -- PIP - point on vertex of polygon
-SELECT 'covers103', ST_CoversPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'covers103', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('POINT(0 0)'),('POINT(0 0)'),('POINT(0 0)')
 ) as v(p);
 -- PIP - point outside polygon
-SELECT 'covers104', ST_CoversPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'covers104', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('POINT(-1 0)'),('POINT(-1 0)'),('POINT(-1 0)')
 ) as v(p);
 -- PIP - point on edge of polygon
-SELECT 'covers105', ST_CoversPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'covers105', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('POINT(0 5)'),('POINT(0 5)'),('POINT(0 5)')
 ) as v(p);
 -- PIP - point in line with polygon edge
-SELECT 'covers106', ST_CoversPrepared('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p) from ( values 
+SELECT 'covers106', ST_Covers('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))', p, 0) from ( values 
 ('POINT(0 12)'),('POINT(0 12)'),('POINT(0 12)')
 ) as v(p);
 -- PIP - point vertically aligned with polygon vertex 
-SELECT 'covers107', ST_CoversPrepared(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), p) from ( values 
+SELECT 'covers107', ST_Covers(ST_GeomFromText('POLYGON((521526 5377783, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), p, 0) from ( values 
 (ST_GeomFromText('POINT(521513 5377804)', 32631)),(ST_GeomFromText('POINT(521513 5377804)', 32631)),(ST_GeomFromText('POINT(521513 5377804)', 32631))
 ) as v(p);
 -- PIP - repeated vertex 
-SELECT 'covers108', ST_CoversPrepared(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), p) from ( values 
+SELECT 'covers108', ST_Covers(ST_GeomFromText('POLYGON((521526 5377783, 521482 5377811, 521481 5377811, 521494 5377832, 521539 5377804, 521526 5377783))', 32631), p, 0) from ( values 
 (ST_GeomFromText('POINT(521513 5377804)', 32631)),(ST_GeomFromText('POINT(521513 5377804)', 32631)),(ST_GeomFromText('POINT(521513 5377804)', 32631))
 ) as v(p);

Modified: trunk/regress/regress_ogc_prep_expected
===================================================================
--- trunk/regress/regress_ogc_prep_expected	2008-01-22 19:44:25 UTC (rev 2734)
+++ trunk/regress/regress_ogc_prep_expected	2008-01-29 01:24:34 UTC (rev 2735)
@@ -54,6 +54,15 @@
 contains103|f
 contains103|f
 contains103|f
+contains103a|f
+contains103a|f
+contains103a|f
+contains103b|f
+contains103b|f
+contains103b|f
+contains103c|f
+contains103c|f
+contains103c|f
 contains104|f
 contains104|f
 contains104|f
@@ -81,6 +90,15 @@
 containsproperly103|f
 containsproperly103|f
 containsproperly103|f
+containsproperly103a|f
+containsproperly103a|f
+containsproperly103a|f
+containsproperly103b|f
+containsproperly103b|f
+containsproperly103b|f
+containsproperly103c|f
+containsproperly103c|f
+containsproperly103c|f
 containsproperly104|f
 containsproperly104|f
 containsproperly104|f



More information about the postgis-commits mailing list