Synchronize coordinate output functins.
authorDarafei Praliaskouski <me@komzpa.net>
Sun, 14 Jan 2018 16:56:14 +0000 (16:56 +0000)
committerDarafei Praliaskouski <me@komzpa.net>
Sun, 14 Jan 2018 16:56:14 +0000 (16:56 +0000)
Closes #3987
Closes https://github.com/postgis/postgis/pull/190

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

21 files changed:
doc/html/image_src/generator.c
liblwgeom/cunit/cu_measures.c
liblwgeom/cunit/cu_out_geojson.c
liblwgeom/cunit/cu_out_x3d.c
liblwgeom/cunit/cu_ptarray.c
liblwgeom/liblwgeom_internal.h
liblwgeom/lwout_geojson.c
liblwgeom/lwout_gml.c
liblwgeom/lwout_svg.c
liblwgeom/lwout_wkt.c
liblwgeom/lwout_x3d.c
liblwgeom/lwprint.c
liblwgeom/lwutil.c
regress/lwgeom_regress_expected
regress/regress_expected
regress/regress_sfcgal_expected
regress/sfcgal/README
regress/sfcgal/regress_expected
regress/sfcgal/regress_ogc_expected
regress/sfcgal/tickets_expected
regress/tickets_expected

index 33c8bd3d3e7dd315c6eae90403c98ad4f57d8c6b..b92ac54d5baa5a19ffeb8f8e3b4d1a4eade6cccb 100644 (file)
@@ -35,7 +35,7 @@
 #include <sys/wait.h> /* for WEXITSTATUS */
 
 #include "liblwgeom.h"
-#include "liblwgeom_internal.h" /* for trim_trailing_zeros */
+#include "liblwgeom_internal.h"
 #include "lwgeom_log.h"
 #include "styles.h"
 
@@ -46,7 +46,6 @@
 // Some global styling variables
 char *imageSize = "200x200";
 
-
 int getStyleName(char **styleName, char* line);
 
 static void
@@ -70,8 +69,8 @@ checked_system(const char* cmd)
 static size_t
 pointarrayToString(char *output, POINTARRAY *pa)
 {
-       char x[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1];
-       char y[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1];
+       char x[OUT_DOUBLE_BUFFER_SIZE];
+       char y[OUT_DOUBLE_BUFFER_SIZE];
        int i;
        char *ptr = output;
 
@@ -79,10 +78,10 @@ pointarrayToString(char *output, POINTARRAY *pa)
        {
                POINT2D pt;
                getPoint2d_p(pa, i, &pt);
-               sprintf(x, "%f", pt.x);
-               trim_trailing_zeros(x);
-               sprintf(y, "%f", pt.y);
-               trim_trailing_zeros(y);
+
+               lwprint_double(pt.x, 10, x, OUT_DOUBLE_BUFFER_SIZE);
+               lwprint_double(pt.y, 10, y, OUT_DOUBLE_BUFFER_SIZE);
+
                if ( i ) ptr += sprintf(ptr, " ");
                ptr += sprintf(ptr, "%s,%s", x, y);
        }
@@ -102,9 +101,9 @@ pointarrayToString(char *output, POINTARRAY *pa)
 static size_t
 drawPoint(char *output, LWPOINT *lwp, LAYERSTYLE *styles)
 {
-       char x[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1];
-       char y1[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1];
-       char y2[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1];
+       char x[OUT_DOUBLE_BUFFER_SIZE];
+       char y1[OUT_DOUBLE_BUFFER_SIZE];
+       char y2[OUT_DOUBLE_BUFFER_SIZE];
        char *ptr = output;
        POINTARRAY *pa = lwp->point;
        POINT2D p;
@@ -113,12 +112,9 @@ drawPoint(char *output, LWPOINT *lwp, LAYERSTYLE *styles)
        LWDEBUGF(4, "%s", "drawPoint called");
        LWDEBUGF( 4, "point = %s", lwgeom_to_ewkt((LWGEOM*)lwp) );
 
-       sprintf(x, "%f", p.x);
-       trim_trailing_zeros(x);
-       sprintf(y1, "%f", p.y);
-       trim_trailing_zeros(y1);
-       sprintf(y2, "%f", p.y + styles->pointSize);
-       trim_trailing_zeros(y2);
+       lwprint_double(p.x, 10, x, OUT_DOUBLE_BUFFER_SIZE);
+       lwprint_double(p.y, 10, y1, OUT_DOUBLE_BUFFER_SIZE);
+       lwprint_double(p.y + styles->pointSize, 10, y1, OUT_DOUBLE_BUFFER_SIZE);
 
        ptr += sprintf(ptr, "-fill %s -strokewidth 0 ", styles->pointColor);
        ptr += sprintf(ptr, "-draw \"circle %s,%s %s,%s", x, y1, x, y2);
index 2bb2798ddc8cd2d7c5ca325de258ac7d5994b747..2cec0b2650a9c3acd68d7b7b6979f1d53f280903 100644 (file)
@@ -406,7 +406,7 @@ test_lwgeom_segmentize2d(void)
        LWGEOM *linein = lwgeom_from_wkt("LINESTRING(0 0,10 0)", LW_PARSER_CHECK_NONE);
        LWGEOM *lineout = lwgeom_segmentize2d(linein, 5);
        char *strout = lwgeom_to_ewkt(lineout);
-       CU_ASSERT_STRING_EQUAL(strout, "LINESTRING(0 0,5 0,10 0)");
+       ASSERT_STRING_EQUAL(strout, "LINESTRING(0 0,5 0,10 0)");
        lwfree(strout);
        lwgeom_free(linein);
        lwgeom_free(lineout);
@@ -446,7 +446,7 @@ test_lwgeom_segmentize2d(void)
        /* NOT INTERRUPTED */
        lineout = lwgeom_segmentize2d(linein, 5);
        strout = lwgeom_to_ewkt(lineout);
-       CU_ASSERT_STRING_EQUAL(strout, "LINESTRING(20 0,25 0,30 0)");
+       ASSERT_STRING_EQUAL(strout, "LINESTRING(20 0,25 0,30 0)");
        lwfree(strout);
        lwgeom_free(linein);
        lwgeom_free(lineout);
@@ -463,19 +463,19 @@ test_lwgeom_locate_along(void)
        /* ST_Locatealong(ST_GeomFromText('MULTILINESTRING M ((1 2 3, 5 4 5), (50 50 1, 60 60 200))'), 105) */
        geom = lwgeom_from_wkt("MULTILINESTRING M ((1 2 3, 5 4 5), (50 50 1, 60 60 200))", LW_PARSER_CHECK_NONE);
        out = lwgeom_locate_along(geom, measure, 0.0);
-       str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
+       str = lwgeom_to_wkt(out, WKT_ISO, 6, NULL);
        lwgeom_free(geom);
        lwgeom_free(out);
-       CU_ASSERT_STRING_EQUAL("MULTIPOINT M (55.226131 55.226131 105)", str);
+       ASSERT_STRING_EQUAL(str, "MULTIPOINT M (55.226131 55.226131 105)");
        lwfree(str);
 
        /* ST_Locatealong(ST_GeomFromText('MULTILINESTRING M ((1 2 3, 5 4 5), (50 50 1, 60 60 200))'), 105) */
        geom = lwgeom_from_wkt("MULTILINESTRING M ((1 2 3, 3 4 2, 9 4 3), (1 2 3, 5 4 5), (50 50 1, 60 60 200))", LW_PARSER_CHECK_NONE);
        out = lwgeom_locate_along(geom, measure, 0.0);
-       str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
+       str = lwgeom_to_wkt(out, WKT_ISO, 6, NULL);
        lwgeom_free(geom);
        lwgeom_free(out);
-       CU_ASSERT_STRING_EQUAL("MULTIPOINT M (55.226131 55.226131 105)", str);
+       ASSERT_STRING_EQUAL(str, "MULTIPOINT M (55.226131 55.226131 105)");
        lwfree(str);
 }
 
@@ -959,7 +959,9 @@ test_lw_dist2d_ptarray_ptarrayarc(void)
        rv = lw_dist2d_ptarray_ptarrayarc(lwline1->points, lwline2->points, &dl);
        //printf("%s\n", cu_error_msg);
        CU_ASSERT_EQUAL( rv, LW_FAILURE );
-       CU_ASSERT_STRING_EQUAL("lw_dist2d_ptarray_ptarrayarc called with non-arc input", cu_error_msg);
+       ASSERT_STRING_EQUAL(
+           cu_error_msg,
+           "lw_dist2d_ptarray_ptarrayarc called with non-arc input");
 
        lwline_free(lwline2);
 
@@ -997,10 +999,9 @@ test_lwgeom_tcpa(void)
        lwgeom_free(g1);
        lwgeom_free(g2);
        ASSERT_DOUBLE_EQUAL(m, -1.0);
-       CU_ASSERT_STRING_EQUAL(
-         "Both input geometries must have a measure dimension",
-         cu_error_msg
-         );
+       ASSERT_STRING_EQUAL(
+           cu_error_msg,
+           "Both input geometries must have a measure dimension");
 
        /* Invalid input, not linestrings */
 
@@ -1010,10 +1011,8 @@ test_lwgeom_tcpa(void)
        lwgeom_free(g1);
        lwgeom_free(g2);
        ASSERT_DOUBLE_EQUAL(m, -1.0);
-       CU_ASSERT_STRING_EQUAL(
-         "Both input geometries must be linestrings",
-         cu_error_msg
-       );
+       ASSERT_STRING_EQUAL(cu_error_msg,
+                           "Both input geometries must be linestrings");
 
        /* Invalid input, too short linestring */
 
@@ -1025,9 +1024,11 @@ test_lwgeom_tcpa(void)
        lwgeom_free(g2);
        ASSERT_DOUBLE_EQUAL(dist, -77.0); /* not touched */
        ASSERT_DOUBLE_EQUAL(m, -1.0);
-       CU_ASSERT_STRING_EQUAL(
-         "Both input lines must have at least 2 points", /* should be accepted ? */
-         cu_error_msg
+       ASSERT_STRING_EQUAL(
+           cu_error_msg,
+           "Both input lines must have at least 2 points" /* should be accepted
+                                                             ? */
+
        );
 
        /* Invalid input, empty linestring */
@@ -1038,9 +1039,9 @@ test_lwgeom_tcpa(void)
        lwgeom_free(g1);
        lwgeom_free(g2);
        ASSERT_DOUBLE_EQUAL(m, -1.0);
-       CU_ASSERT_STRING_EQUAL(
-         "Both input lines must have at least 2 points",
-         cu_error_msg
+       ASSERT_STRING_EQUAL(cu_error_msg,
+                           "Both input lines must have at least 2 points"
+
        );
 
        /* Timeranges do not overlap */
index 3f955783ddbd7a1a5ca5f89c3441074b9a182f2e..4bdfbe2f3d8457388cd084ba3e8e020a5938c9bc 100644 (file)
@@ -99,11 +99,11 @@ static void out_geojson_test_precision(void)
    *       only zeroes will be returned
    * See http://trac.osgeo.org/postgis/ticket/2051#comment:11
    */
-       do_geojson_test(
-           "POINT(1E-300 -2E-200)",
-           "{\"type\":\"Point\",\"coordinates\":[0,-0]}",
-           NULL, 300, 0);
-
+       do_geojson_test("POINT(1E-300 -2E-200)",
+                       "{\"type\":\"Point\",\"coordinates\":[0,0]}",
+                       NULL,
+                       300,
+                       0);
 }
 
 
index cd72eb9db8320946fb0075608b12ca1f302e34ff..a424e2b5d87b15eaaf5b290d147b7cee437f840f 100644 (file)
@@ -77,9 +77,7 @@ static void out_x3d3_test_precision(void)
 
        /* huge data */
        do_x3d3_test(
-           "POINT(1E300 -105E-153 4E300)'",
-           "1e+300 -0 4e+300",
-           NULL, 0, 0);
+           "POINT(1E300 -105E-153 4E300)'", "1e+300 0 4e+300", NULL, 0, 0);
 }
 
 
@@ -175,8 +173,6 @@ static void out_x3d3_test_option(void)
            "SRID=4326;POLYGON((15 10 3,13.536 6.464 3,10 5 3,6.464 6.464 3,5 10 3,6.464 13.536 3,10 15 3,13.536 13.536 3,15 10 3))",
            "<IndexedFaceSet  convex='false' coordIndex='0 1 2 3 4 5 6 7'><GeoCoordinate geoSystem='\"GD\" \"WE\" \"latitude_first\"' point='10 15 3 6.464 13.536 3 5 10 3 6.464 6.464 3 10 5 3 13.536 6.464 3 15 10 3 13.536 13.536 3 ' /></IndexedFaceSet>",
            NULL, 3, 3);
-
-
 }
 
 
index 963ee4ab52c6b01ada0a81f787656d9b96e84417..3bb6ffc9b6f9b19b74c10c14c6eced7027f32852 100644 (file)
@@ -340,8 +340,6 @@ static void test_ptarray_signed_area()
 
 }
 
-
-
 static void test_ptarray_unstroke()
 {
        LWGEOM *in, *out;
@@ -391,7 +389,11 @@ static void test_ptarray_unstroke()
        out = lwgeom_unstroke(in);
        str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
        // printf("%s\n", str);
-       ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE((-3 -3,-1 0),CIRCULARSTRING(-1 0,0.70710678 0.70710678,0 -1),(0 -1,0 -1.5,0 -2),CIRCULARSTRING(0 -2,-0.70710678 -3.7071068,1 -3),(1 -3,5 5))");
+       ASSERT_STRING_EQUAL(
+           str,
+           "COMPOUNDCURVE((-3 -3,-1 0),CIRCULARSTRING(-1 0,0.70710678 "
+           "0.70710678,0 -1),(0 -1,0 -1.5,0 -2),CIRCULARSTRING(0 "
+           "-2,-0.70710678 -3.70710678,1 -3),(1 -3,5 5))");
        lwgeom_free(in);
        lwgeom_free(out);
        lwfree(str);
@@ -403,7 +405,10 @@ static void test_ptarray_unstroke()
        out = lwgeom_unstroke(in);
        str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
        // printf("%s\n", str);
-       ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE(CIRCULARSTRING(-1 0,0.70710678 0.70710678,0 -1),CIRCULARSTRING(0 -1,-0.70710678 -2.7071068,1 -2))");
+       ASSERT_STRING_EQUAL(
+           str,
+           "COMPOUNDCURVE(CIRCULARSTRING(-1 0,0.70710678 0.70710678,0 "
+           "-1),CIRCULARSTRING(0 -1,-0.70710678 -2.70710678,1 -2))");
        lwgeom_free(in);
        lwgeom_free(out);
        lwfree(str);
@@ -720,14 +725,14 @@ static void test_ptarray_scale()
   lwfree(wktout);
 
   factor.x = 1; factor.y = 1; factor.z = -2;
-  wkt = "LINESTRING ZM (0 3 -4 3,2 6 -6 0,-4 -9 -0 -1,-6 0 2 -2)";
+  wkt = "LINESTRING ZM (0 3 -4 3,2 6 -6 0,-4 -9 0 -1,-6 0 2 -2)";
   ptarray_scale(pa, &factor);
   wktout = lwgeom_to_text(lwline_as_lwgeom(line));
   ASSERT_STRING_EQUAL(wktout, wkt);
   lwfree(wktout);
 
   factor.x = 1; factor.y = 1; factor.z = 1; factor.m = 2;
-  wkt = "LINESTRING ZM (0 3 -4 6,2 6 -6 0,-4 -9 -0 -2,-6 0 2 -4)";
+  wkt = "LINESTRING ZM (0 3 -4 6,2 6 -6 0,-4 -9 0 -2,-6 0 2 -4)";
   ptarray_scale(pa, &factor);
   wktout = lwgeom_to_text(lwline_as_lwgeom(line));
   ASSERT_STRING_EQUAL(wktout, wkt);
index 86453f7f2bf95eab575e9698be913735ae14d691..e5184d3c787be0a811a7e130d0b3fce2f9045e94 100644 (file)
 #define OUT_SHOW_DIGS_DOUBLE 20
 #define OUT_MAX_DOUBLE_PRECISION 15
 #define OUT_MAX_DIGS_DOUBLE (OUT_SHOW_DIGS_DOUBLE + 2) /* +2 mean add dot and sign */
-
+#define OUT_DOUBLE_BUFFER_SIZE \
+       OUT_MAX_DIGS_DOUBLE + OUT_MAX_DOUBLE_PRECISION + 1
 
 /**
 * Constants for point-in-polygon return values
@@ -480,8 +481,7 @@ double gbox_angular_width(const GBOX* gbox);
 int gbox_centroid(const GBOX* gbox, POINT2D* out);
 
 /* Utilities */
-void trim_trailing_zeros(char *num);
-
+int lwprint_double(double d, int maxdd, char* buf, size_t bufsize);
 extern uint8_t MULTITYPE[NUMTYPES];
 
 extern lwinterrupt_callback *_lwgeom_interrupt_callback;
index b99d4006204042a526f28292c14558386e59dd2d..90a23787b24129eea976c5dc17412b46c2476254 100644 (file)
@@ -676,61 +676,19 @@ asgeojson_geom_buf(const LWGEOM *geom, char *output, GBOX *bbox, int precision)
        return (ptr-output);
 }
 
-/*
- * Print an ordinate value using at most the given number of decimal digits
- *
- * The actual number of printed decimal digits may be less than the
- * requested ones if out of significant digits.
- *
- * The function will not write more than maxsize bytes, including the
- * terminating NULL. Returns the number of bytes that would have been
- * written if there was enough space (excluding terminating NULL).
- * So a return of ``bufsize'' or more means that the string was
- * truncated and misses a terminating NULL.
- *
- * TODO: export ?
- *
- */
-static int
-lwprint_double(double d, int maxdd, char *buf, size_t bufsize)
-{
-  double ad = fabs(d);
-  int ndd = ad < 1 ? 0 : floor(log10(ad))+1; /* non-decimal digits */
-  if (fabs(d) < OUT_MAX_DOUBLE)
-  {
-    if ( maxdd > (OUT_MAX_DOUBLE_PRECISION - ndd) )  maxdd -= ndd;
-    return snprintf(buf, bufsize, "%.*f", maxdd, d);
-  }
-  else
-  {
-    return snprintf(buf, bufsize, "%g", d);
-  }
-}
-
-
-
 static size_t
 pointArray_to_geojson(POINTARRAY *pa, char *output, int precision)
 {
        uint32_t i;
        char *ptr;
-#define BUFSIZE OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION
-       char x[BUFSIZE+1];
-       char y[BUFSIZE+1];
-       char z[BUFSIZE+1];
+       char x[OUT_DOUBLE_BUFFER_SIZE];
+       char y[OUT_DOUBLE_BUFFER_SIZE];
+       char z[OUT_DOUBLE_BUFFER_SIZE];
 
        assert ( precision <= OUT_MAX_DOUBLE_PRECISION );
-
-  /* Ensure a terminating NULL at the end of buffers
-   * so that we don't need to check for truncation
-   * inprint_double */
-  x[BUFSIZE] = '\0';
-  y[BUFSIZE] = '\0';
-  z[BUFSIZE] = '\0';
-
        ptr = output;
 
-  /* TODO: rewrite this loop to be simpler and possibly quicker */
+       /* TODO: rewrite this loop to be simpler and possibly quicker */
        if (!FLAGS_GET_Z(pa->flags))
        {
                for (i=0; i<pa->npoints; i++)
@@ -738,10 +696,10 @@ pointArray_to_geojson(POINTARRAY *pa, char *output, int precision)
                        const POINT2D *pt;
                        pt = getPoint2d_cp(pa, i);
 
-                       lwprint_double(pt->x, precision, x, BUFSIZE);
-                       trim_trailing_zeros(x);
-                       lwprint_double(pt->y, precision, y, BUFSIZE);
-                       trim_trailing_zeros(y);
+                       lwprint_double(
+                           pt->x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+                       lwprint_double(
+                           pt->y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
 
                        if ( i ) ptr += sprintf(ptr, ",");
                        ptr += sprintf(ptr, "[%s,%s]", x, y);
@@ -754,12 +712,12 @@ pointArray_to_geojson(POINTARRAY *pa, char *output, int precision)
                        const POINT3DZ *pt;
                        pt = getPoint3dz_cp(pa, i);
 
-                       lwprint_double(pt->x, precision, x, BUFSIZE);
-                       trim_trailing_zeros(x);
-                       lwprint_double(pt->y, precision, y, BUFSIZE);
-                       trim_trailing_zeros(y);
-                       lwprint_double(pt->z, precision, z, BUFSIZE);
-                       trim_trailing_zeros(z);
+                       lwprint_double(
+                           pt->x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+                       lwprint_double(
+                           pt->y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
+                       lwprint_double(
+                           pt->z, precision, z, OUT_DOUBLE_BUFFER_SIZE);
 
                        if ( i ) ptr += sprintf(ptr, ",");
                        ptr += sprintf(ptr, "[%s,%s,%s]", x, y, z);
@@ -769,8 +727,6 @@ pointArray_to_geojson(POINTARRAY *pa, char *output, int precision)
        return (ptr-output);
 }
 
-
-
 /**
  * Returns maximum size of rendered pointarray in bytes.
  */
index a2b58c043f381777b42a8b993006c087ef86a64c..f738f4dd887ed651c50fe2c8e136c402e0720092 100644 (file)
@@ -663,9 +663,9 @@ pointArray_toGML2(POINTARRAY *pa, char *output, int precision)
 {
        uint32_t i;
        char *ptr;
-       char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-       char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-       char z[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+       char x[OUT_DOUBLE_BUFFER_SIZE];
+       char y[OUT_DOUBLE_BUFFER_SIZE];
+       char z[OUT_DOUBLE_BUFFER_SIZE];
 
        ptr = output;
 
@@ -676,17 +676,10 @@ pointArray_toGML2(POINTARRAY *pa, char *output, int precision)
                        const POINT2D *pt;
                        pt = getPoint2d_cp(pa, i);
 
-                       if (fabs(pt->x) < OUT_MAX_DOUBLE)
-                               sprintf(x, "%.*f", precision, pt->x);
-                       else
-                               sprintf(x, "%g", pt->x);
-                       trim_trailing_zeros(x);
-
-                       if (fabs(pt->y) < OUT_MAX_DOUBLE)
-                               sprintf(y, "%.*f", precision, pt->y);
-                       else
-                               sprintf(y, "%g", pt->y);
-                       trim_trailing_zeros(y);
+                       lwprint_double(
+                           pt->x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+                       lwprint_double(
+                           pt->y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
 
                        if ( i ) ptr += sprintf(ptr, " ");
                        ptr += sprintf(ptr, "%s,%s", x, y);
@@ -698,24 +691,12 @@ pointArray_toGML2(POINTARRAY *pa, char *output, int precision)
                {
                        const POINT3DZ *pt;
                        pt = getPoint3dz_cp(pa, i);
-
-                       if (fabs(pt->x) < OUT_MAX_DOUBLE)
-                               sprintf(x, "%.*f", precision, pt->x);
-                       else
-                               sprintf(x, "%g", pt->x);
-                       trim_trailing_zeros(x);
-
-                       if (fabs(pt->y) < OUT_MAX_DOUBLE)
-                               sprintf(y, "%.*f", precision, pt->y);
-                       else
-                               sprintf(y, "%g", pt->y);
-                       trim_trailing_zeros(y);
-
-                       if (fabs(pt->z) < OUT_MAX_DOUBLE)
-                               sprintf(z, "%.*f", precision, pt->z);
-                       else
-                               sprintf(z, "%g", pt->z);
-                       trim_trailing_zeros(z);
+                       lwprint_double(
+                           pt->x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+                       lwprint_double(
+                           pt->y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
+                       lwprint_double(
+                           pt->z, precision, z, OUT_DOUBLE_BUFFER_SIZE);
 
                        if ( i ) ptr += sprintf(ptr, " ");
                        ptr += sprintf(ptr, "%s,%s,%s", x, y, z);
@@ -1910,9 +1891,9 @@ pointArray_toGML3(POINTARRAY *pa, char *output, int precision, int opts)
 {
        uint32_t i;
        char *ptr;
-       char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-       char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-       char z[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+       char x[OUT_DOUBLE_BUFFER_SIZE];
+       char y[OUT_DOUBLE_BUFFER_SIZE];
+       char z[OUT_DOUBLE_BUFFER_SIZE];
 
        ptr = output;
 
@@ -1922,18 +1903,10 @@ pointArray_toGML3(POINTARRAY *pa, char *output, int precision, int opts)
                {
                        const POINT2D *pt;
                        pt = getPoint2d_cp(pa, i);
-
-                       if (fabs(pt->x) < OUT_MAX_DOUBLE)
-                               sprintf(x, "%.*f", precision, pt->x);
-                       else
-                               sprintf(x, "%g", pt->x);
-                       trim_trailing_zeros(x);
-
-                       if (fabs(pt->y) < OUT_MAX_DOUBLE)
-                               sprintf(y, "%.*f", precision, pt->y);
-                       else
-                               sprintf(y, "%g", pt->y);
-                       trim_trailing_zeros(y);
+                       lwprint_double(
+                           pt->x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+                       lwprint_double(
+                           pt->y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
 
                        if ( i ) ptr += sprintf(ptr, " ");
                        if (IS_DEGREE(opts))
@@ -1949,23 +1922,12 @@ pointArray_toGML3(POINTARRAY *pa, char *output, int precision, int opts)
                        const POINT3DZ *pt;
                        pt = getPoint3dz_cp(pa, i);
 
-                       if (fabs(pt->x) < OUT_MAX_DOUBLE)
-                               sprintf(x, "%.*f", precision, pt->x);
-                       else
-                               sprintf(x, "%g", pt->x);
-                       trim_trailing_zeros(x);
-
-                       if (fabs(pt->y) < OUT_MAX_DOUBLE)
-                               sprintf(y, "%.*f", precision, pt->y);
-                       else
-                               sprintf(y, "%g", pt->y);
-                       trim_trailing_zeros(y);
-
-                       if (fabs(pt->z) < OUT_MAX_DOUBLE)
-                               sprintf(z, "%.*f", precision, pt->z);
-                       else
-                               sprintf(z, "%g", pt->z);
-                       trim_trailing_zeros(z);
+                       lwprint_double(
+                           pt->x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+                       lwprint_double(
+                           pt->y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
+                       lwprint_double(
+                           pt->z, precision, z, OUT_DOUBLE_BUFFER_SIZE);
 
                        if ( i ) ptr += sprintf(ptr, " ");
                        if (IS_DEGREE(opts))
index 7c309b507eb117c7fc1813a6da1a51abcbdaec9d..2f3bbc5c46be1619030ce7050a8281449ef2cc98 100644 (file)
@@ -119,24 +119,14 @@ static size_t
 assvg_point_buf(const LWPOINT *point, char * output, int circle, int precision)
 {
        char *ptr=output;
-       char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-       char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+       char x[OUT_DOUBLE_BUFFER_SIZE];
+       char y[OUT_DOUBLE_BUFFER_SIZE];
        POINT2D pt;
 
        getPoint2d_p(point->point, 0, &pt);
 
-       if (fabs(pt.x) < OUT_MAX_DOUBLE)
-               sprintf(x, "%.*f", precision, pt.x);
-       else
-               sprintf(x, "%g", pt.x);
-       trim_trailing_zeros(x);
-
-       /* SVG Y axis is reversed, an no need to transform 0 into -0 */
-       if (fabs(pt.y) < OUT_MAX_DOUBLE)
-               sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1 : pt.y);
-       else
-               sprintf(y, "%g", fabs(pt.y) ? pt.y * -1 : pt.y);
-       trim_trailing_zeros(y);
+       lwprint_double(pt.x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+       lwprint_double(-pt.y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
 
        if (circle) ptr += sprintf(ptr, "x=\"%s\" y=\"%s\"", x, y);
        else ptr += sprintf(ptr, "cx=\"%s\" cy=\"%s\"", x, y);
@@ -561,8 +551,8 @@ pointArray_svg_rel(POINTARRAY *pa, char *output, int close_ring, int precision)
 {
        int i, end;
        char *ptr;
-       char sx[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-       char sy[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+       char sx[OUT_DOUBLE_BUFFER_SIZE];
+       char sy[OUT_DOUBLE_BUFFER_SIZE];
        const POINT2D *pt;
 
        double f = 1.0;
@@ -584,18 +574,8 @@ pointArray_svg_rel(POINTARRAY *pa, char *output, int close_ring, int precision)
        x = round(pt->x*f)/f;
        y = round(pt->y*f)/f;
 
-       if (fabs(x) < OUT_MAX_DOUBLE)
-               sprintf(sx, "%.*f", precision, x);
-       else
-               sprintf(sx, "%g", x);
-       trim_trailing_zeros(sx);
-
-       if (fabs(y) < OUT_MAX_DOUBLE)
-               sprintf(sy, "%.*f", precision, fabs(y) ? y * -1 : y);
-       else
-               sprintf(sy, "%g", fabs(y) ? y * -1 : y);
-       trim_trailing_zeros(sy);
-
+       lwprint_double(x, precision, sx, OUT_DOUBLE_BUFFER_SIZE);
+       lwprint_double(-y, precision, sy, OUT_DOUBLE_BUFFER_SIZE);
        ptr += sprintf(ptr,"%s %s l", sx, sy);
 
        /* accum */
@@ -614,20 +594,8 @@ pointArray_svg_rel(POINTARRAY *pa, char *output, int close_ring, int precision)
                dx = x - accum_x;
                dy = y - accum_y;
 
-               if (fabs(dx) < OUT_MAX_DOUBLE)
-                       sprintf(sx, "%.*f", precision, dx);
-               else
-                       sprintf(sx, "%g", dx);
-               trim_trailing_zeros(sx);
-
-               /* SVG Y axis is reversed, an no need to transform 0 into -0 */
-               if (fabs(dy) < OUT_MAX_DOUBLE)
-                       sprintf(sy, "%.*f", precision,
-                               fabs(dy) ? dy * -1: dy);
-               else
-                       sprintf(sy, "%g",
-                               fabs(dy) ? dy * -1: dy);
-               trim_trailing_zeros(sy);
+               lwprint_double(dx, precision, sx, OUT_DOUBLE_BUFFER_SIZE);
+               lwprint_double(-dy, precision, sy, OUT_DOUBLE_BUFFER_SIZE);
 
                accum_x += dx;
                accum_y += dy;
@@ -647,8 +615,8 @@ pointArray_svg_abs(POINTARRAY *pa, char *output, int close_ring, int precision)
 {
        int i, end;
        char *ptr;
-       char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-       char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+       char x[OUT_DOUBLE_BUFFER_SIZE];
+       char y[OUT_DOUBLE_BUFFER_SIZE];
        POINT2D pt;
 
        ptr = output;
@@ -660,18 +628,8 @@ pointArray_svg_abs(POINTARRAY *pa, char *output, int close_ring, int precision)
        {
                getPoint2d_p(pa, i, &pt);
 
-               if (fabs(pt.x) < OUT_MAX_DOUBLE)
-                       sprintf(x, "%.*f", precision, pt.x);
-               else
-                       sprintf(x, "%g", pt.x);
-               trim_trailing_zeros(x);
-
-               /* SVG Y axis is reversed, an no need to transform 0 into -0 */
-               if (fabs(pt.y) < OUT_MAX_DOUBLE)
-                       sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1:pt.y);
-               else
-                       sprintf(y, "%g", fabs(pt.y) ? pt.y * -1:pt.y);
-               trim_trailing_zeros(y);
+               lwprint_double(pt.x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+               lwprint_double(-pt.y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
 
                if (i == 1) ptr += sprintf(ptr, " L ");
                else if (i) ptr += sprintf(ptr, " ");
index c021dac85e382950248cb18943650d6ab781355b..88106578605b96234398b57740eaff6785ec5fc2 100644 (file)
@@ -85,6 +85,7 @@ static void ptarray_to_wkt_sb(const POINTARRAY *ptarray, stringbuffer_t *sb, int
        /* OGC only includes X/Y */
        uint32_t dimensions = 2;
        uint32_t i, j;
+       char coord[OUT_DOUBLE_BUFFER_SIZE];
 
        /* ISO and extended formats include all dimensions */
        if ( variant & ( WKT_ISO | WKT_EXTENDED ) )
@@ -108,7 +109,11 @@ static void ptarray_to_wkt_sb(const POINTARRAY *ptarray, stringbuffer_t *sb, int
                        /* Spaces before every ordinate but the first */
                        if ( j > 0 )
                                stringbuffer_append(sb, " ");
-                       stringbuffer_aprintf(sb, "%.*g", precision, dbl_ptr[j]);
+                       lwprint_double(dbl_ptr[j],
+                                      precision,
+                                      coord,
+                                      OUT_DOUBLE_BUFFER_SIZE);
+                       stringbuffer_append(sb, coord);
                }
        }
 
@@ -657,15 +662,16 @@ static void lwgeom_to_wkt_sb(const LWGEOM *geom, stringbuffer_t *sb, int precisi
 }
 
 /**
-* WKT emitter function. Allocates a new *char and fills it with the WKT
-* representation. If size_out is not NULL, it will be set to the size of the
-* allocated *char.
-*
-* @param variant Bitmasked value, accepts one of WKT_ISO, WKT_SFSQL, WKT_EXTENDED.
-* @param precision Number of significant digits in the output doubles.
-* @param size_out If supplied, will return the size of the returned string,
-* including the null terminator.
-*/
+ * WKT emitter function. Allocates a new *char and fills it with the WKT
+ * representation. If size_out is not NULL, it will be set to the size of the
+ * allocated *char.
+ *
+ * @param variant Bitmasked value, accepts one of WKT_ISO, WKT_SFSQL,
+ * WKT_EXTENDED.
+ * @param precision Maximal number of digits after comma in the output doubles.
+ * @param size_out If supplied, will return the size of the returned string,
+ * including the null terminator.
+ */
 char* lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
 {
        stringbuffer_t *sb;
index 2265f7d05144c2d140ea0f7ebe07060744480236..c35599dd833d2dffe51ca56d9a44f0a7e3a3222d 100644 (file)
@@ -498,9 +498,9 @@ static int
 ptarray_to_x3d3_sb(POINTARRAY *pa, int precision, int opts, int is_closed, stringbuffer_t *sb )
 {
        uint32_t i;
-       char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-       char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-       char z[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+       char x[OUT_DOUBLE_BUFFER_SIZE];
+       char y[OUT_DOUBLE_BUFFER_SIZE];
+       char z[OUT_DOUBLE_BUFFER_SIZE];
 
        if ( ! FLAGS_GET_Z(pa->flags) )
        {
@@ -512,17 +512,10 @@ ptarray_to_x3d3_sb(POINTARRAY *pa, int precision, int opts, int is_closed, strin
                                POINT2D pt;
                                getPoint2d_p(pa, i, &pt);
 
-                               if (fabs(pt.x) < OUT_MAX_DOUBLE)
-                                       sprintf(x, "%.*f", precision, pt.x);
-                               else
-                                       sprintf(x, "%g", pt.x);
-                               trim_trailing_zeros(x);
-
-                               if (fabs(pt.y) < OUT_MAX_DOUBLE)
-                                       sprintf(y, "%.*f", precision, pt.y);
-                               else
-                                       sprintf(y, "%g", pt.y);
-                               trim_trailing_zeros(y);
+                               lwprint_double(
+                                   pt.x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+                               lwprint_double(
+                                   pt.y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
 
                                if ( i ) stringbuffer_append(sb," ");
 
@@ -543,23 +536,12 @@ ptarray_to_x3d3_sb(POINTARRAY *pa, int precision, int opts, int is_closed, strin
                                POINT4D pt;
                                getPoint4d_p(pa, i, &pt);
 
-                               if (fabs(pt.x) < OUT_MAX_DOUBLE)
-                                       sprintf(x, "%.*f", precision, pt.x);
-                               else
-                                       sprintf(x, "%g", pt.x);
-                               trim_trailing_zeros(x);
-
-                               if (fabs(pt.y) < OUT_MAX_DOUBLE)
-                                       sprintf(y, "%.*f", precision, pt.y);
-                               else
-                                       sprintf(y, "%g", pt.y);
-                               trim_trailing_zeros(y);
-
-                               if (fabs(pt.z) < OUT_MAX_DOUBLE)
-                                       sprintf(z, "%.*f", precision, pt.z);
-                               else
-                                       sprintf(z, "%g", pt.z);
-                               trim_trailing_zeros(z);
+                               lwprint_double(
+                                   pt.x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+                               lwprint_double(
+                                   pt.y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
+                               lwprint_double(
+                                   pt.z, precision, z, OUT_DOUBLE_BUFFER_SIZE);
 
                                if ( i ) stringbuffer_append(sb," ");
 
index 649285e565a68a48deb0e7897d628f3e1f06f6f2..6e36ec489393a8a8747d055c3d3794a22ef3b9a2 100644 (file)
@@ -435,3 +435,76 @@ char* lwpoint_to_latlon(const LWPOINT * pt, const char *format)
        p = getPoint2d_cp(pt->point, 0);
        return lwdoubles_to_latlon(p->y, p->x, format);
 }
+
+/*
+ * Removes trailing zeros and dot for a %f formatted number.
+ * Modifies input.
+ */
+static void
+trim_trailing_zeros(char* str)
+{
+       char *ptr, *totrim = NULL;
+       int len;
+       int i;
+
+       LWDEBUGF(3, "input: %s", str);
+
+       ptr = strchr(str, '.');
+       if (!ptr) return; /* no dot, no decimal digits */
+
+       LWDEBUGF(3, "ptr: %s", ptr);
+
+       len = strlen(ptr);
+       for (i = len - 1; i; i--)
+       {
+               if (ptr[i] != '0') break;
+               totrim = &ptr[i];
+       }
+       if (totrim)
+       {
+               if (ptr == totrim - 1)
+                       *ptr = '\0';
+               else
+                       *totrim = '\0';
+       }
+
+       LWDEBUGF(3, "output: %s", str);
+}
+
+/*
+ * Print an ordinate value using at most the given number of decimal digits
+ *
+ * The actual number of printed decimal digits may be less than the
+ * requested ones if out of significant digits.
+ *
+ * The function will not write more than maxsize bytes, including the
+ * terminating NULL. Returns the number of bytes that would have been
+ * written if there was enough space (excluding terminating NULL).
+ * So a return of ``bufsize'' or more means that the string was
+ * truncated and misses a terminating NULL.
+ *
+ */
+int
+lwprint_double(double d, int maxdd, char* buf, size_t bufsize)
+{
+       double ad = fabs(d);
+       int ndd = ad < 1 ? 0 : floor(log10(ad)) + 1; /* non-decimal digits */
+       int length = 0;
+       if (ad <= FP_TOLERANCE)
+       {
+               d = 0;
+               ad = 0;
+       }
+       if (ad < OUT_MAX_DOUBLE)
+       {
+               if (maxdd > (OUT_MAX_DOUBLE_PRECISION - ndd)) maxdd -= ndd;
+               length = snprintf(buf, bufsize, "%.*f", maxdd, d);
+       }
+       else
+       {
+               length = snprintf(buf, bufsize, "%g", d);
+       }
+       assert(length < bufsize);
+       trim_trailing_zeros(buf);
+       return length;
+}
\ No newline at end of file
index fb9f4a3232c870b4ee7a75b432f6b1ec4e71b018..93d70b7855370ab1417507908fe05a910895b52e 100644 (file)
@@ -246,39 +246,6 @@ lwfree(void *mem)
        lwfree_var(mem);
 }
 
-/*
- * Removes trailing zeros and dot for a %f formatted number.
- * Modifies input.
- */
-void
-trim_trailing_zeros(char *str)
-{
-       char *ptr, *totrim=NULL;
-       int len;
-       int i;
-
-       LWDEBUGF(3, "input: %s", str);
-
-       ptr = strchr(str, '.');
-       if ( ! ptr ) return; /* no dot, no decimal digits */
-
-       LWDEBUGF(3, "ptr: %s", ptr);
-
-       len = strlen(ptr);
-       for (i=len-1; i; i--)
-       {
-               if ( ptr[i] != '0' ) break;
-               totrim=&ptr[i];
-       }
-       if ( totrim )
-       {
-               if ( ptr == totrim-1 ) *ptr = '\0';
-               else *totrim = '\0';
-       }
-
-       LWDEBUGF(3, "output: %s", str);
-}
-
 /*
  * Returns a new string which contains a maximum of maxlength characters starting
  * from startpos and finishing at endpos (0-based indexing). If the string is
index 93fd31c35dc9caa77f58cc950a7157aee4271bda..66b3b2da3e8a0a5ef964b5baba31e47b3318386c 100644 (file)
@@ -15,9 +15,9 @@ BOX3D(0 0.1 -55,11 12 12)
 #3069|BOX(0 0,1 1)
 #3069|BOX(1 1,1 1)
 #3069|BOX(0 0,1 1)
-BoundingDiagonal1|SRID=4326;LINESTRING(999999986991104 999999986991104,1.00000005409997e+15 1.00000005409997e+15)
+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,1.00000005409997e+15 1.00000005409997e+15)
+BoundingDiagonal3|SRID=4326;LINESTRING(999999986991104 999999986991104,1e+15 1e+15)
 BoundingDiagonal4|SRID=3857;LINESTRING(-1 -2 -8 2,1 2 3 9)
 BoundingDiagonal5|SRID=3857;LINESTRINGM(4 4 0,5 4 1)
 BoundingDiagonal6|SRID=3857;LINESTRINGM EMPTY
index bf70ddf7b74407690e60132177e0e045254e005e..8840060f2d0ec32abe193abaa0add401ce34818e 100644 (file)
@@ -45,7 +45,7 @@
 45|GEOMETRYCOLLECTION(MULTILINESTRING((0 0 0,1 1 0,2 2 0,3 3 0,4 4 0)),POINT(1 2 3))
 46|GEOMETRYCOLLECTION(POINT(1 2 3),MULTIPOLYGON(((0 0 0,10 0 0,10 10 0,0 10 0,0 0 0)),((0 0 0,10 0 0,10 10 0,0 10 0,0 0 0),(5 5 0,7 5 0,7 7 0,5 7 0,5 5 0)),((0 0 1,10 0 1,10 10 1,0 10 1,0 0 1),(5 5 1,7 5 1,7 7 1,5 7 1,5 5 1),(1 1 1,2 1 1,2 2 1,1 2 1,1 1 1))))
 47|GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0 0,10 0 0,10 10 0,0 10 0,0 0 0)),((0 0 0,10 0 0,10 10 0,0 10 0,0 0 0),(5 5 0,7 5 0,7 7 0,5 7 0,5 5 0)),((0 0 1,10 0 1,10 10 1,0 10 1,0 0 1),(5 5 1,7 5 1,7 7 1,5 7 1,5 5 1),(1 1 1,2 1 1,2 2 1,1 2 1,1 1 1))),MULTILINESTRING((0 0 0,1 1 0,2 2 0,3 3 0,4 4 0),(0 0 0,1 1 0,2 2 0,3 3 0,4 4 0),(1 2 3,4 5 6,7 8 9,10 11 12,13 14 15)),MULTIPOINT(1 2 3,5 6 7,8 9 10,11 12 13))
-48|MULTIPOINT(-1 -2 -3,5.4 6.6 7.77,-5.4 -6.6 -7.77,1000000 1e-6 -1000000,-1.3e-6 -1.4e-5 0)
+48|MULTIPOINT(-1 -2 -3,5.4 6.6 7.77,-5.4 -6.6 -7.77,1000000 0.000001 -1000000,-0.0000013 -0.000014 0)
 49|GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(1 1)))
 ERROR:  parse error - invalid geometry at character 14
 ERROR:  parse error - invalid geometry at character 14
index bf0491722556f5450642292534410504b3986970..d2427b51dc258b4ae24c460758a7619d6de7c1de 100644 (file)
@@ -10,6 +10,6 @@ ST_Orientation_2|1
 ST_MinkowskiSum|MULTIPOLYGON(((0 0,1 0,5 0,5 1,4 1,0 1,0 0)))
 ST_StraightSkeleton|MULTILINESTRING((1 1,1.5 1.5),(2 1,1.5 1.5),(2 2,1.5 1.5),(1 2,1.5 1.5))
 intersection_geos|POINT(0 0)
-intersection_sfcgal|POINT(-0 -0)
+intersection_sfcgal|POINT(0)
 ERROR:  Can't find foo geometry backend
 ERROR:  Can't find  geometry backend
index 892c2b003b84a390be88fcce2fb0280af08ced59..35453244d53e5ed58663fc9a693c4601e2e8da06 100644 (file)
@@ -41,18 +41,6 @@ sfcgal/ticket
    which .. also make sense
 
 
-
-==
-sfcgal/regress_ogc
-==
-
-65.OBT: intersection|POINT(-0 -0)
-65.EXP: intersection|POINT(0 0)
-
-=> No comment, except that the test itself could be sligthly rewrited
-
-
-
 ==
 sfcgal/empty
 ==
index d0844e4c70f0a5141d3397d3bb94da8ae2d2f599..3fc4d1db4493fa18c6092a6e0a0c823159989fd5 100644 (file)
@@ -45,7 +45,7 @@
 45|GEOMETRYCOLLECTION(MULTILINESTRING((0 0 0,1 1 0,2 2 0,3 3 0,4 4 0)),POINT(1 2 3))
 46|GEOMETRYCOLLECTION(POINT(1 2 3),MULTIPOLYGON(((0 0 0,10 0 0,10 10 0,0 10 0,0 0 0)),((0 0 0,10 0 0,10 10 0,0 10 0,0 0 0),(5 5 0,7 5 0,7 7 0,5 7 0,5 5 0)),((0 0 1,10 0 1,10 10 1,0 10 1,0 0 1),(5 5 1,7 5 1,7 7 1,5 7 1,5 5 1),(1 1 1,2 1 1,2 2 1,1 2 1,1 1 1))))
 47|GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0 0,10 0 0,10 10 0,0 10 0,0 0 0)),((0 0 0,10 0 0,10 10 0,0 10 0,0 0 0),(5 5 0,7 5 0,7 7 0,5 7 0,5 5 0)),((0 0 1,10 0 1,10 10 1,0 10 1,0 0 1),(5 5 1,7 5 1,7 7 1,5 7 1,5 5 1),(1 1 1,2 1 1,2 2 1,1 2 1,1 1 1))),MULTILINESTRING((0 0 0,1 1 0,2 2 0,3 3 0,4 4 0),(0 0 0,1 1 0,2 2 0,3 3 0,4 4 0),(1 2 3,4 5 6,7 8 9,10 11 12,13 14 15)),MULTIPOINT(1 2 3,5 6 7,8 9 10,11 12 13))
-48|MULTIPOINT(-1 -2 -3,5.4 6.6 7.77,-5.4 -6.6 -7.77,1000000 1e-6 -1000000,-1.3e-6 -1.4e-5 0)
+48|MULTIPOINT(-1 -2 -3,5.4 6.6 7.77,-5.4 -6.6 -7.77,1000000 0.000001 -1000000,-0.0000013 -0.000014 0)
 49|GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(1 1)))
 ERROR:  parse error - invalid geometry at character 14
 ERROR:  parse error - invalid geometry at character 14
index 65205fc487d9a30bf7adb54dca6d15e1f2efd58a..a8cfab4f832f9b6f6b57742a00ad992bf3602c16 100644 (file)
@@ -88,7 +88,7 @@ isvalid|t
 NOTICE:  Self-intersection
 isvalid|f
 isvalid|t
-intersection|POINT(-0 -0)
+intersection|POINT(0)
 difference|MULTILINESTRING((0 -2,0 -10),(0 10,0 2))
 boundary|MULTILINESTRING((0 0,0 10,10 10,10 0,0 0),(2 2,2 4,4 4,4 2,2 2))
 symdifference|GEOMETRYCOLLECTION(LINESTRING(2 2,4 4),LINESTRING(10 10,20 20),POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,2 4,2 2,4 2,4 4)))
index 9451b953f3eec8180e6acd5bfa4e2bd413e83550..6d63faf1d394996e5cd2ad51686d1e51bbb77ca0 100644 (file)
@@ -32,7 +32,7 @@ ERROR:  Invalid hex string, length (267) has to be a multiple of two!
 #157|ST_Polygon|POLYGON
 #157|ST_CurvePolygon|CURVEPOLYGON
 #157|ST_CircularString|CIRCULARSTRING
-#168|3|MULTIPOLYGON ZM (((4275341.96977851 259186.966993061 1323.76295828331 -1.79769313486232e+308,4275341.96977851 259186.966993061 1323.76295828331 -1.79769313486232e+308,4275341.96977851 259186.966993061 1323.76295828331 -1.79769313486232e+308)))|IllegalArgumentException: Invalid number of points in LinearRing found 3 - must be 0 or >= 4
+#168|3|MULTIPOLYGON ZM (((4275341.96977851 259186.966993061 1323.76295828331 -1.79769e+308,4275341.96977851 259186.966993061 1323.76295828331 -1.79769e+308,4275341.96977851 259186.966993061 1323.76295828331 -1.79769e+308)))|IllegalArgumentException: Invalid number of points in LinearRing found 3 - must be 0 or >= 4
 #175|SRID=26915;POINT(482020 4984378)
 #178a|0
 #178b|5
index 2c1265bfbad478b8d6099b42f706bc355599c940..89232d7d2ae7fa9eb8537d18a9749202703a1dc5 100644 (file)
@@ -32,7 +32,7 @@ ERROR:  Invalid hex string, length (267) has to be a multiple of two!
 #157|ST_Polygon|POLYGON
 #157|ST_CurvePolygon|CURVEPOLYGON
 #157|ST_CircularString|CIRCULARSTRING
-#168|3|MULTIPOLYGON ZM (((4275341.96977851 259186.966993061 1323.76295828331 -1.79769313486232e+308,4275341.96977851 259186.966993061 1323.76295828331 -1.79769313486232e+308,4275341.96977851 259186.966993061 1323.76295828331 -1.79769313486232e+308)))|IllegalArgumentException: Invalid number of points in LinearRing found 3 - must be 0 or >= 4
+#168|3|MULTIPOLYGON ZM (((4275341.96977851 259186.966993061 1323.76295828331 -1.79769e+308,4275341.96977851 259186.966993061 1323.76295828331 -1.79769e+308,4275341.96977851 259186.966993061 1323.76295828331 -1.79769e+308)))|IllegalArgumentException: Invalid number of points in LinearRing found 3 - must be 0 or >= 4
 #175|SRID=26915;POINT(482020 4984378)
 #178a|0
 #178b|5
@@ -307,7 +307,7 @@ ERROR:  invalid KML representation
 #3709|t
 #3774|t
 #1014a|POINT(0 0)
-#1014a|POINT(-0 0)
+#1014a|POINT(0 0)
 #1014b|POINT(0 1)
 #1014c|1|POINT(0 1)
 #1014c|2|POINT(1 2)