]> granicus.if.org Git - postgis/commitdiff
Fixed ExteriorRing() and Segmentize() handling of bbox cache
authorSandro Santilli <strk@keybit.net>
Mon, 28 Nov 2005 11:20:12 +0000 (11:20 +0000)
committerSandro Santilli <strk@keybit.net>
Mon, 28 Nov 2005 11:20:12 +0000 (11:20 +0000)
git-svn-id: http://svn.osgeo.org/postgis/branches/pgis_1_0@2080 b70326c6-7e19-0410-871a-916f4a2858ee

lwgeom/lwcollection.c
lwgeom/lwgeom_functions_basic.c
lwgeom/lwgeom_ogc.c
lwgeom/lwline.c
lwgeom/lwpoly.c

index edbab1ef5ff9c820484306e2d20e3cd00da8e0ae..ce8c4344bfa2e5b3cd9165bef8365891b2094830 100644 (file)
@@ -294,7 +294,7 @@ lwcollection_segmentize2d(LWCOLLECTION *col, double dist)
        for (i=0; i<col->ngeoms; i++)
                newgeoms[i] = lwgeom_segmentize2d(col->geoms[i], dist);
 
-       return lwcollection_construct(col->type, col->SRID, col->bbox,
+       return lwcollection_construct(col->type, col->SRID, NULL,
                col->ngeoms, newgeoms);
 }
 
index e628b4a672d59c8c94b238f9ee59acb918953072..9af9926c319f2e1d9221344c0d2b917dab556cf7 100644 (file)
@@ -2524,6 +2524,11 @@ Datum LWGEOM_segmentize2d(PG_FUNCTION_ARGS)
 
        inlwgeom = lwgeom_deserialize(SERIALIZED_FORM(ingeom));
        outlwgeom = lwgeom_segmentize2d(inlwgeom, dist);
+
+       // Copy input bounding box if any
+       if ( inlwgeom->bbox )
+               outlwgeom->bbox = box2d_clone(inlwgeom->bbox);
+
        outgeom = pglwgeom_serialize(outlwgeom);
 
        PG_FREE_IF_COPY(ingeom, 0);
index fd81232d709b671d7aa4f3d2d217719aab962f8d..b3cb5a8bbe1cbc6c1501d6b7972b2d60e9ddfade 100644 (file)
@@ -354,6 +354,7 @@ Datum LWGEOM_exteriorring_polygon(PG_FUNCTION_ARGS)
        POINTARRAY *extring;
        LWLINE *line;
        PG_LWGEOM *result;
+       BOX2DFLOAT4 *bbox=NULL;
 
        if ( TYPE_GETTYPE(geom->type) != POLYGONTYPE )
        {
@@ -368,7 +369,8 @@ Datum LWGEOM_exteriorring_polygon(PG_FUNCTION_ARGS)
        // This is a LWLINE constructed by exterior ring POINTARRAY
        // If the input geom has a bbox, use it for 
        // the output geom, as exterior ring makes it up !
-       line = lwline_construct(poly->SRID, poly->bbox, extring);
+       if ( poly->bbox ) bbox=box2d_clone(poly->bbox);
+       line = lwline_construct(poly->SRID, bbox, extring);
 
        result = pglwgeom_serialize((LWGEOM *)line);
 
index ed5cb9600eea87bd8f879b113a2a42f5174398e2..9c21124e0224767b97a1a2101b0d2d1aed42a13c 100644 (file)
@@ -366,7 +366,7 @@ lwline_reverse(LWLINE *line)
 LWLINE *
 lwline_segmentize2d(LWLINE *line, double dist)
 {
-       return lwline_construct(line->SRID, line->bbox,
+       return lwline_construct(line->SRID, NULL,
                ptarray_segmentize2d(line->points, dist));
 }
 
index 5d33be62088a06a238f8c50fc5e5f3910f0590ec..7b0ce73022d9181b3423c9aea4282dc30c5f12ac 100644 (file)
@@ -488,7 +488,7 @@ lwpoly_segmentize2d(LWPOLY *poly, double dist)
        {
                newrings[i] = ptarray_segmentize2d(poly->rings[i], dist);
        }
-       return lwpoly_construct(poly->SRID, poly->bbox,
+       return lwpoly_construct(poly->SRID, NULL,
                poly->nrings, newrings);
 }