[postgis-commits] svn - r3050 - trunk/lwgeom

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Thu Oct 2 09:46:40 PDT 2008


Author: pramsey
Date: 2008-10-02 09:46:39 -0700 (Thu, 02 Oct 2008)
New Revision: 3050

Modified:
   trunk/lwgeom/lwgeom_geos_c.c
Log:
ensure relate(g,g,p) is case insensitive (#44)


Modified: trunk/lwgeom/lwgeom_geos_c.c
===================================================================
--- trunk/lwgeom/lwgeom_geos_c.c	2008-10-02 16:43:53 UTC (rev 3049)
+++ trunk/lwgeom/lwgeom_geos_c.c	2008-10-02 16:46:39 UTC (rev 3050)
@@ -40,6 +40,8 @@
 /* #define UNITE_USING_BUFFER 1 */
 /* #define MAXGEOMSPOINTS 21760 */
 
+/* PROTOTYPES start */
+
 Datum relate_full(PG_FUNCTION_ARGS);
 Datum relate_pattern(PG_FUNCTION_ARGS);
 Datum disjoint(PG_FUNCTION_ARGS);
@@ -81,7 +83,15 @@
 POINTARRAY *ptarray_from_GEOSCoordSeq(GEOSCoordSeq cs, char want3d);
 
 void errorIfGeometryCollection(PG_LWGEOM *g1, PG_LWGEOM *g2);
+int point_in_polygon_rtree(RTREE_NODE **root, int ringCount, LWPOINT *point);
+int point_in_multipolygon_rtree(RTREE_NODE **root, int polyCount, int ringCount, LWPOINT *point);
+int point_in_polygon(LWPOLY *polygon, LWPOINT *point);
+int point_in_multipolygon(LWMPOLY *mpolygon, LWPOINT *pont);
 
+/* PROTOTYPES end */
+
+
+
 PG_FUNCTION_INFO_V1(postgis_geos_version);
 Datum postgis_geos_version(PG_FUNCTION_ARGS)
 {
@@ -1378,12 +1388,7 @@
 	PG_RETURN_BOOL(result);
 }
 
-int point_in_polygon_rtree(RTREE_NODE **root, int ringCount, LWPOINT *point);
-int point_in_multipolygon_rtree(RTREE_NODE **root, int polyCount, int ringCount, LWPOINT *point);
-int point_in_polygon(LWPOLY *polygon, LWPOINT *point);
-int point_in_multipolygon(LWMPOLY *mpolygon, LWPOINT *pont);
 
-
 PG_FUNCTION_INFO_V1(contains);
 Datum contains(PG_FUNCTION_ARGS)
 {
@@ -2300,7 +2305,6 @@
 		if ( box2.ymin > box1.ymax ) PG_RETURN_BOOL(TRUE);
 	}
 
-
 	initGEOS(lwnotice, lwnotice);
 
 #ifdef PROFILE
@@ -2354,6 +2358,7 @@
 	char *patt;
 	bool result;
 	GEOSGeom g1,g2;
+	int i;
 
 #ifdef PROFILE
 	profstart(PROF_QRUN);
@@ -2385,6 +2390,14 @@
 	patt =  DatumGetCString(DirectFunctionCall1(textout,
                         PointerGetDatum(PG_GETARG_DATUM(2))));
 
+    /*
+    ** Need to make sure 't' and 'f' are upper-case before handing to GEOS 
+    */
+	for( i = 0; i < strlen(patt); i++ ) {
+		if( patt[i] == 't' ) patt[i] = 'T';
+		if( patt[i] == 'f' ) patt[i] = 'F';
+	}
+
 #ifdef PROFILE
 	profstart(PROF_GRUN);
 #endif
@@ -3634,13 +3647,13 @@
 	}
 	
 	old_context = MemoryContextSwitchTo(fcinfo->flinfo->fn_mcxt);
-	prep_cache =  fcinfo->flinfo->fn_extra;
+	prep_cache = fcinfo->flinfo->fn_extra;
 	prep_cache = get_prepared_geometry_cache( prep_cache, geom1, 0, key1, 0 );
 	fcinfo->flinfo->fn_extra = prep_cache;
 	MemoryContextSwitchTo(old_context);
 
 	initGEOS(lwnotice, lwnotice);
-
+	
 	if ( prep_cache && prep_cache->prepared_geom && prep_cache->argnum == 1 )
 	{
     	GEOSGeom g = POSTGIS2GEOS(geom2);



More information about the postgis-commits mailing list