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

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Mon Jan 21 16:24:45 PST 2008


Author: benjubb
Date: 2008-01-21 16:24:42 -0800 (Mon, 21 Jan 2008)
New Revision: 2733

Modified:
   trunk/lwgeom/lwgeom_geos_c.c
Log:
Modified to check version of GEOS and stub out prepared predicates if GEOS is prior to 3.1.0




Modified: trunk/lwgeom/lwgeom_geos_c.c
===================================================================
--- trunk/lwgeom/lwgeom_geos_c.c	2008-01-18 18:57:25 UTC (rev 2732)
+++ trunk/lwgeom/lwgeom_geos_c.c	2008-01-22 00:24:42 UTC (rev 2733)
@@ -3587,8 +3587,9 @@
 }
 
 
+#if ( GEOS_VERSION_MAJOR > 3 || (GEOS_VERSION_MAJOR == 3 && GEOS_VERSION_MINOR >= 1) ) && ( GEOS_CAPI_VERSION_MAJOR > 1 || (GEOS_CAPI_VERSION_MAJOR == 1 && GEOS_CAPI_VERSION_MINOR >= 5) )
 #define PREPARED_GEOM 1
-#ifdef PREPARED_GEOM
+#endif
 
 Datum containsPrepared(PG_FUNCTION_ARGS);
 Datum containsProperlyPrepared(PG_FUNCTION_ARGS);
@@ -3602,21 +3603,6 @@
 	GEOSPreparedGeometry * 	prepared_geom;
 } PREPARED_GEOM_CACHE;
 
-/*
-char
-compare_bytes( uchar *obj1, uchar *obj2, Size len)
-{
-	Size i = 0;
-	
-	while ( i < len ) 
-		if ( obj1[ i ] != obj2[ i ] )
-			return 0;
-		else
-			i++;
-			
-	return 1;
-}
-*/
 
 /* 
  * get cached prepared geometry for geom1
@@ -3697,9 +3683,16 @@
 }
 
 
+
+
 PG_FUNCTION_INFO_V1(containsPrepared);
 Datum containsPrepared(PG_FUNCTION_ARGS)
 {
+#ifndef PREPARED_GEOM
+	elog(ERROR,"Not implemented in this version!");
+	PG_RETURN_NULL(); /* never get here */
+
+#else
     Size 					arg1_length;
 	PG_LWGEOM *				geom1;
 	PG_LWGEOM *				geom2;
@@ -3772,11 +3765,17 @@
 	PG_FREE_IF_COPY(geom2, 1);
 
 	PG_RETURN_BOOL(result);
+#endif
 }
 
 PG_FUNCTION_INFO_V1(containsProperlyPrepared);
 Datum containsProperlyPrepared(PG_FUNCTION_ARGS)
 {
+#ifndef PREPARED_GEOM
+	elog(ERROR,"Not implemented in this version!");
+	PG_RETURN_NULL(); /* never get here */
+
+#else
     Size 					arg1_length;
 	PG_LWGEOM *				geom1;
 	PG_LWGEOM *				geom2;
@@ -3849,11 +3848,17 @@
 	PG_FREE_IF_COPY(geom2, 1);
 
 	PG_RETURN_BOOL(result);
+#endif
 }
 
 PG_FUNCTION_INFO_V1(coversPrepared);
 Datum coversPrepared(PG_FUNCTION_ARGS)
 {
+#ifndef PREPARED_GEOM
+	elog(ERROR,"Not implemented in this version!");
+	PG_RETURN_NULL(); /* never get here */
+
+#else
     Size 					arg1_length;
 	PG_LWGEOM *				geom1;
 	PG_LWGEOM *				geom2;
@@ -3926,11 +3931,17 @@
 	PG_FREE_IF_COPY(geom2, 1);
 
 	PG_RETURN_BOOL(result);
+#endif
 }
 
 PG_FUNCTION_INFO_V1(intersectsPrepared);
 Datum intersectsPrepared(PG_FUNCTION_ARGS)
 {
+#ifndef PREPARED_GEOM
+	elog(ERROR,"Not implemented in this version!");
+	PG_RETURN_NULL(); /* never get here */
+
+#else
     Size 					arg1_length;
 	PG_LWGEOM *				geom1;
 	PG_LWGEOM *				geom2;
@@ -4003,6 +4014,6 @@
 	PG_FREE_IF_COPY(geom2, 1);
 
 	PG_RETURN_BOOL(result);
+#endif
 }
 
-#endif



More information about the postgis-commits mailing list