From: Sandro Santilli Date: Wed, 5 Jan 2005 10:06:58 +0000 (+0000) Subject: Added AUTOCACHE_BBOX support in PG_LWGEOM_construct(). X-Git-Tag: pgis_1_0_0RC1~86 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=53425b62566b33f03fd6004804d7c1087ecfce43;p=postgis Added AUTOCACHE_BBOX support in PG_LWGEOM_construct(). git-svn-id: http://svn.osgeo.org/postgis/trunk@1218 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/lwgeom/BBOXCACHE_BEHAVIOURS b/lwgeom/BBOXCACHE_BEHAVIOURS index ae5192991..9b8bb7bd2 100644 --- a/lwgeom/BBOXCACHE_BEHAVIOURS +++ b/lwgeom/BBOXCACHE_BEHAVIOURS @@ -33,14 +33,15 @@ points where some BBOX caching strategies could be enforced). **SRL** Directly works on the serialized geometries, uses internal strategies to construct output. - *EXP* Uses deprecated LWEXPLODED, and LWEXPLODED_serialize() + *EXP* Uses LWGEOM_EXPLODED, and lwexploded_serialize() *LWG* Uses LWGEOM, pglwgeom_serialize() AUTOCACHE_BBOX is currently used by all functions using *LWG* -(pglwgeom_serialize entry point). Other functions explicitly -listed in the AUTOCACHE_BBOX section also use it. +(pglwgeom_serialize entry point) and *SRL* (PG_LWGEOM_construct +entry point). Other functions explicitly listed in the AUTOCACHE_BBOX +section also use it. [ explicit control ] diff --git a/lwgeom/lwgeom_api.c b/lwgeom/lwgeom_api.c index 41ca75648..f2083c379 100644 --- a/lwgeom/lwgeom_api.c +++ b/lwgeom/lwgeom_api.c @@ -1854,6 +1854,13 @@ PG_LWGEOM_construct(char *ser, int SRID, int wantbbox) BOX2DFLOAT4 box; PG_LWGEOM *result; + /* COMPUTE_BBOX FOR_COMPLEX_GEOMS */ + if ( is_worth_caching_pglwgeom_bbox(ser) ) + { + // if ( ! wantbbox ) elog(NOTICE, "PG_LWGEOM_construct forced wantbbox=1 due to rule FOR_COMPLEX_GEOMS"); + wantbbox=1; + } + size = lwgeom_size(ser); eptr = ser+size; // end of subgeom @@ -2166,8 +2173,11 @@ char * lwexploded_serialize(LWGEOM_EXPLODED *exploded, int wantbbox) { int sizecom = 0; - int size = lwexploded_findlength(exploded, wantbbox); - char *result = lwalloc(size); + int size; + char *result; + + size = lwexploded_findlength(exploded, wantbbox); + result = lwalloc(size); lwexploded_serialize_buf(exploded, wantbbox, result, &sizecom); #ifdef DEBUG lwnotice("lwexploded_serialize: findlength:%d, serialize_buf:%d", size, sizecom);