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

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Thu Oct 9 22:17:54 PDT 2008


Author: pramsey
Date: 2008-10-09 22:17:54 -0700 (Thu, 09 Oct 2008)
New Revision: 3087

Modified:
   trunk/lwgeom/lwgeom_geos.c
   trunk/lwgeom/lwgeom_geos.h
   trunk/lwgeom/lwgeom_geos_prepared.c
   trunk/lwgeom/lwpostgis.sql.in.c
Log:
Clean-up and comment.


Modified: trunk/lwgeom/lwgeom_geos.c
===================================================================
--- trunk/lwgeom/lwgeom_geos.c	2008-10-10 04:41:03 UTC (rev 3086)
+++ trunk/lwgeom/lwgeom_geos.c	2008-10-10 05:17:54 UTC (rev 3087)
@@ -17,22 +17,14 @@
 
 
 /*
- *
- * WARNING: buffer-based GeomUnion has been disabled due to
- *          limitations in the GEOS code (it would only work
- *	    against polygons)
- *
- * Fuzzy way of finding out how many points to stuff
- * in each chunk: 680 * Mb of memory
- *
- * The example below is for about 32 MB (fuzzy pragmatic check)
- *
- */
-/* #define UNITE_USING_BUFFER 1 */
-/* #define MAXGEOMSPOINTS 21760 */
+** NOTE: Buffer-based GeomUnion has been disabled due to
+** limitations in the GEOS code (it would only work against polygons)
+** TODO: Implement cascaded GeomUnion and remove old buffer-based code.
+*/
 
-/* PROTOTYPES start */
-
+/* 
+** Prototypes for SQL-bound functions
+*/
 Datum relate_full(PG_FUNCTION_ARGS);
 Datum relate_pattern(PG_FUNCTION_ARGS);
 Datum disjoint(PG_FUNCTION_ARGS);
@@ -60,10 +52,9 @@
 Datum pointonsurface(PG_FUNCTION_ARGS);
 Datum GEOSnoop(PG_FUNCTION_ARGS);
 Datum postgis_geos_version(PG_FUNCTION_ARGS);
-Datum postgis_jts_version(PG_FUNCTION_ARGS);
 Datum centroid(PG_FUNCTION_ARGS);
 Datum polygonize_garray(PG_FUNCTION_ARGS);
-Datum LWGEOM_buildarea(PG_FUNCTION_ARGS);
+Datum LWGEOM_buildarea(PG_FUNCTION_ARGS); /* TODO: rename to match others */
 Datum linemerge(PG_FUNCTION_ARGS);
 Datum coveredby(PG_FUNCTION_ARGS);
 
@@ -73,28 +64,11 @@
 int point_in_polygon(LWPOLY *polygon, LWPOINT *point);
 int point_in_multipolygon(LWMPOLY *mpolygon, LWPOINT *pont);
 
-/* PROTOTYPES end */
+/* 
+** Prototypes end 
+*/
 
-/*********************************************************************************
-**
-**  PreparedGeometry implementations that cache intermediate indexed versions
-**  of geometry in a special MemoryContext for re-used by future function
-**  invocations.
-**
-**  By creating a memory context to hold the GEOS PreparedGeometry and Geometry
-**  and making it a child of the fmgr memory context, we can get the memory held
-**  by the GEOS objects released when the memory context delete callback is
-**  invoked by the parent context.
-**
-*********************************************************************************/
 
-#include "utils/memutils.h"
-#include "executor/spi.h"
-#include "access/hash.h"
-#include "utils/hsearch.h"
-
-
-
 PG_FUNCTION_INFO_V1(postgis_geos_version);
 Datum postgis_geos_version(PG_FUNCTION_ARGS)
 {
@@ -739,30 +713,13 @@
 	GEOSGeom g1,g3;
 	PG_LWGEOM *result;
 
-#ifdef PROFILE
-	profstart(PROF_QRUN);
-#endif
-
 	geom1 = (PG_LWGEOM *)  PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
 	tolerance = PG_GETARG_FLOAT8(1);
 
 	initGEOS(lwnotice, lwnotice);
 
-#ifdef PROFILE
-	profstart(PROF_P2G1);
-#endif
 	g1 = POSTGIS2GEOS(geom1);
-#ifdef PROFILE
-	profstop(PROF_P2G1);
-#endif
-
-#ifdef PROFILE
-	profstart(PROF_GRUN);
-#endif
 	g3 = GEOSTopologyPreserveSimplify(g1,tolerance);
-#ifdef PROFILE
-	profstop(PROF_GRUN);
-#endif
 
 	if (g3 == NULL)
 	{
@@ -776,13 +733,8 @@
 
 	GEOSSetSRID(g3, pglwgeom_getSRID(geom1));
 
-#ifdef PROFILE
-	profstart(PROF_G2P);
-#endif
 	result = GEOS2POSTGIS(g3, TYPE_HASZ(geom1->type));
-#ifdef PROFILE
-	profstop(PROF_G2P);
-#endif
+
 	if (result == NULL)
 	{
 		GEOSGeom_destroy(g1);
@@ -793,19 +745,10 @@
 	GEOSGeom_destroy(g1);
 	GEOSGeom_destroy(g3);
 
-
-	/* compressType(result); */
-
-#ifdef PROFILE
-	profstop(PROF_QRUN);
-	profreport("geos",geom1, NULL, result);
-#endif
-
 	PG_FREE_IF_COPY(geom1, 0);
-
 	PG_RETURN_POINTER(result);
 }
-#endif
+#endif /* POSTGIS_GEOS_VERSION >= 30 */
 
 PG_FUNCTION_INFO_V1(buffer);
 Datum buffer(PG_FUNCTION_ARGS)
@@ -933,9 +876,6 @@
 	/*POSTGIS_DEBUGF(3, "g2 is valid = %i",GEOSisvalid(g2)); */
 	/*POSTGIS_DEBUGF(3, "g1 is valid = %i",GEOSisvalid(g1)); */
 
-
-
-
 #ifdef PROFILE
 	profstart(PROF_GRUN);
 #endif
@@ -954,7 +894,6 @@
 		PG_RETURN_NULL(); /* never get here */
 	}
 
-
 	POSTGIS_DEBUGF(3, "result: %s", GEOSGeomToWKT(g3) ) ;
 
 	GEOSSetSRID(g3, SRID);
@@ -976,14 +915,10 @@
 		PG_RETURN_NULL(); /* never get here */
 	}
 
-
-
 	GEOSGeom_destroy(g1);
 	GEOSGeom_destroy(g2);
 	GEOSGeom_destroy(g3);
 
-	/* compressType(result); */
-
 #ifdef PROFILE
 	profstop(PROF_QRUN);
 	profreport("geos",geom1, geom2, result);
@@ -1409,7 +1344,6 @@
 	PrepGeomCache *prep_cache;
 #endif
 
-
 	geom1 = (PG_LWGEOM *)  PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
 	geom2 = (PG_LWGEOM *)  PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
 
@@ -1625,10 +1559,11 @@
 	if ( getbox2d_p(SERIALIZED_FORM(geom1), &box1) &&
 	     getbox2d_p(SERIALIZED_FORM(geom2), &box2) )
 	{
-		if ( box2.xmin < box1.xmin ) PG_RETURN_BOOL(FALSE);
-		if ( box2.xmax > box1.xmax ) PG_RETURN_BOOL(FALSE);
-		if ( box2.ymin < box1.ymin ) PG_RETURN_BOOL(FALSE);
-		if ( box2.ymax > box1.ymax ) PG_RETURN_BOOL(FALSE);
+		if (( box2.xmin < box1.xmin ) || ( box2.xmax > box1.xmax ) ||
+		    ( box2.ymin < box1.ymin ) || ( box2.ymax > box1.ymax )) 
+		{
+			PG_RETURN_BOOL(FALSE);
+		}
 	}
 	/*
 	 * short-circuit 2: if geom2 is a point and geom1 is a polygon
@@ -1759,10 +1694,11 @@
 	if ( getbox2d_p(SERIALIZED_FORM(geom1), &box1) &&
 	                getbox2d_p(SERIALIZED_FORM(geom2), &box2) )
 	{
-		if ( box1.xmin < box2.xmin ) PG_RETURN_BOOL(FALSE);
-		if ( box1.xmax > box2.xmax ) PG_RETURN_BOOL(FALSE);
-		if ( box1.ymin < box2.ymin ) PG_RETURN_BOOL(FALSE);
-		if ( box1.ymax > box2.ymax ) PG_RETURN_BOOL(FALSE);
+		if ( ( box1.xmin < box2.xmin ) || ( box1.xmax > box2.xmax ) ||
+		     ( box1.ymin < box2.ymin ) || ( box1.ymax > box2.ymax ) )
+		{
+			PG_RETURN_BOOL(FALSE);
+		}
 	}
 	/*
 	 * short-circuit 2: if geom1 is a point and geom2 is a polygon
@@ -1902,10 +1838,11 @@
 	if ( getbox2d_p(SERIALIZED_FORM(geom1), &box1) &&
 	                getbox2d_p(SERIALIZED_FORM(geom2), &box2) )
 	{
-		if ( box1.xmin < box2.xmin ) PG_RETURN_BOOL(FALSE);
-		if ( box1.xmax > box2.xmax ) PG_RETURN_BOOL(FALSE);
-		if ( box1.ymin < box2.ymin ) PG_RETURN_BOOL(FALSE);
-		if ( box1.ymax > box2.ymax ) PG_RETURN_BOOL(FALSE);
+		if ( ( box1.xmin < box2.xmin ) || ( box1.xmax > box2.xmax ) ||
+		     ( box1.ymin < box2.ymin ) || ( box1.ymax > box2.ymax ) )
+		{
+			PG_RETURN_BOOL(FALSE);
+		}
 
 		POSTGIS_DEBUG(3, "bounding box short-circuit missed.");
 	}
@@ -2038,10 +1975,11 @@
 	if ( getbox2d_p(SERIALIZED_FORM(geom1), &box1) &&
 	                getbox2d_p(SERIALIZED_FORM(geom2), &box2) )
 	{
-		if ( box2.xmax < box1.xmin ) PG_RETURN_BOOL(FALSE);
-		if ( box2.xmin > box1.xmax ) PG_RETURN_BOOL(FALSE);
-		if ( box2.ymax < box1.ymin ) PG_RETURN_BOOL(FALSE);
-		if ( box2.ymin > box2.ymax ) PG_RETURN_BOOL(FALSE);
+		if ( ( box2.xmax < box1.xmin ) || ( box2.xmin > box1.xmax ) ||
+		     ( box2.ymax < box1.ymin ) || ( box2.ymin > box2.ymax ) )
+		{
+			PG_RETURN_BOOL(FALSE);
+		}
 	}
 
 	initGEOS(lwnotice, lwnotice);
@@ -2121,10 +2059,11 @@
 	if ( getbox2d_p(SERIALIZED_FORM(geom1), &box1) &&
 	                getbox2d_p(SERIALIZED_FORM(geom2), &box2) )
 	{
-		if ( box2.xmax < box1.xmin ) PG_RETURN_BOOL(FALSE);
-		if ( box2.xmin > box1.xmax ) PG_RETURN_BOOL(FALSE);
-		if ( box2.ymax < box1.ymin ) PG_RETURN_BOOL(FALSE);
-		if ( box2.ymin > box1.ymax ) PG_RETURN_BOOL(FALSE);
+		if ( ( box2.xmax < box1.xmin ) || ( box2.xmin > box1.xmax ) ||
+		     ( box2.ymax < box1.ymin ) || ( box2.ymin > box1.ymax ) )
+		{
+			PG_RETURN_BOOL(FALSE);
+		}
 	}
 
 	/*
@@ -2263,10 +2202,11 @@
 	if ( getbox2d_p(SERIALIZED_FORM(geom1), &box1) &&
 	                getbox2d_p(SERIALIZED_FORM(geom2), &box2) )
 	{
-		if ( box2.xmax < box1.xmin ) PG_RETURN_BOOL(FALSE);
-		if ( box2.xmin > box1.xmax ) PG_RETURN_BOOL(FALSE);
-		if ( box2.ymax < box1.ymin ) PG_RETURN_BOOL(FALSE);
-		if ( box2.ymin > box2.ymax ) PG_RETURN_BOOL(FALSE);
+		if ( ( box2.xmax < box1.xmin ) || ( box2.xmin > box1.xmax ) ||
+		     ( box2.ymax < box1.ymin ) || ( box2.ymin > box1.ymax ) )
+		{
+			PG_RETURN_BOOL(FALSE);
+		}
 	}
 
 	initGEOS(lwnotice, lwnotice);
@@ -2342,10 +2282,11 @@
 	if ( getbox2d_p(SERIALIZED_FORM(geom1), &box1) &&
 	                getbox2d_p(SERIALIZED_FORM(geom2), &box2) )
 	{
-		if ( box2.xmax < box1.xmin ) PG_RETURN_BOOL(TRUE);
-		if ( box2.xmin > box1.xmax ) PG_RETURN_BOOL(TRUE);
-		if ( box2.ymax < box1.ymin ) PG_RETURN_BOOL(TRUE);
-		if ( box2.ymin > box1.ymax ) PG_RETURN_BOOL(TRUE);
+		if ( ( box2.xmax < box1.xmin ) || ( box2.xmin > box1.xmax ) ||
+		     ( box2.ymax < box1.ymin ) || ( box2.ymin > box1.ymax ) )
+		{
+			PG_RETURN_BOOL(TRUE);
+		}
 	}
 
 	initGEOS(lwnotice, lwnotice);
@@ -2403,10 +2344,6 @@
 	GEOSGeom g1,g2;
 	int i;
 
-#ifdef PROFILE
-	profstart(PROF_QRUN);
-#endif
-
 	geom1 = (PG_LWGEOM *)  PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
 	geom2 = (PG_LWGEOM *)  PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
 
@@ -2415,20 +2352,8 @@
 
 	initGEOS(lwnotice, lwnotice);
 
-#ifdef PROFILE
-	profstart(PROF_P2G1);
-#endif
 	g1 = POSTGIS2GEOS(geom1);
-#ifdef PROFILE
-	profstop(PROF_P2G1);
-#endif
-#ifdef PROFILE
-	profstart(PROF_P2G2);
-#endif
 	g2 = POSTGIS2GEOS(geom2);
-#ifdef PROFILE
-	profstop(PROF_P2G2);
-#endif
 
 	patt =  DatumGetCString(DirectFunctionCall1(textout,
 	                        PointerGetDatum(PG_GETARG_DATUM(2))));
@@ -2442,13 +2367,7 @@
 		if ( patt[i] == 'f' ) patt[i] = 'F';
 	}
 
-#ifdef PROFILE
-	profstart(PROF_GRUN);
-#endif
 	result = GEOSRelatePattern(g1,g2,patt);
-#ifdef PROFILE
-	profstop(PROF_GRUN);
-#endif
 	GEOSGeom_destroy(g1);
 	GEOSGeom_destroy(g2);
 	pfree(patt);
@@ -2459,11 +2378,6 @@
 		PG_RETURN_NULL(); /* never get here */
 	}
 
-#ifdef PROFILE
-	profstop(PROF_QRUN);
-	profreport("geos",geom1, geom2, NULL);
-#endif
-
 	PG_FREE_IF_COPY(geom1, 0);
 	PG_FREE_IF_COPY(geom2, 1);
 
@@ -2482,10 +2396,6 @@
 	int len;
 	text *result;
 
-#ifdef PROFILE
-	profstart(PROF_QRUN);
-#endif
-
 	POSTGIS_DEBUG(2, "in relate_full()");
 
 	geom1 = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
@@ -2494,23 +2404,10 @@
 	errorIfGeometryCollection(geom1,geom2);
 	errorIfSRIDMismatch(pglwgeom_getSRID(geom1), pglwgeom_getSRID(geom2));
 
-
 	initGEOS(lwnotice, lwnotice);
 
-#ifdef PROFILE
-	profstart(PROF_P2G1);
-#endif
 	g1 = POSTGIS2GEOS(geom1 );
-#ifdef PROFILE
-	profstop(PROF_P2G1);
-#endif
-#ifdef PROFILE
-	profstart(PROF_P2G2);
-#endif
 	g2 = POSTGIS2GEOS(geom2 );
-#ifdef PROFILE
-	profstop(PROF_P2G2);
-#endif
 
 	POSTGIS_DEBUG(3, "constructed geometries ");
 
@@ -2525,14 +2422,7 @@
 
 	POSTGIS_DEBUG(3, "about to relate()");
 
-
-#ifdef PROFILE
-	profstart(PROF_GRUN);
-#endif
 	relate_str = GEOSRelate(g1, g2);
-#ifdef PROFILE
-	profstop(PROF_GRUN);
-#endif
 
 	POSTGIS_DEBUG(3, "finished relate()");
 
@@ -2554,18 +2444,12 @@
 
 	free(relate_str);
 
-#ifdef PROFILE
-	profstop(PROF_QRUN);
-	profreport("geos",geom1, geom2, NULL);
-#endif
-
 	PG_FREE_IF_COPY(geom1, 0);
 	PG_FREE_IF_COPY(geom2, 1);
 
 	PG_RETURN_POINTER(result);
 }
 
-/*============================== */
 
 PG_FUNCTION_INFO_V1(geomequals);
 Datum geomequals(PG_FUNCTION_ARGS)
@@ -2653,10 +2537,6 @@
 
 	POSTGIS_DEBUG(2, "issimple called");
 
-#ifdef PROFILE
-	profstart(PROF_QRUN);
-#endif
-
 	geom = (PG_LWGEOM *)  PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
 
 	if (lwgeom_getnumgeometries(SERIALIZED_FORM(geom)) == 0)
@@ -2664,21 +2544,8 @@
 
 	initGEOS(lwnotice, lwnotice);
 
-#ifdef PROFILE
-	profstart(PROF_P2G1);
-#endif
 	g1 = POSTGIS2GEOS(geom);
-#ifdef PROFILE
-	profstop(PROF_P2G1);
-#endif
-
-#ifdef PROFILE
-	profstart(PROF_GRUN);
-#endif
 	result = GEOSisSimple(g1);
-#ifdef PROFILE
-	profstop(PROF_GRUN);
-#endif
 	GEOSGeom_destroy(g1);
 
 	if (result == 2)
@@ -2687,11 +2554,6 @@
 		PG_RETURN_NULL(); /*never get here */
 	}
 
-#ifdef PROFILE
-	profstop(PROF_QRUN);
-	profreport("geos",geom, NULL, NULL);
-#endif
-
 	PG_FREE_IF_COPY(geom, 0);
 
 	PG_RETURN_BOOL(result);
@@ -2704,10 +2566,6 @@
 	GEOSGeom g1;
 	int result;
 
-#ifdef PROFILE
-	profstart(PROF_QRUN);
-#endif
-
 	geom = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
 
 	if (lwgeom_getType(geom->type) != LINETYPE)
@@ -2720,21 +2578,8 @@
 
 	initGEOS(lwnotice, lwnotice);
 
-#ifdef PROFILE
-	profstart(PROF_P2G1);
-#endif
 	g1 = POSTGIS2GEOS(geom );
-#ifdef PROFILE
-	profstop(PROF_P2G1);
-#endif
-
-#ifdef PROFILE
-	profstart(PROF_GRUN);
-#endif
 	result = GEOSisRing(g1);
-#ifdef PROFILE
-	profstop(PROF_GRUN);
-#endif
 	GEOSGeom_destroy(g1);
 
 	if (result == 2)
@@ -2743,22 +2588,23 @@
 		PG_RETURN_NULL();
 	}
 
-#ifdef PROFILE
-	profstop(PROF_QRUN);
-	profreport("geos",geom, NULL, NULL);
-#endif
-
 	PG_FREE_IF_COPY(geom, 0);
-
 	PG_RETURN_BOOL(result);
 }
 
 
 
-/*= GEOS <=> POSTGIS CONVERSION ========================= */
+/*
+**  GEOS <==> PostGIS conversion functions
+**
+** WKB_CONVERSION is turned off by default. It serializes PostGIS to a WKB
+** array, then GEOS deserializes that array. 
+**
+** Default conversion creates a GEOS point array, then iterates through the
+** PostGIS points, setting each value in the GEOS array one at a time.
+**
+*/
 
-/*-----=GEOS2POSTGIS= */
-
 #ifdef WKB_CONVERSION
 
 /* Return an LWGEOM from a GEOSGeom */
@@ -3394,20 +3240,6 @@
 	PG_RETURN_POINTER(result);
 }
 
-Datum JTSnoop(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1(JTSnoop);
-Datum JTSnoop(PG_FUNCTION_ARGS)
-{
-	elog(ERROR, "JTS support is disabled");
-	PG_RETURN_NULL();
-}
-
-PG_FUNCTION_INFO_V1(postgis_jts_version);
-Datum postgis_jts_version(PG_FUNCTION_ARGS)
-{
-	PG_RETURN_NULL();
-}
-
 /*
  * Take a geometry and return an areal geometry
  * (Polygon or MultiPolygon).

Modified: trunk/lwgeom/lwgeom_geos.h
===================================================================
--- trunk/lwgeom/lwgeom_geos.h	2008-10-10 04:41:03 UTC (rev 3086)
+++ trunk/lwgeom/lwgeom_geos.h	2008-10-10 05:17:54 UTC (rev 3087)
@@ -15,10 +15,13 @@
 #include "../postgis_config.h"
 
 #include "postgres.h"
+#include "fmgr.h"
+#include "miscadmin.h"
 #include "utils/array.h"
 #include "utils/builtins.h"
-#include "fmgr.h"
-#include "miscadmin.h"
+#include "utils/hsearch.h"
+#include "utils/memutils.h"
+#include "executor/spi.h"
 
 #include "geos_c.h"
 

Modified: trunk/lwgeom/lwgeom_geos_prepared.c
===================================================================
--- trunk/lwgeom/lwgeom_geos_prepared.c	2008-10-10 04:41:03 UTC (rev 3086)
+++ trunk/lwgeom/lwgeom_geos_prepared.c	2008-10-10 05:17:54 UTC (rev 3087)
@@ -13,38 +13,39 @@
 
 #include "lwgeom_geos_prepared.h"
 
-/* 
-** Prepared geometry function prototypes 
-*/
-Datum containsPrepared(PG_FUNCTION_ARGS);
-Datum coversPrepared(PG_FUNCTION_ARGS);
-Datum intersectsPrepared(PG_FUNCTION_ARGS);
-
-/**********************************************************************
-** Internal prototype and structure definitions for the 
-** prepared geometry code.
+/***********************************************************************
 **
-** Working parts:
+**  PreparedGeometry implementations that cache intermediate indexed versions
+**  of geometry in a special MemoryContext for re-used by future function
+**  invocations.
 **
-** PrepGeomCache, the actual struct that holds the keys we compare
-** to determine if our cache is stale, and references to the GEOS
-** objects used in computations.
+**  By creating a memory context to hold the GEOS PreparedGeometry and Geometry
+**  and making it a child of the fmgr memory context, we can get the memory held
+**  by the GEOS objects released when the memory context delete callback is
+**  invoked by the parent context.
 **
-** PrepGeomHash, a global hash table that uses a MemoryContext as
-** key and returns a structure holding references to the GEOS
-** objects used in computations.
+**  Working parts:
 **
-** PreparedCacheContextMethods, a set of callback functions that
-** get hooked into a MemoryContext that is in turn used as a 
-** key in the PrepGeomHash.
+**  PrepGeomCache, the actual struct that holds the keys we compare
+**  to determine if our cache is stale, and references to the GEOS
+**  objects used in computations.
 **
-** All this is to allow us to clean up external malloc'ed objects
-** (the GEOS Geometry and PreparedGeometry) before the structure
-** that references them (PrepGeomCache) is pfree'd by PgSQL. The
-** methods in the PreparedCacheContext are called just before the
-** function context is freed, allowing us to look up the references
-** in the PrepGeomHash and free them before the function context
-** is freed.
+**  PrepGeomHash, a global hash table that uses a MemoryContext as
+**  key and returns a structure holding references to the GEOS
+**  objects used in computations.
+**
+**  PreparedCacheContextMethods, a set of callback functions that
+**  get hooked into a MemoryContext that is in turn used as a 
+**  key in the PrepGeomHash.
+**
+**  All this is to allow us to clean up external malloc'ed objects
+**  (the GEOS Geometry and PreparedGeometry) before the structure
+**  that references them (PrepGeomCache) is pfree'd by PgSQL. The
+**  methods in the PreparedCacheContext are called just before the
+**  function context is freed, allowing us to look up the references
+**  in the PrepGeomHash and free them before the function context
+**  is freed.
+**
 **/
 
 #ifdef PREPARED_GEOM

Modified: trunk/lwgeom/lwpostgis.sql.in.c
===================================================================
--- trunk/lwgeom/lwpostgis.sql.in.c	2008-10-10 04:41:03 UTC (rev 3086)
+++ trunk/lwgeom/lwpostgis.sql.in.c	2008-10-10 05:17:54 UTC (rev 3087)
@@ -3141,10 +3141,6 @@
 	AS 'MODULE_PATHNAME'
 	LANGUAGE 'C' _IMMUTABLE;
 
-CREATEFUNCTION postgis_jts_version() RETURNS text
-	AS 'MODULE_PATHNAME'
-	LANGUAGE 'C' _IMMUTABLE;
-
 CREATEFUNCTION postgis_scripts_build_date() RETURNS text
         AS _POSTGIS_SQL_SELECT_POSTGIS_BUILD_DATE
         LANGUAGE 'sql' _IMMUTABLE;
@@ -3161,7 +3157,6 @@
 	libver text;
 	projver text;
 	geosver text;
-	jtsver text;
 	usestats bool;
 	dbproc text;
 	relproc text;
@@ -3170,7 +3165,6 @@
 	SELECT postgis_lib_version() INTO libver;
 	SELECT postgis_proj_version() INTO projver;
 	SELECT postgis_geos_version() INTO geosver;
-	SELECT postgis_jts_version() INTO jtsver;
 	SELECT postgis_uses_stats() INTO usestats;
 	SELECT postgis_scripts_installed() INTO dbproc;
 	SELECT postgis_scripts_released() INTO relproc;
@@ -3181,10 +3175,6 @@
 		fullver = fullver || ' GEOS="' || geosver || '"';
 	END IF;
 
-	IF  jtsver IS NOT NULL THEN
-		fullver = fullver || ' JTS="' || jtsver || '"';
-	END IF;
-
 	IF  projver IS NOT NULL THEN
 		fullver = fullver || ' PROJ="' || projver || '"';
 	END IF;
@@ -3928,12 +3918,6 @@
    AS 'MODULE_PATHNAME', 'GEOSnoop'
    LANGUAGE 'C' _VOLATILE_STRICT; -- WITH (isstrict,iscachable);
 
--- Deprecation in 1.2.3
-CREATEFUNCTION JTSnoop(geometry)
-   RETURNS geometry
-   AS 'MODULE_PATHNAME', 'JTSnoop'
-   LANGUAGE 'C' _VOLATILE_STRICT; -- WITH (isstrict,iscachable);
-
 -- This is also available w/out GEOS 
 CREATEFUNCTION Centroid(geometry)
 	RETURNS geometry



More information about the postgis-commits mailing list