From f7b2eca19efd9c7afe33a306df465fdca0474742 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Mon, 28 Nov 2005 11:20:12 +0000 Subject: [PATCH] Fixed ExteriorRing() and Segmentize() handling of bbox cache git-svn-id: http://svn.osgeo.org/postgis/branches/pgis_1_0@2080 b70326c6-7e19-0410-871a-916f4a2858ee --- lwgeom/lwcollection.c | 2 +- lwgeom/lwgeom_functions_basic.c | 5 +++++ lwgeom/lwgeom_ogc.c | 4 +++- lwgeom/lwline.c | 2 +- lwgeom/lwpoly.c | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lwgeom/lwcollection.c b/lwgeom/lwcollection.c index edbab1ef5..ce8c4344b 100644 --- a/lwgeom/lwcollection.c +++ b/lwgeom/lwcollection.c @@ -294,7 +294,7 @@ lwcollection_segmentize2d(LWCOLLECTION *col, double dist) for (i=0; ingeoms; 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); } diff --git a/lwgeom/lwgeom_functions_basic.c b/lwgeom/lwgeom_functions_basic.c index e628b4a67..9af9926c3 100644 --- a/lwgeom/lwgeom_functions_basic.c +++ b/lwgeom/lwgeom_functions_basic.c @@ -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); diff --git a/lwgeom/lwgeom_ogc.c b/lwgeom/lwgeom_ogc.c index fd81232d7..b3cb5a8bb 100644 --- a/lwgeom/lwgeom_ogc.c +++ b/lwgeom/lwgeom_ogc.c @@ -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); diff --git a/lwgeom/lwline.c b/lwgeom/lwline.c index ed5cb9600..9c21124e0 100644 --- a/lwgeom/lwline.c +++ b/lwgeom/lwline.c @@ -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)); } diff --git a/lwgeom/lwpoly.c b/lwgeom/lwpoly.c index 5d33be620..7b0ce7302 100644 --- a/lwgeom/lwpoly.c +++ b/lwgeom/lwpoly.c @@ -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); } -- 2.40.0