]> granicus.if.org Git - postgis/commitdiff
Add lost mention of Shoaib Burq.
authorDarafei Praliaskouski <me@komzpa.net>
Thu, 11 Jan 2018 17:41:42 +0000 (17:41 +0000)
committerDarafei Praliaskouski <me@komzpa.net>
Thu, 11 Jan 2018 17:41:42 +0000 (17:41 +0000)
Reformat Encoded Polyline out function to fit 80 columns per strk's request.

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

liblwgeom/cunit/cu_out_encoded_polyline.c
liblwgeom/lwout_encoded_polyline.c

index b0fb3f1f136522c8afdcff0cd301e7d473d3b066..b9728a3f8b3d624ec8cf082c9e7e81edf13f95d6 100644 (file)
@@ -28,7 +28,8 @@ do_encoded_polyline_test(char* in, int precision, char* out)
        g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE);
        h = lwgeom_to_encoded_polyline(g, precision);
 
-       if (strcmp(h, out)) fprintf(stderr, "\nIn:   %s\nOut:  %s\nTheo: %s\n", in, h, out);
+       if (strcmp(h, out))
+               fprintf(stderr, "\nIn:   %s\nOut:  %s\nTheo: %s\n", in, h, out);
 
        CU_ASSERT_STRING_EQUAL(h, out);
 
@@ -40,17 +41,22 @@ static void
 out_encoded_polyline_test_geoms(void)
 {
        /* Magic Linestring */
-       do_encoded_polyline_test("SRID=4326;LINESTRING(33.6729 38.7071,33.6692 38.701,33.6673 38.6972,33.6626 38.6871)",
-                                5,
-                                "k~fkFsvolEbe@bVvVzJb~@j\\");
+       do_encoded_polyline_test(
+               "SRID=4326;LINESTRING(33.6729 38.7071,33.6692 38.701,"
+               "33.6673 38.6972,33.6626 38.6871)",
+               5,
+               "k~fkFsvolEbe@bVvVzJb~@j\\");
        return;
 
        /* Linestring */
        do_encoded_polyline_test(
-           "LINESTRING(-120.2 38.5,-120.95 40.7,-126.453 43.252)", 5, "_p~iF~ps|U_ulLnnqC_mqNvxq`@");
+               "LINESTRING(-120.2 38.5,-120.95 40.7,-126.453 43.252)",
+               5,
+               "_p~iF~ps|U_ulLnnqC_mqNvxq`@");
 
        /* MultiPoint */
-       do_encoded_polyline_test("MULTIPOINT(-120.2 38.5,-120.95 40.7)", 5, "_p~iF~ps|U_ulLnnqC");
+       do_encoded_polyline_test(
+               "MULTIPOINT(-120.2 38.5,-120.95 40.7)", 5, "_p~iF~ps|U_ulLnnqC");
 }
 
 static void
@@ -58,10 +64,12 @@ out_encoded_polyline_test_srid(void)
 {
 
        /* SRID - with PointArray */
-       do_encoded_polyline_test("SRID=4326;LINESTRING(0 1,2 3)", 5, "_ibE?_seK_seK");
+       do_encoded_polyline_test(
+               "SRID=4326;LINESTRING(0 1,2 3)", 5, "_ibE?_seK_seK");
 
        /* wrong SRID */
-       do_encoded_polyline_test("SRID=4327;LINESTRING(0 1,2 3)", 5, "_ibE?_seK_seK");
+       do_encoded_polyline_test(
+               "SRID=4327;LINESTRING(0 1,2 3)", 5, "_ibE?_seK_seK");
 }
 
 static void
@@ -69,13 +77,16 @@ out_encoded_polyline_test_precision(void)
 {
 
        /* Linestring */
-       do_encoded_polyline_test("LINESTRING(-0.250691 49.283048,-0.250633 49.283376,-0.250502 49.283972,-0.251245 "
-                                "49.284028,-0.251938 49.284232,-0.251938 49.2842)",
-                                6,
-                                "o}~~|AdshNoSsBgd@eGoBlm@wKhj@~@?");
+       do_encoded_polyline_test(
+               "LINESTRING(-0.250691 49.283048, -0.250633 49.283376,"
+               "-0.250502 49.283972, -0.251245 49.284028, -0.251938 "
+               "49.284232, -0.251938 49.2842)",
+               6,
+               "o}~~|AdshNoSsBgd@eGoBlm@wKhj@~@?");
 
        /* MultiPoint */
-       do_encoded_polyline_test("MULTIPOINT(-120.2 38.5,-120.95 40.7)", 3, "gejAnwiFohCzm@");
+       do_encoded_polyline_test(
+               "MULTIPOINT(-120.2 38.5,-120.95 40.7)", 3, "gejAnwiFohCzm@");
 }
 
 /*
index 7acfb086bff183c44a05f229dd15ea41c8adcb08..1400e46cfd4e276859a0a04bcb1ca3f2f5ccad2a 100644 (file)
@@ -19,6 +19,7 @@
  **********************************************************************
  *
  * Copyright 2014 Kashif Rasul <kashif.rasul@gmail.com> and
+ *                Shoaib Burq <saburq@gmail.com>
  *
  **********************************************************************/
 
@@ -41,7 +42,8 @@ lwgeom_to_encoded_polyline(const LWGEOM* geom, int precision)
        case MULTIPOINTTYPE:
                return lwmmpoint_to_encoded_polyline((LWMPOINT*)geom, precision);
        default:
-               lwerror("lwgeom_to_encoded_polyline: '%s' geometry type not supported", lwtype_name(type));
+               lwerror("lwgeom_to_encoded_polyline: '%s' geometry type not supported",
+                               lwtype_name(type));
                return NULL;
        }
 }
@@ -72,7 +74,8 @@ pointarray_to_encoded_polyline(const POINTARRAY* pa, int precision)
        stringbuffer_t* sb;
        double scale = pow(10, precision);
 
-       /* Take the double value and multiply it by 1x10^precision, rounding the result */
+       /* Take the double value and multiply it by 1x10^precision, rounding the
+        * result */
        prevPoint = getPoint2d_cp(pa, 0);
        delta[0] = round(prevPoint->y * scale);
        delta[1] = round(prevPoint->x * scale);
@@ -82,11 +85,13 @@ pointarray_to_encoded_polyline(const POINTARRAY* pa, int precision)
        {
                const POINT2D* point = getPoint2d_cp(pa, i);
                delta[2 * i] = round(point->y * scale) - round(prevPoint->y * scale);
-               delta[(2 * i) + 1] = round(point->x * scale) - round(prevPoint->x * scale);
+               delta[(2 * i) + 1] =
+                       round(point->x * scale) - round(prevPoint->x * scale);
                prevPoint = point;
        }
 
-       /* value to binary: a negative value must be calculated using its two's complement */
+       /* value to binary: a negative value must be calculated using its two's
+        * complement */
        for (i = 0; i < pa->npoints * 2; i++)
        {
                /* Multiply by 2 for a signed left shift */