From: Sandro Santilli Date: Sat, 13 Aug 2011 09:02:54 +0000 (+0000) Subject: Drop unused code X-Git-Tag: 2.0.0alpha1~1104 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9041b174225dfb4dba51fb5136d40e4b6f628155;p=postgis Drop unused code git-svn-id: http://svn.osgeo.org/postgis/trunk@7743 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/lwgeom_geos_prepared.c b/postgis/lwgeom_geos_prepared.c index 620424238..84b5ad1d9 100644 --- a/postgis/lwgeom_geos_prepared.c +++ b/postgis/lwgeom_geos_prepared.c @@ -1,10 +1,10 @@ /********************************************************************** - * $Id$ * * PostGIS - Spatial Types for PostgreSQL * http://postgis.refractions.net - * Copyright 2007 Refractions Research Inc. - * Copyright 2008 Paul Ramsey + * + * Copyright (C) 2008 Paul Ramsey + * Copyright (C) 2007 Refractions Research Inc. * * This is free software; you can redistribute and/or modify it under * the terms of the GNU General Public Licence. See the COPYING file. @@ -452,233 +452,3 @@ GetPrepGeomCache(FunctionCallInfoData *fcinfo, PG_LWGEOM *pg_geom1, PG_LWGEOM *p } #endif /* PREPARED_GEOM */ - - -#if 0 -/* -** No longer directly called. Left as example for now. -** Functionality directly embedded in contains() -*/ -PG_FUNCTION_INFO_V1(containsPrepared); -Datum containsPrepared(PG_FUNCTION_ARGS) -{ -#ifndef PREPARED_GEOM - elog(ERROR,"Not implemented in this version!"); - PG_RETURN_NULL(); -#else - PG_LWGEOM * geom1; - PG_LWGEOM * geom2; - bool result; - BOX2DFLOAT4 box1, box2; - PrepGeomCache * prep_cache; - int32 key1; - - geom1 = (PG_LWGEOM *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0)); - geom2 = (PG_LWGEOM *) PG_DETOAST_DATUM(PG_GETARG_DATUM(1)); - key1 = PG_GETARG_INT32(2); - - errorIfGeometryCollection(geom1,geom2); - error_if_srid_mismatch(pglwgeom_get_srid(geom1), pglwgeom_get_srid(geom2)); - - POSTGIS_DEBUG(3, "containsPrepared: entered function"); - - /* - * short-circuit: if geom2 bounding box is not completely inside - * geom1 bounding box we can prematurely return FALSE. - * Do the test IFF BOUNDING BOX AVAILABLE. - */ - if ( pglwgeom_getbox2d_p(geom1, &box1) && - pglwgeom_getbox2d_p(geom2, &box2) ) - { - if (( box2.xmin < box1.xmin ) || ( box2.xmax > box1.xmax ) || - ( box2.ymin < box1.ymin ) || ( box2.ymax > box1.ymax )) - PG_RETURN_BOOL(FALSE); - } - - prep_cache = GetPrepGeomCache( fcinfo, geom1, 0 ); - - initGEOS(lwnotice, lwnotice); - - if ( prep_cache && prep_cache->prepared_geom && prep_cache->argnum == 1 ) - { - GEOSGeom g = POSTGIS2GEOS(geom2); - POSTGIS_DEBUG(4, "containsPrepared: cache is live, running preparedcontains"); - result = GEOSPreparedContains( prep_cache->prepared_geom, g); - GEOSGeom_destroy(g); - } - else - { - GEOSGeom g1 = POSTGIS2GEOS(geom1); - GEOSGeom g2 = POSTGIS2GEOS(geom2); - POSTGIS_DEBUG(4, "containsPrepared: cache is not ready, running standard contains"); - result = GEOSContains( g1, g2); - GEOSGeom_destroy(g1); - GEOSGeom_destroy(g2); - } - - if (result == 2) - { - elog(ERROR,"GEOS contains() threw an error!"); - PG_RETURN_NULL(); /* never get here */ - } - - PG_FREE_IF_COPY(geom1, 0); - PG_FREE_IF_COPY(geom2, 1); - - PG_RETURN_BOOL(result); -#endif /* PREPARED_GEOM */ -} - - -/* -** No longer directly called. Left as example for now. -** Functionality directly embedded in covers() -*/ -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 - PG_LWGEOM * geom1; - PG_LWGEOM * geom2; - bool result; - BOX2DFLOAT4 box1, box2; - PrepGeomCache * prep_cache; - int32 key1; - - geom1 = (PG_LWGEOM *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0)); - geom2 = (PG_LWGEOM *) PG_DETOAST_DATUM(PG_GETARG_DATUM(1)); - key1 = PG_GETARG_INT32(2); - - errorIfGeometryCollection(geom1,geom2); - error_if_srid_mismatch(pglwgeom_get_srid(geom1), pglwgeom_get_srid(geom2)); - - /* - * short-circuit: if geom2 bounding box is not completely inside - * geom1 bounding box we can prematurely return FALSE. - * Do the test IFF BOUNDING BOX AVAILABLE. - */ - if ( pglwgeom_getbox2d_p(geom1, &box1) && - pglwgeom_getbox2d_p(geom2, &box2) ) - { - if (( box2.xmin < box1.xmin ) || ( box2.xmax > box1.xmax ) || - ( box2.ymin < box1.ymin ) || ( box2.ymax > box1.ymax )) - PG_RETURN_BOOL(FALSE); - } - - prep_cache = GetPrepGeomCache( fcinfo, geom1, 0 ); - - initGEOS(lwnotice, lwnotice); - - if ( prep_cache && prep_cache->prepared_geom && prep_cache->argnum == 1 ) - { - GEOSGeom g = POSTGIS2GEOS(geom2); - result = GEOSPreparedCovers( prep_cache->prepared_geom, g); - GEOSGeom_destroy(g); - } - else - { - GEOSGeom g1 = POSTGIS2GEOS(geom1); - GEOSGeom g2 = POSTGIS2GEOS(geom2); - result = GEOSRelatePattern( g1, g2, "******FF*" ); - GEOSGeom_destroy(g1); - GEOSGeom_destroy(g2); - } - - if (result == 2) - { - elog(ERROR,"GEOS contains() threw an error!"); - PG_RETURN_NULL(); /* never get here */ - } - - PG_FREE_IF_COPY(geom1, 0); - PG_FREE_IF_COPY(geom2, 1); - - PG_RETURN_BOOL(result); -#endif /* PREPARED_GEOM */ -} - - -/* -** No longer directly called. Left as example for now. -** Functionality directly embedded in intersects() -*/ -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 - PG_LWGEOM * geom1; - PG_LWGEOM * geom2; - bool result; - BOX2DFLOAT4 box1, box2; - PrepGeomCache * prep_cache; - int32 key1, key2; - - geom1 = (PG_LWGEOM *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0)); - geom2 = (PG_LWGEOM *) PG_DETOAST_DATUM(PG_GETARG_DATUM(1)); - key1 = PG_GETARG_INT32(2); - key2 = PG_GETARG_INT32(3); - - errorIfGeometryCollection(geom1,geom2); - error_if_srid_mismatch(pglwgeom_get_srid(geom1), pglwgeom_get_srid(geom2)); - - /* - * short-circuit 1: if geom2 bounding box does not overlap - * geom1 bounding box we can prematurely return FALSE. - * Do the test IFF BOUNDING BOX AVAILABLE. - */ - if ( pglwgeom_getbox2d_p(geom1, &box1) && - pglwgeom_getbox2d_p(geom2, &box2) ) - { - if (( box2.xmax < box1.xmin ) || ( box2.xmin > box1.xmax ) || - ( box2.ymax < box1.ymin ) || ( box2.ymin > box1.ymax )) - PG_RETURN_BOOL(FALSE); - } - - prep_cache = GetPrepGeomCache( fcinfo, geom1, geom2 ); - - initGEOS(lwnotice, lwnotice); - - if ( prep_cache && prep_cache->prepared_geom ) - { - if ( prep_cache->argnum == 1 ) - { - GEOSGeom g = POSTGIS2GEOS(geom2); - result = GEOSPreparedIntersects( prep_cache->prepared_geom, g); - GEOSGeom_destroy(g); - } - else - { - GEOSGeom g = POSTGIS2GEOS(geom1); - result = GEOSPreparedIntersects( prep_cache->prepared_geom, g); - GEOSGeom_destroy(g); - } - } - else - { - GEOSGeom g1 = POSTGIS2GEOS(geom1); - GEOSGeom g2 = POSTGIS2GEOS(geom2); - result = GEOSIntersects( g1, g2); - GEOSGeom_destroy(g1); - GEOSGeom_destroy(g2); - } - - if (result == 2) - { - elog(ERROR,"GEOS contains() threw an error!"); - PG_RETURN_NULL(); /* never get here */ - } - - PG_FREE_IF_COPY(geom1, 0); - PG_FREE_IF_COPY(geom2, 1); - - PG_RETURN_BOOL(result); -#endif /* PREPARED_GEOM */ -} -#endif /* 0 */ -