]> granicus.if.org Git - postgis/commitdiff
Remove the WKB_CONVERSION hack which was invented to try and make the JTS connector...
authorMark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
Mon, 22 Dec 2008 11:51:53 +0000 (11:51 +0000)
committerMark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
Mon, 22 Dec 2008 11:51:53 +0000 (11:51 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@3461 b70326c6-7e19-0410-871a-916f4a2858ee

lwgeom/lwgeom_geos.c

index 957f36cfbb9e5e55017c1d0305b6ce216f197041..e585babc629b0138534e310a9e343bbde29ecdd0 100644 (file)
@@ -2399,70 +2399,11 @@ Datum isring(PG_FUNCTION_ARGS)
 /*
 **  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.
 **
 */
 
-#ifdef WKB_CONVERSION
-
-/* Return an LWGEOM from a GEOSGeom */
-LWGEOM *
-GEOS2LWGEOM(GEOSGeom geom, char want3d)
-{
-       size_t size;
-       char *wkb;
-       LWGEOM *lwgeom;
-
-       if ( want3d ) GEOS_setWKBOutputDims(3);
-       else GEOS_setWKBOutputDims(2);
-
-       wkb = GEOSGeomToWKB_buf(geom, &size);
-       lwgeom = lwgeom_from_ewkb(wkb, flags, size);
-
-       return lwgeom;
-}
-
-PG_LWGEOM *
-GEOS2POSTGIS(GEOSGeom geom, char want3d)
-{
-       size_t size;
-       char *wkb;
-       PG_LWGEOM *pglwgeom, *ret;
-
-       if ( want3d ) GEOS_setWKBOutputDims(3);
-       else GEOS_setWKBOutputDims(2);
-
-       wkb = GEOSGeomToWKB_buf(geom, &size);
-       if ( ! wkb )
-       {
-               lwerror("GEOS failed to export WKB");
-       }
-       pglwgeom = pglwgeom_from_ewkb(wkb, size);
-       if ( ! pglwgeom )
-       {
-               lwerror("GEOS2POSTGIS: lwgeom_from_ewkb returned NULL");
-       }
-
-       if ( is_worth_caching_pglwgeom_bbox(pglwgeom) )
-       {
-               ret = (PG_LWGEOM *)DatumGetPointer(DirectFunctionCall1(
-                                                          LWGEOM_addBBOX, PointerGetDatum(pglwgeom)));
-               lwfree(pglwgeom);
-       }
-       else
-       {
-               ret = pglwgeom;
-       }
-
-       return ret;
-}
-
-#else /* !ndef WKB_CONVERSION */
-
 /* Return a POINTARRAY from a GEOSCoordSeq */
 POINTARRAY *
 ptarray_from_GEOSCoordSeq(GEOSCoordSeq cs, char want3d)
@@ -2627,56 +2568,8 @@ GEOS2POSTGIS(GEOSGeom geom, char want3d)
        return result;
 }
 
-#endif /* def WKB_CONVERSION */
-
 /*-----=POSTGIS2GEOS= */
 
-
-#ifdef WKB_CONVERSION
-
-GEOSGeom LWGEOM2GEOS(LWGEOM *);
-
-GEOSGeom
-LWGEOM2GEOS(LWGEOM *lwgeom)
-{
-       size_t size;
-       char *wkb;
-       GEOSGeom geom;
-
-       wkb = lwgeom_to_ewkb(lwgeom, getMachineEndian(), &size);
-       geom = GEOSGeomFromWKB_buf(wkb, size);
-       return geom;
-}
-
-GEOSGeom
-POSTGIS2GEOS(PG_LWGEOM *pglwgeom)
-{
-       size_t size;
-       char *wkb;
-       GEOSGeom geom;
-
-       wkb = pglwgeom_to_ewkb(pglwgeom, getMachineEndian(), &size);
-       if ( ! wkb )
-       {
-               lwerror("Postgis failed to export EWKB %s:%d", __FILE__, __LINE__);
-       }
-       geom = GEOSGeomFromWKB_buf(wkb, size);
-       lwfree(wkb);
-       if ( ! geom )
-       {
-               lwerror("POSTGIS2GEOS conversion failed");
-       }
-
-#if POSTGIS_DEBUG_LEVEL >= 4
-       wkb = GEOSGeomToWKT(geom);
-       POSTGIS_DEBUGF(4, "GEOS geom: %s", wkb);
-#endif
-
-       return geom;
-}
-
-#else /* ndef WKB_CONVERSION */
-
 GEOSCoordSeq ptarray_to_GEOSCoordSeq(POINTARRAY *);
 GEOSGeom LWGEOM2GEOS(LWGEOM *lwgeom);
 
@@ -2842,7 +2735,6 @@ POSTGIS2GEOS(PG_LWGEOM *pglwgeom)
        return ret;
 }
 
-#endif /* WKB_CONVERSION */
 
 PG_FUNCTION_INFO_V1(GEOSnoop);
 Datum GEOSnoop(PG_FUNCTION_ARGS)