]> granicus.if.org Git - postgis/commitdiff
Make serialization code more agressive about not adding boxes to small things
authorPaul Ramsey <pramsey@cleverelephant.ca>
Thu, 5 Mar 2015 19:30:40 +0000 (19:30 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Thu, 5 Mar 2015 19:30:40 +0000 (19:30 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@13315 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/lwgeom.c
regress/lwgeom_regress_expected
regress/summary_expected

index c2fc6ae41cfd20988302688abb7c23f6a6a41b9f..829b3c7e8a4b2f4d0c45a3ce3be7f5183fa7a978 100644 (file)
@@ -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;
+       }
 }
 
 /**
index fd19fcf12ef01e8f9875c17660e732d0de064c60..c4bdcf4afd7d544b13d76eb44e6700d5df50a878 100644 (file)
@@ -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)
index 7c2f7936a21f9e50ae20619b0eea615a122b5c03..005f29f4d93fb924599a98566472144822a8124c 100644 (file)
@@ -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