From: Paul Ramsey Date: Thu, 5 Mar 2015 19:30:40 +0000 (+0000) Subject: Make serialization code more agressive about not adding boxes to small things X-Git-Tag: 2.2.0rc1~614 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=53f487070d9bcdafc816ea2c92507b42d9e8059e;p=postgis Make serialization code more agressive about not adding boxes to small things git-svn-id: http://svn.osgeo.org/postgis/trunk@13315 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/lwgeom.c b/liblwgeom/lwgeom.c index c2fc6ae41..829b3c7e8 100644 --- a/liblwgeom/lwgeom.c +++ b/liblwgeom/lwgeom.c @@ -1107,7 +1107,31 @@ int lwgeom_needs_bbox(const LWGEOM *geom) { return LW_FALSE; } - return LW_TRUE; + else if ( geom->type == LINETYPE ) + { + if ( lwgeom_count_vertices(geom) <= 2 ) + return LW_FALSE; + else + return LW_TRUE; + } + else if ( geom->type == MULTIPOINTTYPE ) + { + if ( ((LWCOLLECTION*)geom)->ngeoms == 1 ) + return LW_FALSE; + else + return LW_TRUE; + } + else if ( geom->type == MULTILINETYPE ) + { + if ( ((LWCOLLECTION*)geom)->ngeoms == 1 && lwgeom_count_vertices(geom) <= 2 ) + return LW_FALSE; + else + return LW_TRUE; + } + else + { + return LW_TRUE; + } } /** diff --git a/regress/lwgeom_regress_expected b/regress/lwgeom_regress_expected index fd19fcf12..c4bdcf4af 100644 --- a/regress/lwgeom_regress_expected +++ b/regress/lwgeom_regress_expected @@ -6,9 +6,9 @@ BOX3D(0 0.1 -55,11 12 12) 15824 11184 #3069|Point[S] -#3069|LineString[BS] with 2 points -#3069|MultiPoint[BS] with 1 elements Point[S] -#3069|MultiLineString[BS] with 1 elements LineString[S] with 2 points +#3069|LineString[S] with 2 points +#3069|MultiPoint[S] with 1 elements Point[S] +#3069|MultiLineString[S] with 1 elements LineString[S] with 2 points #3069|Polygon[BS] with 1 rings ring 0 has 5 points #3069|BOX(1 1,1 1) #3069|BOX(0 0,1 1) diff --git a/regress/summary_expected b/regress/summary_expected index 7c2f7936a..005f29f4d 100644 --- a/regress/summary_expected +++ b/regress/summary_expected @@ -6,9 +6,9 @@ T1Z|Point[Z] T1ZM|Point[ZM] T1ZMB|Point[ZMB] T1ZMBS|Point[ZMBS] -T3|MultiPoint[B] with 1 elements +T3|MultiPoint[] with 1 elements Point[] -T4|MultiPoint[BS] with 1 elements +T4|MultiPoint[S] with 1 elements Point[S] T5|GeometryCollection[B] with 2 elements MultiLineString[] with 2 elements