Show
Ignore:
Timestamp:
03/09/09 11:40:23 (3 years ago)
Author:
pramsey
Message:

Fix for GBT#96.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/postgis/lwgeom_functions_basic.c

    r3814 r3817  
    14921492        PG_LWGEOM *geom = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0)); 
    14931493        PG_LWGEOM *result; 
    1494         LWGEOM *lwgeoms[1]; 
    14951494        LWGEOM *lwgeom; 
    1496         int type; 
    1497         int SRID=-1; 
    1498         BOX2DFLOAT4 *box; 
     1495        LWGEOM *ogeom; 
    14991496 
    15001497        POSTGIS_DEBUG(2, "LWGEOM_force_multi called"); 
    15011498 
    15021499        /* 
    1503          * This funx is a no-op only if a bbox cache is already present 
    1504          * in input. If bbox cache is not there we'll need to handle 
    1505          * automatic bbox addition FOR_COMPLEX_GEOMS. 
    1506          */ 
    1507         if ( lwgeom_contains_subgeoms(TYPE_GETTYPE(geom->type)) && 
    1508                         TYPE_HASBBOX(geom->type) ) 
     1500        ** This funx is a no-op only if a bbox cache is already present 
     1501        ** in input. If bbox cache is not there we'll need to handle 
     1502        ** automatic bbox addition FOR_COMPLEX_GEOMS. 
     1503        */ 
     1504        if ( lwgeom_contains_subgeoms(TYPE_GETTYPE(geom->type)) && TYPE_HASBBOX(geom->type) ) 
    15091505        { 
    15101506                PG_RETURN_POINTER(geom); 
    15111507        } 
     1508 
    15121509 
    15131510        /* deserialize into lwgeoms[0] */ 
    15141511        lwgeom = lwgeom_deserialize(SERIALIZED_FORM(geom)); 
    1515         type = TYPE_GETTYPE(lwgeom->type); 
    1516  
    1517         /* if it's a single POINT, LINESTRING or POLYGON geom, make it a multi */ 
    1518         if ( type == POINTTYPE || type == LINETYPE || type == POLYGONTYPE ) 
    1519         { 
    1520                 type += 3; 
    1521                 SRID = lwgeom->SRID; 
    1522                 /* We transfer bbox ownership from input to output */ 
    1523                 box = lwgeom->bbox; 
    1524                 lwgeom->SRID=-1; 
    1525                 lwgeom->bbox=NULL; 
    1526                 lwgeoms[0] = lwgeom; 
    1527  
    1528                 lwgeom = (LWGEOM *)lwcollection_construct(type, 
    1529                                 SRID, box, 1, lwgeoms); 
    1530         } 
    1531  
    1532  
    1533         result = pglwgeom_serialize(lwgeom); 
    1534         lwgeom_release(lwgeom); 
     1512        ogeom = lwgeom_as_multi(lwgeom); 
     1513                printf("ogeom %p\n",ogeom); 
     1514                printf("ogeom->type %d\n", ogeom->type); 
     1515 
     1516        result = pglwgeom_serialize(ogeom); 
    15351517 
    15361518        PG_FREE_IF_COPY(geom, 0);