From: Sandro Santilli Date: Mon, 28 Mar 2005 09:47:57 +0000 (+0000) Subject: Fixed bug in multi() leaving SRID in inner geometries. X-Git-Tag: pgis_1_0_0RC6~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2a5299d2e0a3cf7270fb8556d62b27d83919720b;p=postgis Fixed bug in multi() leaving SRID in inner geometries. Added early return for already multi() and BBOX'ed geoms. git-svn-id: http://svn.osgeo.org/postgis/trunk@1576 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/CHANGES b/CHANGES index d7d323ae0..35265d332 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +PostGIS 1.0.0 +?????? + - BUGFIX dumper 64bit + PostGIS 1.0.0RC5 2005/03/25 - small build scripts refinements diff --git a/lwgeom/lwgeom_functions_basic.c b/lwgeom/lwgeom_functions_basic.c index b0a83a0e9..7a964fc19 100644 --- a/lwgeom/lwgeom_functions_basic.c +++ b/lwgeom/lwgeom_functions_basic.c @@ -1358,6 +1358,19 @@ Datum LWGEOM_force_multi(PG_FUNCTION_ARGS) LWGEOM *lwgeoms[1]; LWGEOM *lwgeom; int type; + int SRID=-1; + BOX2DFLOAT4 *box; + + /* + * This funx is a no-op only if a bbox cache is already present + * in input. If bbox cache is not there we'll need to handle + * automatic bbox addition FOR_COMPLEX_GEOMS. + */ + if ( TYPE_GETTYPE(geom->type) >= MULTIPOINTTYPE && + TYPE_HASBBOX(geom->type) ) + { + PG_RETURN_POINTER(geom); + } // deserialize into lwgeoms[0] lwgeom = lwgeom_deserialize(SERIALIZED_FORM(geom)); @@ -1367,10 +1380,14 @@ Datum LWGEOM_force_multi(PG_FUNCTION_ARGS) if ( type < MULTIPOINTTYPE ) { type += 3; + SRID = lwgeom->SRID; + box = lwgeom->bbox; + lwgeom->SRID=-1; + lwgeom->bbox=NULL; lwgeoms[0] = lwgeom; + lwgeom = (LWGEOM *)lwcollection_construct(type, - lwgeom->SRID, lwgeom->bbox, 1, - lwgeoms); + SRID, box, 1, lwgeoms); }