]> granicus.if.org Git - postgis/commitdiff
Improve output of lwgeom_summary
authorSandro Santilli <strk@kbt.io>
Wed, 26 Jun 2019 08:04:14 +0000 (08:04 +0000)
committerSandro Santilli <strk@kbt.io>
Wed, 26 Jun 2019 08:04:14 +0000 (08:04 +0000)
- Do not print a useless newline
- Use plural/singular correctly
- Prepend a colon to elements listing

git-svn-id: http://svn.osgeo.org/postgis/trunk@17559 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/lwgeom_debug.c
regress/core/lwgeom_regress_expected
regress/core/summary_expected
regress/core/tickets_expected

index 0fb9bf7181ec3dfbe684ff4602260294a9b428a2..e3d7b3a6e4732914698b71aa538a77b73e30962d 100644 (file)
@@ -98,10 +98,13 @@ lwcollection_summary(LWCOLLECTION *col, int offset)
 
        result = (char *)lwalloc(size);
 
-       sprintf(result, "%*.s%s[%s] with %d elements\n",
+       sprintf(result, "%*.s%s[%s] with %d element%s",
                offset, pad, lwtype_name(col->type),
                zmflags,
-               col->ngeoms);
+               col->ngeoms,
+                                       col->ngeoms ?
+                                               ( col->ngeoms > 1 ? "s:\n" : ":\n")
+                                               : "s");
 
        for (i=0; i<col->ngeoms; i++)
        {
@@ -136,10 +139,13 @@ lwpoly_summary(LWPOLY *poly, int offset)
 
        result = (char *)lwalloc(size);
 
-       sprintf(result, "%*.s%s[%s] with %i rings\n",
+       sprintf(result, "%*.s%s[%s] with %i ring%s",
                offset, pad, lwtype_name(poly->type),
                zmflags,
-               poly->nrings);
+               poly->nrings,
+                                       poly->nrings ?
+                                               ( poly->nrings > 1 ? "s:\n" : ":\n")
+                                               : "s");
 
        for (i=0; i<poly->nrings; i++)
        {
index 17d0348cafea51e7596e75f328580b1de26b1133..696bbb0dacafd3d618ce4553442c08b360586d7f 100644 (file)
@@ -7,15 +7,15 @@ BOX3D(0 0.1 -55,11 12 12)
 11184
 #3069|Point[S]
 #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|MultiPoint[S] with 1 element:   Point[S]
+#3069|MultiLineString[S] with 1 element:   LineString[S] with 2 points
+#3069|Polygon[BS] with 1 ring:    ring 0 has 5 points
 #3069|BOX(1 1,1 1)
 #3069|BOX(0 0,1 1)
 #3069|BOX(0 0,1 1)
 #3069|BOX(1 1,1 1)
 #3069|BOX(0 0,1 1)
-#2902|GeometryCollection[ZBS] with 3 elements   Polygon[ZS] with 1 rings    ring 0 has 5 points   Point[ZS]   MultiLineString[ZS] with 1 elements     LineString[ZS] with 2 points
+#2902|GeometryCollection[ZBS] with 3 elements:   Polygon[ZS] with 1 ring:    ring 0 has 5 points   Point[ZS]   MultiLineString[ZS] with 1 element:     LineString[ZS] with 2 points
 BoundingDiagonal1|SRID=4326;LINESTRING(999999986991104 999999986991104,1e+15 1e+15)
 BoundingDiagonal2|SRID=4326;LINESTRING(1e+15 1e+15,1e+15 1e+15)
 BoundingDiagonal3|SRID=4326;LINESTRING(999999986991104 999999986991104,1e+15 1e+15)
index 005f29f4d93fb924599a98566472144822a8124c..595fbd56f0d927b649a87e1497203349f08ae647 100644 (file)
@@ -6,19 +6,19 @@ T1Z|Point[Z]
 T1ZM|Point[ZM]
 T1ZMB|Point[ZMB]
 T1ZMBS|Point[ZMBS]
-T3|MultiPoint[] with 1 elements
+T3|MultiPoint[] with 1 element:
   Point[]
-T4|MultiPoint[S] with 1 elements
+T4|MultiPoint[S] with 1 element:
   Point[S]
-T5|GeometryCollection[B] with 2 elements
-  MultiLineString[] with 2 elements
+T5|GeometryCollection[B] with 2 elements:
+  MultiLineString[] with 2 elements:
     LineString[] with 2 points
     LineString[] with 2 points
-  MultiPoint[] with 1 elements
+  MultiPoint[] with 1 element:
     Point[]
-T6|GeometryCollection[BS] with 2 elements
-  MultiLineString[S] with 2 elements
+T6|GeometryCollection[BS] with 2 elements:
+  MultiLineString[S] with 2 elements:
     LineString[S] with 2 points
     LineString[S] with 2 points
-  MultiPoint[S] with 1 elements
+  MultiPoint[S] with 1 element:
     Point[S]
index 4b723b90cbbe181a9967c1f6ff0b3823b4d75ef2..0c94a308c31ef086b82943a8d239fc710a29275d 100644 (file)
@@ -237,15 +237,15 @@ ERROR:  invalid GML representation
 #2145|6792004
 #2232|M 0 0 l 0 0 1 0 0 0 1 0 0 0
 #2307|MULTIPOLYGON(((-41.1932 -7.3257,-41.1616 -7.3257,-41.1569 -7.3257,-41.1569 -7.3483,-41.1932 -7.3483,-41.1932 -7.3257),(-41.1616 -7.3257,-41.1879 -7.3257,-41.1879 -7.3425,-41.1616 -7.3425,-41.1616 -7.3257)))
-#2409|GeometryCollection[B] with 2 elements
-  MultiSurface[] with 2 elements
-    Polygon[] with 1 rings
+#2409|GeometryCollection[B] with 2 elements:
+  MultiSurface[] with 2 elements:
+    Polygon[] with 1 ring:
    ring 0 has 5 points
-    CurvePolygon[] with 1 elements
-      CompoundCurve[] with 2 elements
+    CurvePolygon[] with 1 element:
+      CompoundCurve[] with 2 elements:
         LineString[] with 5 points
         CircularString[] with 5 points
-  Tin[] with 1 elements
+  Tin[] with 1 element:
     Triangle[] with 4 points
 #2415.1|MULTICURVE(COMPOUNDCURVE((0 0,10 0),CIRCULARSTRING(10 0,15 1,20 10)))
 #2415.2|MULTISURFACE(CURVEPOLYGON(CIRCULARSTRING(10 0,15 1,20 0,18 5,20 10,10 10,10 0)))