]> granicus.if.org Git - postgis/commitdiff
Surrender to evidence of the narrow ring tested being clockwise
authorSandro Santilli <strk@keybit.net>
Mon, 21 Nov 2011 08:21:41 +0000 (08:21 +0000)
committerSandro Santilli <strk@keybit.net>
Mon, 21 Nov 2011 08:21:41 +0000 (08:21 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8199 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/cunit/cu_libgeom.c
liblwgeom/cunit/cu_ptarray.c

index 6c67e6f582ec0a1750a0ae62e17688264a6e7434..4125ea3c65a03e538db2376818aefa4f41acd49d 100644 (file)
@@ -623,11 +623,10 @@ static void test_lwgeom_force_clockwise(void)
        lwfree(out_ewkt);
        lwgeom_free(geom);
 
-       /* counterclockwise, should be reversed */
+       /* clockwise narrow ring, fine as-is */
        /* NOTE: this is a narrow ring, see ticket #1302 */
        in_ewkt  = "0103000000010000000500000000917E9BA468294100917E9B8AEA2841C976BE1FA4682941C976BE9F8AEA2841B39ABE1FA46829415ACCC29F8AEA284137894120A4682941C976BE9F8AEA284100917E9BA468294100917E9B8AEA2841";
        geom = lwgeom_from_hexwkb(in_ewkt, LW_PARSER_CHECK_NONE);
-       in_ewkt = "0103000000010000000500000000917E9BA468294100917E9B8AEA284137894120A4682941C976BE9F8AEA2841B39ABE1FA46829415ACCC29F8AEA2841C976BE1FA4682941C976BE9F8AEA284100917E9BA468294100917E9B8AEA2841";
        lwgeom_force_clockwise(geom);
        out_ewkt = lwgeom_to_hexwkb(geom, WKB_ISO, NULL);
        if (strcmp(in_ewkt, out_ewkt))
index 8b6029f88270b950620e5f55211c4befe010a111..086d179d849aa6de2cd398360caf572eba75cb0b 100644 (file)
@@ -112,6 +112,7 @@ static void test_ptarray_locate_point(void)
 static void test_ptarray_isccw(void)
 {
         LWLINE *line;
+       LWPOLY* poly;
        int ccw;
 
        /* clockwise rectangle */
@@ -143,6 +144,12 @@ static void test_ptarray_isccw(void)
        ccw = ptarray_isccw(line->points);
        CU_ASSERT_EQUAL(ccw, 0);
        lwline_free(line);
+
+       /* Clockwise narrow ring (see ticket #1302) */
+       poly = lwgeom_as_lwpoly(lwgeom_from_hexwkb("0103000000010000000500000000917E9BA468294100917E9B8AEA2841C976BE1FA4682941C976BE9F8AEA2841B39ABE1FA46829415ACCC29F8AEA284137894120A4682941C976BE9F8AEA284100917E9BA468294100917E9B8AEA2841", LW_PARSER_CHECK_NONE));
+       ccw = ptarray_isccw(poly->rings[0]);
+       CU_ASSERT_EQUAL(ccw, 0);
+       lwpoly_free(poly);
 }