From: Sandro Santilli Date: Thu, 11 Aug 2011 07:51:45 +0000 (+0000) Subject: Give PARSER_CHECK macros an LW_ prefix [RT-SIGTA] X-Git-Tag: 2.0.0alpha1~1122 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=89bb89d9d15db5bea1f94239072b750a1ac01e7a;p=postgis Give PARSER_CHECK macros an LW_ prefix [RT-SIGTA] git-svn-id: http://svn.osgeo.org/postgis/trunk@7725 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/cunit/cu_algorithm.c b/liblwgeom/cunit/cu_algorithm.c index 9d3b8c0f0..31136d764 100644 --- a/liblwgeom/cunit/cu_algorithm.c +++ b/liblwgeom/cunit/cu_algorithm.c @@ -307,50 +307,50 @@ static void test_lwline_crossing_long_lines(void) ** More complex test, longer lines and multiple crossings */ /* Vertical line with vertices at y integers */ - l51 = (LWLINE*)lwgeom_from_wkt("LINESTRING(0 0, 0 1, 0 2, 0 3, 0 4)", PARSER_CHECK_NONE); + l51 = (LWLINE*)lwgeom_from_wkt("LINESTRING(0 0, 0 1, 0 2, 0 3, 0 4)", LW_PARSER_CHECK_NONE); /* Two crossings at segment midpoints */ - l52 = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 1, -1 1.5, 1 3, 1 4, 1 5)", PARSER_CHECK_NONE); + l52 = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 1, -1 1.5, 1 3, 1 4, 1 5)", LW_PARSER_CHECK_NONE); CU_ASSERT( lwline_crossing_direction(l51, l52) == LINE_MULTICROSS_END_SAME_FIRST_LEFT ); lwline_free(l52); /* One crossing at interior vertex */ - l52 = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 1, 0 1, -1 1, -1 2, -1 3)", PARSER_CHECK_NONE); + l52 = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 1, 0 1, -1 1, -1 2, -1 3)", LW_PARSER_CHECK_NONE); CU_ASSERT( lwline_crossing_direction(l51, l52) == LINE_CROSS_LEFT ); lwline_free(l52); /* Two crossings at interior vertices */ - l52 = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 1, 0 1, -1 1, 0 3, 1 3)", PARSER_CHECK_NONE); + l52 = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 1, 0 1, -1 1, 0 3, 1 3)", LW_PARSER_CHECK_NONE); CU_ASSERT( lwline_crossing_direction(l51, l52) == LINE_MULTICROSS_END_SAME_FIRST_LEFT ); lwline_free(l52); /* Two crossings, one at the first vertex on at interior vertex */ - l52 = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 0, 0 0, -1 1, 0 3, 1 3)", PARSER_CHECK_NONE); + l52 = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 0, 0 0, -1 1, 0 3, 1 3)", LW_PARSER_CHECK_NONE); CU_ASSERT( lwline_crossing_direction(l51, l52) == LINE_MULTICROSS_END_SAME_FIRST_LEFT ); lwline_free(l52); /* Two crossings, one at the first vertex on the next interior vertex */ - l52 = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 0, 0 0, -1 1, 0 1, 1 2)", PARSER_CHECK_NONE); + l52 = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 0, 0 0, -1 1, 0 1, 1 2)", LW_PARSER_CHECK_NONE); CU_ASSERT( lwline_crossing_direction(l51, l52) == LINE_MULTICROSS_END_SAME_FIRST_LEFT ); lwline_free(l52); /* Three crossings, two at midpoints, one at vertex */ - l52 = (LWLINE*)lwgeom_from_wkt("LINESTRING(0.5 1, -1 0.5, 1 2, -1 2, -1 3)", PARSER_CHECK_NONE); + l52 = (LWLINE*)lwgeom_from_wkt("LINESTRING(0.5 1, -1 0.5, 1 2, -1 2, -1 3)", LW_PARSER_CHECK_NONE); CU_ASSERT( lwline_crossing_direction(l51, l52) == LINE_MULTICROSS_END_LEFT ); lwline_free(l52); /* One mid-point co-linear crossing */ - l52 = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 1, 0 1.5, 0 2.5, -1 3, -1 4)", PARSER_CHECK_NONE); + l52 = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 1, 0 1.5, 0 2.5, -1 3, -1 4)", LW_PARSER_CHECK_NONE); CU_ASSERT( lwline_crossing_direction(l51, l52) == LINE_CROSS_LEFT ); lwline_free(l52); /* One on-vertices co-linear crossing */ - l52 = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 1, 0 1, 0 2, -1 4, -1 4)", PARSER_CHECK_NONE); + l52 = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 1, 0 1, 0 2, -1 4, -1 4)", LW_PARSER_CHECK_NONE); CU_ASSERT( lwline_crossing_direction(l51, l52) == LINE_CROSS_LEFT ); lwline_free(l52); /* No crossing, but end on a co-linearity. */ - l52 = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 1, 1 2, 1 3, 0 3, 0 4)", PARSER_CHECK_NONE); + l52 = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 1, 1 2, 1 3, 0 3, 0 4)", LW_PARSER_CHECK_NONE); CU_ASSERT( lwline_crossing_direction(l51, l52) == LINE_NO_CROSS ); lwline_free(l52); @@ -364,8 +364,8 @@ static void test_lwline_crossing_bugs(void) LWLINE *l1; LWLINE *l2; - l1 = (LWLINE*)lwgeom_from_wkt("LINESTRING(2.99 90.16,71 74,20 140,171 154)", PARSER_CHECK_NONE); - l2 = (LWLINE*)lwgeom_from_wkt("LINESTRING(25 169,89 114,40 70,86 43)", PARSER_CHECK_NONE); + l1 = (LWLINE*)lwgeom_from_wkt("LINESTRING(2.99 90.16,71 74,20 140,171 154)", LW_PARSER_CHECK_NONE); + l2 = (LWLINE*)lwgeom_from_wkt("LINESTRING(25 169,89 114,40 70,86 43)", LW_PARSER_CHECK_NONE); CU_ASSERT( lwline_crossing_direction(l1, l2) == LINE_MULTICROSS_END_RIGHT ); lwline_free(l1); @@ -446,7 +446,7 @@ static void test_lwline_clip(void) char *ewkt; /* Vertical line with vertices at y integers */ - l51 = (LWLINE*)lwgeom_from_wkt("LINESTRING(0 0, 0 1, 0 2, 0 3, 0 4)", PARSER_CHECK_NONE); + l51 = (LWLINE*)lwgeom_from_wkt("LINESTRING(0 0, 0 1, 0 2, 0 3, 0 4)", LW_PARSER_CHECK_NONE); /* Clip in the middle, mid-range. */ c = lwline_clip_to_ordinate_range(l51, 1, 1.5, 2.5); @@ -505,7 +505,7 @@ static void test_lwline_clip(void) lwcollection_free(c); /* ST_LocateBetweenElevations(ST_GeomFromEWKT('LINESTRING(1 2 3, 4 5 6, 6 6 6, 1 1 1)'), 1, 2)) */ - line = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 2 3, 4 5 6, 6 6 6, 1 1 1)", PARSER_CHECK_NONE); + line = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 2 3, 4 5 6, 6 6 6, 1 1 1)", LW_PARSER_CHECK_NONE); c = lwline_clip_to_ordinate_range(line, 2, 1.0, 2.0); ewkt = lwgeom_to_ewkt((LWGEOM*)c); CU_ASSERT_STRING_EQUAL(ewkt, "MULTILINESTRING((2 2 2,1 1 1))" ); @@ -514,7 +514,7 @@ static void test_lwline_clip(void) lwline_free(line); /* ST_LocateBetweenElevations('LINESTRING(1 2 3, 4 5 6, 6 6 6, 1 1 1)', 1, 2)) */ - line = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 2 3, 4 5 6, 6 6 6, 1 1 1)", PARSER_CHECK_NONE); + line = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 2 3, 4 5 6, 6 6 6, 1 1 1)", LW_PARSER_CHECK_NONE); c = lwline_clip_to_ordinate_range(line, 2, 1.0, 2.0); ewkt = lwgeom_to_ewkt((LWGEOM*)c); //printf("a = %s\n", ewkt); @@ -524,7 +524,7 @@ static void test_lwline_clip(void) lwline_free(line); /* ST_LocateBetweenElevations('LINESTRING(1 2 3, 4 5 6, 6 6 6, 1 1 1)', 1, 1)) */ - line = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 2 3, 4 5 6, 6 6 6, 1 1 1)", PARSER_CHECK_NONE); + line = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 2 3, 4 5 6, 6 6 6, 1 1 1)", LW_PARSER_CHECK_NONE); c = lwline_clip_to_ordinate_range(line, 2, 1.0, 1.0); ewkt = lwgeom_to_ewkt((LWGEOM*)c); //printf("b = %s\n", ewkt); @@ -534,7 +534,7 @@ static void test_lwline_clip(void) lwline_free(line); /* ST_LocateBetweenElevations('LINESTRING(1 1 1, 1 2 2)', 1,1) */ - line = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 1 1, 1 2 2)", PARSER_CHECK_NONE); + line = (LWLINE*)lwgeom_from_wkt("LINESTRING(1 1 1, 1 2 2)", LW_PARSER_CHECK_NONE); c = lwline_clip_to_ordinate_range(line, 2, 1.0, 1.0); ewkt = lwgeom_to_ewkt((LWGEOM*)c); //printf("c = %s\n", ewkt); @@ -557,7 +557,7 @@ static void test_lwmline_clip(void) /* ** Set up the input line. Trivial one-member case. */ - mline = (LWMLINE*)lwgeom_from_wkt("MULTILINESTRING((0 0,0 1,0 2,0 3,0 4))", PARSER_CHECK_NONE); + mline = (LWMLINE*)lwgeom_from_wkt("MULTILINESTRING((0 0,0 1,0 2,0 3,0 4))", LW_PARSER_CHECK_NONE); /* Clip in the middle, mid-range. */ c = lwmline_clip_to_ordinate_range(mline, 1, 1.5, 2.5); @@ -572,7 +572,7 @@ static void test_lwmline_clip(void) /* ** Set up the input line. Two-member case. */ - mline = (LWMLINE*)lwgeom_from_wkt("MULTILINESTRING((1 0,1 1,1 2,1 3,1 4), (0 0,0 1,0 2,0 3,0 4))", PARSER_CHECK_NONE); + mline = (LWMLINE*)lwgeom_from_wkt("MULTILINESTRING((1 0,1 1,1 2,1 3,1 4), (0 0,0 1,0 2,0 3,0 4))", LW_PARSER_CHECK_NONE); /* Clip off the top. */ c = lwmline_clip_to_ordinate_range(mline, 1, 3.5, 5.5); @@ -587,7 +587,7 @@ static void test_lwmline_clip(void) /* ** Set up staggered input line to create multi-type output. */ - mline = (LWMLINE*)lwgeom_from_wkt("MULTILINESTRING((1 0,1 -1,1 -2,1 -3,1 -4), (0 0,0 1,0 2,0 3,0 4))", PARSER_CHECK_NONE); + mline = (LWMLINE*)lwgeom_from_wkt("MULTILINESTRING((1 0,1 -1,1 -2,1 -3,1 -4), (0 0,0 1,0 2,0 3,0 4))", LW_PARSER_CHECK_NONE); /* Clip from 0 upwards.. */ c = lwmline_clip_to_ordinate_range(mline, 1, 0.0, 2.5); @@ -602,7 +602,7 @@ static void test_lwmline_clip(void) /* ** Set up input line from MAC */ - line = (LWLINE*)lwgeom_from_wkt("LINESTRING(0 0 0 0,1 1 1 1,2 2 2 2,3 3 3 3,4 4 4 4,3 3 3 5,2 2 2 6,1 1 1 7,0 0 0 8)", PARSER_CHECK_NONE); + line = (LWLINE*)lwgeom_from_wkt("LINESTRING(0 0 0 0,1 1 1 1,2 2 2 2,3 3 3 3,4 4 4 4,3 3 3 5,2 2 2 6,1 1 1 7,0 0 0 8)", LW_PARSER_CHECK_NONE); /* Clip from 3 to 3.5 */ c = lwline_clip_to_ordinate_range(line, 2, 3.0, 3.5); @@ -738,35 +738,35 @@ static void test_geohash(void) LWMLINE *lwmline = NULL; char *geohash = NULL; - lwpoint = (LWPOINT*)lwgeom_from_wkt("POINT(23.0 25.2)", PARSER_CHECK_NONE); + lwpoint = (LWPOINT*)lwgeom_from_wkt("POINT(23.0 25.2)", LW_PARSER_CHECK_NONE); geohash = lwgeom_geohash((LWGEOM*)lwpoint,0); //printf("\ngeohash %s\n",geohash); CU_ASSERT_STRING_EQUAL(geohash, "ss2r77s0du7p2ewb8hmx"); lwpoint_free(lwpoint); lwfree(geohash); - lwpoint = (LWPOINT*)lwgeom_from_wkt("POINT(23.0 25.2 2.0)", PARSER_CHECK_NONE); + lwpoint = (LWPOINT*)lwgeom_from_wkt("POINT(23.0 25.2 2.0)", LW_PARSER_CHECK_NONE); geohash = lwgeom_geohash((LWGEOM*)lwpoint,0); //printf("geohash %s\n",geohash); CU_ASSERT_STRING_EQUAL(geohash, "ss2r77s0du7p2ewb8hmx"); lwpoint_free(lwpoint); lwfree(geohash); - lwline = (LWLINE*)lwgeom_from_wkt("LINESTRING(23.0 23.0,23.1 23.1)", PARSER_CHECK_NONE); + lwline = (LWLINE*)lwgeom_from_wkt("LINESTRING(23.0 23.0,23.1 23.1)", LW_PARSER_CHECK_NONE); geohash = lwgeom_geohash((LWGEOM*)lwline,0); //printf("geohash %s\n",geohash); CU_ASSERT_STRING_EQUAL(geohash, "ss0"); lwline_free(lwline); lwfree(geohash); - lwline = (LWLINE*)lwgeom_from_wkt("LINESTRING(23.0 23.0,23.001 23.001)", PARSER_CHECK_NONE); + lwline = (LWLINE*)lwgeom_from_wkt("LINESTRING(23.0 23.0,23.001 23.001)", LW_PARSER_CHECK_NONE); geohash = lwgeom_geohash((LWGEOM*)lwline,0); //printf("geohash %s\n",geohash); CU_ASSERT_STRING_EQUAL(geohash, "ss06g7"); lwline_free(lwline); lwfree(geohash); - lwmline = (LWMLINE*)lwgeom_from_wkt("MULTILINESTRING((23.0 23.0,23.1 23.1),(23.0 23.0,23.1 23.1))", PARSER_CHECK_NONE); + lwmline = (LWMLINE*)lwgeom_from_wkt("MULTILINESTRING((23.0 23.0,23.1 23.1),(23.0 23.0,23.1 23.1))", LW_PARSER_CHECK_NONE); geohash = lwgeom_geohash((LWGEOM*)lwmline,0); //printf("geohash %s\n",geohash); CU_ASSERT_STRING_EQUAL(geohash, "ss0"); @@ -781,27 +781,27 @@ static void test_isclosed(void) /* LINESTRING */ /* Not Closed on 2D */ - geom = lwgeom_from_wkt("LINESTRING(1 2,3 4)", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("LINESTRING(1 2,3 4)", LW_PARSER_CHECK_NONE); CU_ASSERT(!lwline_is_closed((LWLINE *) geom)); lwgeom_free(geom); /* Closed on 2D */ - geom = lwgeom_from_wkt("LINESTRING(1 2,3 4,1 2)", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("LINESTRING(1 2,3 4,1 2)", LW_PARSER_CHECK_NONE); CU_ASSERT(lwline_is_closed((LWLINE *) geom)); lwgeom_free(geom); /* Not closed on 3D */ - geom = lwgeom_from_wkt("LINESTRING(1 2 3,4 5 6)", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("LINESTRING(1 2 3,4 5 6)", LW_PARSER_CHECK_NONE); CU_ASSERT(!lwline_is_closed((LWLINE *) geom)); lwgeom_free(geom); /* Closed on 3D */ - geom = lwgeom_from_wkt("LINESTRING(1 2 3,4 5 6,1 2 3)", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("LINESTRING(1 2 3,4 5 6,1 2 3)", LW_PARSER_CHECK_NONE); CU_ASSERT(lwline_is_closed((LWLINE *) geom)); lwgeom_free(geom); /* Closed on 4D, even if M is not the same */ - geom = lwgeom_from_wkt("LINESTRING(1 2 3 4,5 6 7 8,1 2 3 0)", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("LINESTRING(1 2 3 4,5 6 7 8,1 2 3 0)", LW_PARSER_CHECK_NONE); CU_ASSERT(lwline_is_closed((LWLINE *) geom)); lwgeom_free(geom); @@ -809,27 +809,27 @@ static void test_isclosed(void) /* CIRCULARSTRING */ /* Not Closed on 2D */ - geom = lwgeom_from_wkt("CIRCULARSTRING(1 2,3 4,5 6)", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("CIRCULARSTRING(1 2,3 4,5 6)", LW_PARSER_CHECK_NONE); CU_ASSERT(!lwcircstring_is_closed((LWCIRCSTRING *) geom)); lwgeom_free(geom); /* Closed on 2D */ - geom = lwgeom_from_wkt("CIRCULARSTRING(1 2,3 4,1 2)", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("CIRCULARSTRING(1 2,3 4,1 2)", LW_PARSER_CHECK_NONE); CU_ASSERT(lwcircstring_is_closed((LWCIRCSTRING *) geom)); lwgeom_free(geom); /* Not closed on 3D */ - geom = lwgeom_from_wkt("CIRCULARSTRING(1 2 3,4 5 6,7 8 9)", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("CIRCULARSTRING(1 2 3,4 5 6,7 8 9)", LW_PARSER_CHECK_NONE); CU_ASSERT(!lwcircstring_is_closed((LWCIRCSTRING *) geom)); lwgeom_free(geom); /* Closed on 3D */ - geom = lwgeom_from_wkt("CIRCULARSTRING(1 2 3,4 5 6,1 2 3)", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("CIRCULARSTRING(1 2 3,4 5 6,1 2 3)", LW_PARSER_CHECK_NONE); CU_ASSERT(lwcircstring_is_closed((LWCIRCSTRING *) geom)); lwgeom_free(geom); /* Closed on 4D, even if M is not the same */ - geom = lwgeom_from_wkt("CIRCULARSTRING(1 2 3 4,5 6 7 8,1 2 3 0)", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("CIRCULARSTRING(1 2 3 4,5 6 7 8,1 2 3 0)", LW_PARSER_CHECK_NONE); CU_ASSERT(lwcircstring_is_closed((LWCIRCSTRING *) geom)); lwgeom_free(geom); @@ -837,43 +837,43 @@ static void test_isclosed(void) /* COMPOUNDCURVE */ /* Not Closed on 2D */ - geom = lwgeom_from_wkt("COMPOUNDCURVE(CIRCULARSTRING(1 2,3 4,1 2),(1 2,7 8,5 6))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("COMPOUNDCURVE(CIRCULARSTRING(1 2,3 4,1 2),(1 2,7 8,5 6))", LW_PARSER_CHECK_NONE); CU_ASSERT(!lwcompound_is_closed((LWCOMPOUND *) geom)); lwgeom_free(geom); - geom = lwgeom_from_wkt("COMPOUNDCURVE((1 2,3 4,1 2),CIRCULARSTRING(1 2,7 8,5 6))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("COMPOUNDCURVE((1 2,3 4,1 2),CIRCULARSTRING(1 2,7 8,5 6))", LW_PARSER_CHECK_NONE); CU_ASSERT(!lwcompound_is_closed((LWCOMPOUND *) geom)); lwgeom_free(geom); /* Closed on 2D */ - geom = lwgeom_from_wkt("COMPOUNDCURVE(CIRCULARSTRING(1 2,3 4,5 6), (5 6,7 8,1 2))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("COMPOUNDCURVE(CIRCULARSTRING(1 2,3 4,5 6), (5 6,7 8,1 2))", LW_PARSER_CHECK_NONE); CU_ASSERT(lwcompound_is_closed((LWCOMPOUND *) geom)); lwgeom_free(geom); - geom = lwgeom_from_wkt("COMPOUNDCURVE((1 2,3 4,5 6),CIRCULARSTRING(5 6,7 8,1 2))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("COMPOUNDCURVE((1 2,3 4,5 6),CIRCULARSTRING(5 6,7 8,1 2))", LW_PARSER_CHECK_NONE); CU_ASSERT(lwcompound_is_closed((LWCOMPOUND *) geom)); lwgeom_free(geom); /* Not Closed on 3D */ - geom = lwgeom_from_wkt("COMPOUNDCURVE(CIRCULARSTRING(1 2 3,4 5 6,1 2 3),(1 2 3,7 8 9,10 11 12))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("COMPOUNDCURVE(CIRCULARSTRING(1 2 3,4 5 6,1 2 3),(1 2 3,7 8 9,10 11 12))", LW_PARSER_CHECK_NONE); CU_ASSERT(!lwcompound_is_closed((LWCOMPOUND *) geom)); lwgeom_free(geom); - geom = lwgeom_from_wkt("COMPOUNDCURVE((1 2 3,4 5 6,1 2 3),CIRCULARSTRING(1 2 3,7 8 9,10 11 12))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("COMPOUNDCURVE((1 2 3,4 5 6,1 2 3),CIRCULARSTRING(1 2 3,7 8 9,10 11 12))", LW_PARSER_CHECK_NONE); CU_ASSERT(!lwcompound_is_closed((LWCOMPOUND *) geom)); lwgeom_free(geom); /* Closed on 3D */ - geom = lwgeom_from_wkt("COMPOUNDCURVE(CIRCULARSTRING(1 2 3,4 5 6,7 8 9),(7 8 9,10 11 12,1 2 3))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("COMPOUNDCURVE(CIRCULARSTRING(1 2 3,4 5 6,7 8 9),(7 8 9,10 11 12,1 2 3))", LW_PARSER_CHECK_NONE); CU_ASSERT(lwcompound_is_closed((LWCOMPOUND *) geom)); lwgeom_free(geom); - geom = lwgeom_from_wkt("COMPOUNDCURVE((1 2 3,4 5 6,7 8 9),CIRCULARSTRING(7 8 9,10 11 12,1 2 3))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("COMPOUNDCURVE((1 2 3,4 5 6,7 8 9),CIRCULARSTRING(7 8 9,10 11 12,1 2 3))", LW_PARSER_CHECK_NONE); CU_ASSERT(lwcompound_is_closed((LWCOMPOUND *) geom)); lwgeom_free(geom); /* Closed on 4D, even if M is not the same */ - geom = lwgeom_from_wkt("COMPOUNDCURVE((1 2 3 4,5 6 7 8,9 10 11 12),CIRCULARSTRING(9 10 11 12,13 14 15 16,1 2 3 0))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("COMPOUNDCURVE((1 2 3 4,5 6 7 8,9 10 11 12),CIRCULARSTRING(9 10 11 12,13 14 15 16,1 2 3 0))", LW_PARSER_CHECK_NONE); CU_ASSERT(lwcompound_is_closed((LWCOMPOUND *) geom)); lwgeom_free(geom); } diff --git a/liblwgeom/cunit/cu_geodetic.c b/liblwgeom/cunit/cu_geodetic.c index 4a6ea7472..94d348e96 100644 --- a/liblwgeom/cunit/cu_geodetic.c +++ b/liblwgeom/cunit/cu_geodetic.c @@ -151,7 +151,7 @@ static void test_gserialized_get_gbox_geocentric(void) printf("\n\n------------\n"); printf("%s\n", gbox_data[i]); #endif - lwg = lwgeom_from_wkt(gbox_data[i], PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt(gbox_data[i], LW_PARSER_CHECK_NONE); FLAGS_SET_GEODETIC(lwg->flags, 1); gbox_geocentric_slow = LW_FALSE; lwgeom_calculate_gbox(lwg, &gbox); @@ -183,7 +183,7 @@ static LWGEOM* lwgeom_over_gserialized(char *wkt) LWGEOM *lwg; GSERIALIZED *g; - lwg = lwgeom_from_wkt(wkt, PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt(wkt, LW_PARSER_CHECK_NONE); g = gserialized_from_lwgeom(lwg, 1, 0); lwgeom_free(lwg); return lwgeom_from_gserialized(g); @@ -464,7 +464,7 @@ static LWGEOM* lwgeom_over_gserialized(char *wkt, GSERIALIZED **g) { LWGEOM *lwg; - lwg = lwgeom_from_wkt(wkt, PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt(wkt, LW_PARSER_CHECK_NONE); FLAGS_SET_GEODETIC(lwg->flags, 1); *g = gserialized_from_lwgeom(lwg, 1, 0); lwgeom_free(lwg); @@ -565,7 +565,7 @@ static void test_gserialized_from_lwgeom(void) uint32 type; double *inspect; /* To poke right into the blob. */ - geom = lwgeom_from_wkt("POINT(0 0.2)", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("POINT(0 0.2)", LW_PARSER_CHECK_NONE); FLAGS_SET_GEODETIC(geom->flags, 1); g = gserialized_from_lwgeom(geom, 1, 0); type = gserialized_get_type(g); @@ -575,7 +575,7 @@ static void test_gserialized_from_lwgeom(void) lwgeom_free(geom); lwfree(g); - geom = lwgeom_from_wkt("POLYGON((-1 -1, -1 2.5, 2 2, 2 -1, -1 -1), (0 0, 0 1, 1 1, 1 0, 0 0))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("POLYGON((-1 -1, -1 2.5, 2 2, 2 -1, -1 -1), (0 0, 0 1, 1 1, 1 0, 0 0))", LW_PARSER_CHECK_NONE); FLAGS_SET_GEODETIC(geom->flags, 1); g = gserialized_from_lwgeom(geom, 1, 0); type = gserialized_get_type(g); @@ -585,7 +585,7 @@ static void test_gserialized_from_lwgeom(void) lwgeom_free(geom); lwfree(g); - geom = lwgeom_from_wkt("MULTILINESTRING((0 0, 1 1),(0 0.1, 1 1))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("MULTILINESTRING((0 0, 1 1),(0 0.1, 1 1))", LW_PARSER_CHECK_NONE); FLAGS_SET_GEODETIC(geom->flags, 1); g = gserialized_from_lwgeom(geom, 1, 0); type = gserialized_get_type(g); @@ -606,7 +606,7 @@ static void test_ptarray_point_in_ring(void) int result; /* Simple containment case */ - lwg = lwgeom_from_wkt("POLYGON((1.0 1.0, 1.0 1.1, 1.1 1.1, 1.1 1.0, 1.0 1.0))", PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt("POLYGON((1.0 1.0, 1.0 1.1, 1.1 1.1, 1.1 1.0, 1.0 1.0))", LW_PARSER_CHECK_NONE); poly = (LWPOLY*)lwg; pt_to_test.x = 1.05; pt_to_test.y = 1.05; @@ -617,7 +617,7 @@ static void test_ptarray_point_in_ring(void) lwgeom_free(lwg); /* Simple noncontainment case */ - lwg = lwgeom_from_wkt("POLYGON((1.0 1.0, 1.0 1.1, 1.1 1.1, 1.1 1.0, 1.0 1.0))", PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt("POLYGON((1.0 1.0, 1.0 1.1, 1.1 1.1, 1.1 1.0, 1.0 1.0))", LW_PARSER_CHECK_NONE); poly = (LWPOLY*)lwg; pt_to_test.x = 1.05; pt_to_test.y = 1.15; @@ -628,7 +628,7 @@ static void test_ptarray_point_in_ring(void) lwgeom_free(lwg); /* Harder noncontainment case */ - lwg = lwgeom_from_wkt("POLYGON((1.0 1.0, 1.0 1.1, 1.1 1.1, 1.1 1.0, 1.0 1.0))", PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt("POLYGON((1.0 1.0, 1.0 1.1, 1.1 1.1, 1.1 1.0, 1.0 1.0))", LW_PARSER_CHECK_NONE); poly = (LWPOLY*)lwg; pt_to_test.x = 1.05; pt_to_test.y = 0.9; @@ -639,7 +639,7 @@ static void test_ptarray_point_in_ring(void) lwgeom_free(lwg); /* Harder containment case */ - lwg = lwgeom_from_wkt("POLYGON((0 0, 0 2, 1 2, 0 3, 2 3, 0 4, 3 5, 0 6, 6 10, 6 1, 0 0))", PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt("POLYGON((0 0, 0 2, 1 2, 0 3, 2 3, 0 4, 3 5, 0 6, 6 10, 6 1, 0 0))", LW_PARSER_CHECK_NONE); poly = (LWPOLY*)lwg; pt_to_test.x = 1.0; pt_to_test.y = 1.0; @@ -650,7 +650,7 @@ static void test_ptarray_point_in_ring(void) lwgeom_free(lwg); /* Point on ring at vertex case */ - lwg = lwgeom_from_wkt("POLYGON((1.0 1.0, 1.0 1.1, 1.1 1.1, 1.1 1.0, 1.0 1.0))", PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt("POLYGON((1.0 1.0, 1.0 1.1, 1.1 1.1, 1.1 1.0, 1.0 1.0))", LW_PARSER_CHECK_NONE); poly = (LWPOLY*)lwg; pt_to_test.x = 1.1; pt_to_test.y = 1.05; @@ -661,7 +661,7 @@ static void test_ptarray_point_in_ring(void) lwgeom_free(lwg); /* Point on ring at first vertex case */ - lwg = lwgeom_from_wkt("POLYGON((1.0 1.0, 1.0 1.1, 1.1 1.1, 1.1 1.0, 1.0 1.0))", PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt("POLYGON((1.0 1.0, 1.0 1.1, 1.1 1.1, 1.1 1.0, 1.0 1.0))", LW_PARSER_CHECK_NONE); poly = (LWPOLY*)lwg; pt_to_test.x = 1.0; pt_to_test.y = 1.0; @@ -672,7 +672,7 @@ static void test_ptarray_point_in_ring(void) lwgeom_free(lwg); /* Point on ring between vertexes case */ - lwg = lwgeom_from_wkt("POLYGON((1.0 1.0, 1.0 1.1, 1.1 1.1, 1.1 1.0, 1.0 1.0))", PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt("POLYGON((1.0 1.0, 1.0 1.1, 1.1 1.1, 1.1 1.0, 1.0 1.0))", LW_PARSER_CHECK_NONE); poly = (LWPOLY*)lwg; pt_to_test.x = 1.0; pt_to_test.y = 1.1; @@ -683,7 +683,7 @@ static void test_ptarray_point_in_ring(void) lwgeom_free(lwg); /* Co-linear crossing case for point-in-polygon test, should return LW_TRUE */ - lwg = lwgeom_from_wkt("POLYGON((1.0 1.0, 1.0 1.1, 1.1 1.1, 1.1 1.2, 1.2 1.2, 1.2 1.0, 1.0 1.0))", PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt("POLYGON((1.0 1.0, 1.0 1.1, 1.1 1.1, 1.1 1.2, 1.2 1.2, 1.2 1.0, 1.0 1.0))", LW_PARSER_CHECK_NONE); poly = (LWPOLY*)lwg; pt_to_test.x = 1.1; pt_to_test.y = 1.05; @@ -694,8 +694,8 @@ static void test_ptarray_point_in_ring(void) lwgeom_free(lwg); /* Grazing case for point-in-polygon test, should return LW_FALSE */ - /* lwg = lwgeom_from_wkt("POLYGON((2.0 3.0, 2.0 0.0, 1.0 1.0, 2.0 3.0))", PARSER_CHECK_NONE); */ - lwg = lwgeom_from_wkt("POLYGON((1.0 1.0, 1.0 2.0, 1.5 1.5, 1.0 1.0))", PARSER_CHECK_NONE); + /* lwg = lwgeom_from_wkt("POLYGON((2.0 3.0, 2.0 0.0, 1.0 1.0, 2.0 3.0))", LW_PARSER_CHECK_NONE); */ + lwg = lwgeom_from_wkt("POLYGON((1.0 1.0, 1.0 2.0, 1.5 1.5, 1.0 1.0))", LW_PARSER_CHECK_NONE); poly = (LWPOLY*)lwg; pt_to_test.x = 1.5; pt_to_test.y = 1.0; @@ -706,7 +706,7 @@ static void test_ptarray_point_in_ring(void) lwgeom_free(lwg); /* Grazing case at first point for point-in-polygon test, should return LW_FALSE */ - lwg = lwgeom_from_wkt("POLYGON((1.0 1.0, 2.0 3.0, 2.0 0.0, 1.0 1.0))", PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt("POLYGON((1.0 1.0, 2.0 3.0, 2.0 0.0, 1.0 1.0))", LW_PARSER_CHECK_NONE); poly = (LWPOLY*)lwg; pt_to_test.x = 1.0; pt_to_test.y = 0.0; @@ -717,7 +717,7 @@ static void test_ptarray_point_in_ring(void) lwgeom_free(lwg); /* Point on vertex of ring */ - lwg = lwgeom_from_wkt("POLYGON((-9 50,51 -11,-10 50,-9 50))", PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt("POLYGON((-9 50,51 -11,-10 50,-9 50))", LW_PARSER_CHECK_NONE); poly = (LWPOLY*)lwg; pt_to_test.x = -10.0; pt_to_test.y = 50.0; @@ -729,7 +729,7 @@ static void test_ptarray_point_in_ring(void) #if 0 /* Small polygon and huge distance between outside point and close-but-not-quite-inside point. Should return LW_FALSE. Pretty degenerate case. */ - lwg = lwgeom_from_wkt("0103000020E61000000100000025000000ACAD6F91DDB65EC03F84A86D57264540CCABC279DDB65EC0FCE6926B57264540B6DEAA62DDB65EC0A79F6B63572645402E0BE84CDDB65EC065677155572645405D0B1D39DDB65EC0316310425726454082B5DB27DDB65EC060A4E12957264540798BB619DDB65EC0C393A10D57264540D4BC160FDDB65EC0BD0320EE56264540D7AC4E08DDB65EC096C862CC56264540AFD29205DDB65EC02A1F68A956264540363AFA06DDB65EC0722E418656264540B63A780CDDB65EC06E9B0064562645409614E215DDB65EC0E09DA84356264540FF71EF22DDB65EC0B48145265626454036033F33DDB65EC081B8A60C5626454066FB4546DDB65EC08A47A6F7552645409061785BDDB65EC0F05AE0E755264540D4B63772DDB65EC05C86CEDD55264540D2E4C689DDB65EC09B6EBFD95526454082E573A1DDB65EC0C90BD5DB552645401ABE85B8DDB65EC06692FCE35526454039844ECEDDB65EC04D8AF6F155264540928319E2DDB65EC0AD8D570556264540D31055F3DDB65EC02D618F1D56264540343B7A01DEB65EC0EB70CF3956264540920A1A0CDEB65EC03B00515956264540911BE212DEB65EC0E43A0E7B56264540E3F69D15DEB65EC017E4089E562645408D903614DEB65EC0F0D42FC1562645402191B80EDEB65EC0586870E35626454012B84E05DEB65EC09166C80357264540215B41F8DDB65EC08F832B21572645408392F7E7DDB65EC01138C13A57264540F999F0D4DDB65EC0E4A9C14F57264540AC3FB8BFDDB65EC0EED6875F57264540D3DCFEA8DDB65EC04F6C996957264540ACAD6F91DDB65EC03F84A86D57264540", PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt("0103000020E61000000100000025000000ACAD6F91DDB65EC03F84A86D57264540CCABC279DDB65EC0FCE6926B57264540B6DEAA62DDB65EC0A79F6B63572645402E0BE84CDDB65EC065677155572645405D0B1D39DDB65EC0316310425726454082B5DB27DDB65EC060A4E12957264540798BB619DDB65EC0C393A10D57264540D4BC160FDDB65EC0BD0320EE56264540D7AC4E08DDB65EC096C862CC56264540AFD29205DDB65EC02A1F68A956264540363AFA06DDB65EC0722E418656264540B63A780CDDB65EC06E9B0064562645409614E215DDB65EC0E09DA84356264540FF71EF22DDB65EC0B48145265626454036033F33DDB65EC081B8A60C5626454066FB4546DDB65EC08A47A6F7552645409061785BDDB65EC0F05AE0E755264540D4B63772DDB65EC05C86CEDD55264540D2E4C689DDB65EC09B6EBFD95526454082E573A1DDB65EC0C90BD5DB552645401ABE85B8DDB65EC06692FCE35526454039844ECEDDB65EC04D8AF6F155264540928319E2DDB65EC0AD8D570556264540D31055F3DDB65EC02D618F1D56264540343B7A01DEB65EC0EB70CF3956264540920A1A0CDEB65EC03B00515956264540911BE212DEB65EC0E43A0E7B56264540E3F69D15DEB65EC017E4089E562645408D903614DEB65EC0F0D42FC1562645402191B80EDEB65EC0586870E35626454012B84E05DEB65EC09166C80357264540215B41F8DDB65EC08F832B21572645408392F7E7DDB65EC01138C13A57264540F999F0D4DDB65EC0E4A9C14F57264540AC3FB8BFDDB65EC0EED6875F57264540D3DCFEA8DDB65EC04F6C996957264540ACAD6F91DDB65EC03F84A86D57264540", LW_PARSER_CHECK_NONE); poly = (LWPOLY*)lwg; pt_to_test.x = -122.819436560680316; pt_to_test.y = 42.2702301207017328; @@ -749,7 +749,7 @@ static void test_lwpoly_covers_point2d(void) POINT2D pt_to_test; int result; - lwg = lwgeom_from_wkt("POLYGON((-9 50,51 -11,-10 50,-9 50))", PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt("POLYGON((-9 50,51 -11,-10 50,-9 50))", LW_PARSER_CHECK_NONE); poly = (LWPOLY*)lwg; pt_to_test.x = -10.0; pt_to_test.y = 50.0; @@ -758,7 +758,7 @@ static void test_lwpoly_covers_point2d(void) lwgeom_free(lwg); /* Great big ring */ - lwg = lwgeom_from_wkt("POLYGON((-40.0 52.0, 102.0 -6.0, -67.0 -29.0, -40.0 52.0))", PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt("POLYGON((-40.0 52.0, 102.0 -6.0, -67.0 -29.0, -40.0 52.0))", LW_PARSER_CHECK_NONE); poly = (LWPOLY*)lwg; pt_to_test.x = 4.0; pt_to_test.y = 11.0; @@ -784,63 +784,63 @@ static void test_lwgeom_distance_sphere(void) gbox2.flags = gflags(0, 0, 1); /* Line/line distance, 1 degree apart */ - lwg1 = lwgeom_from_wkt("LINESTRING(-30 10, -20 5, -10 3, 0 1)", PARSER_CHECK_NONE); - lwg2 = lwgeom_from_wkt("LINESTRING(-10 -5, -5 0, 5 0, 10 -5)", PARSER_CHECK_NONE); + lwg1 = lwgeom_from_wkt("LINESTRING(-30 10, -20 5, -10 3, 0 1)", LW_PARSER_CHECK_NONE); + lwg2 = lwgeom_from_wkt("LINESTRING(-10 -5, -5 0, 5 0, 10 -5)", LW_PARSER_CHECK_NONE); d = lwgeom_distance_spheroid(lwg1, lwg2, &s, 0.0); CU_ASSERT_DOUBLE_EQUAL(d, s.radius * M_PI / 180.0, 0.00001); lwgeom_free(lwg1); lwgeom_free(lwg2); /* Line/line distance, crossing, 0.0 apart */ - lwg1 = lwgeom_from_wkt("LINESTRING(-30 10, -20 5, -10 3, 0 1)", PARSER_CHECK_NONE); - lwg2 = lwgeom_from_wkt("LINESTRING(-10 -5, -5 20, 5 0, 10 -5)", PARSER_CHECK_NONE); + lwg1 = lwgeom_from_wkt("LINESTRING(-30 10, -20 5, -10 3, 0 1)", LW_PARSER_CHECK_NONE); + lwg2 = lwgeom_from_wkt("LINESTRING(-10 -5, -5 20, 5 0, 10 -5)", LW_PARSER_CHECK_NONE); d = lwgeom_distance_spheroid(lwg1, lwg2, &s, 0.0); CU_ASSERT_DOUBLE_EQUAL(d, 0.0, 0.00001); lwgeom_free(lwg1); lwgeom_free(lwg2); /* Line/point distance, 1 degree apart */ - lwg1 = lwgeom_from_wkt("POINT(-4 1)", PARSER_CHECK_NONE); - lwg2 = lwgeom_from_wkt("LINESTRING(-10 -5, -5 0, 5 0, 10 -5)", PARSER_CHECK_NONE); + lwg1 = lwgeom_from_wkt("POINT(-4 1)", LW_PARSER_CHECK_NONE); + lwg2 = lwgeom_from_wkt("LINESTRING(-10 -5, -5 0, 5 0, 10 -5)", LW_PARSER_CHECK_NONE); d = lwgeom_distance_spheroid(lwg1, lwg2, &s, 0.0); CU_ASSERT_DOUBLE_EQUAL(d, s.radius * M_PI / 180.0, 0.00001); lwgeom_free(lwg1); lwgeom_free(lwg2); - lwg1 = lwgeom_from_wkt("POINT(-4 1)", PARSER_CHECK_NONE); - lwg2 = lwgeom_from_wkt("POINT(-4 -1)", PARSER_CHECK_NONE); + lwg1 = lwgeom_from_wkt("POINT(-4 1)", LW_PARSER_CHECK_NONE); + lwg2 = lwgeom_from_wkt("POINT(-4 -1)", LW_PARSER_CHECK_NONE); d = lwgeom_distance_spheroid(lwg1, lwg2, &s, 0.0); CU_ASSERT_DOUBLE_EQUAL(d, s.radius * M_PI / 90.0, 0.00001); lwgeom_free(lwg1); lwgeom_free(lwg2); /* Poly/point distance, point inside polygon, 0.0 apart */ - lwg1 = lwgeom_from_wkt("POLYGON((-4 1, -3 5, 1 2, 1.5 -5, -4 1))", PARSER_CHECK_NONE); - lwg2 = lwgeom_from_wkt("POINT(-1 -1)", PARSER_CHECK_NONE); + lwg1 = lwgeom_from_wkt("POLYGON((-4 1, -3 5, 1 2, 1.5 -5, -4 1))", LW_PARSER_CHECK_NONE); + lwg2 = lwgeom_from_wkt("POINT(-1 -1)", LW_PARSER_CHECK_NONE); d = lwgeom_distance_spheroid(lwg1, lwg2, &s, 0.0); CU_ASSERT_DOUBLE_EQUAL(d, 0.0, 0.00001); lwgeom_free(lwg1); lwgeom_free(lwg2); /* Poly/point distance, point inside polygon hole, 1 degree apart */ - lwg1 = lwgeom_from_wkt("POLYGON((-4 -4, -4 4, 4 4, 4 -4, -4 -4), (-2 -2, -2 2, 2 2, 2 -2, -2 -2))", PARSER_CHECK_NONE); - lwg2 = lwgeom_from_wkt("POINT(-1 -1)", PARSER_CHECK_NONE); + lwg1 = lwgeom_from_wkt("POLYGON((-4 -4, -4 4, 4 4, 4 -4, -4 -4), (-2 -2, -2 2, 2 2, 2 -2, -2 -2))", LW_PARSER_CHECK_NONE); + lwg2 = lwgeom_from_wkt("POINT(-1 -1)", LW_PARSER_CHECK_NONE); d = lwgeom_distance_spheroid(lwg1, lwg2, &s, 0.0); CU_ASSERT_DOUBLE_EQUAL(d, 111178.142466, 0.1); lwgeom_free(lwg1); lwgeom_free(lwg2); /* Poly/point distance, point on hole boundary, 0.0 apart */ - lwg1 = lwgeom_from_wkt("POLYGON((-4 -4, -4 4, 4 4, 4 -4, -4 -4), (-2 -2, -2 2, 2 2, 2 -2, -2 -2))", PARSER_CHECK_NONE); - lwg2 = lwgeom_from_wkt("POINT(2 2)", PARSER_CHECK_NONE); + lwg1 = lwgeom_from_wkt("POLYGON((-4 -4, -4 4, 4 4, 4 -4, -4 -4), (-2 -2, -2 2, 2 2, 2 -2, -2 -2))", LW_PARSER_CHECK_NONE); + lwg2 = lwgeom_from_wkt("POINT(2 2)", LW_PARSER_CHECK_NONE); d = lwgeom_distance_spheroid(lwg1, lwg2, &s, 0.0); CU_ASSERT_DOUBLE_EQUAL(d, 0.0, 0.00001); lwgeom_free(lwg1); lwgeom_free(lwg2); /* Medford test case #1 */ - lwg1 = lwgeom_from_hexwkb("0105000020E610000001000000010200000002000000EF7B8779C7BD5EC0FD20D94B852845400E539C62B9BD5EC0F0A5BE767C284540", PARSER_CHECK_NONE); - lwg2 = lwgeom_from_hexwkb("0106000020E61000000100000001030000000100000007000000280EC3FB8CCA5EC0A5CDC747233C45402787C8F58CCA5EC0659EA2761E3C45400CED58DF8FCA5EC0C37FAE6E1E3C4540AE97B8E08FCA5EC00346F58B1F3C4540250359FD8ECA5EC05460628E1F3C45403738F4018FCA5EC05DC84042233C4540280EC3FB8CCA5EC0A5CDC747233C4540", PARSER_CHECK_NONE); + lwg1 = lwgeom_from_hexwkb("0105000020E610000001000000010200000002000000EF7B8779C7BD5EC0FD20D94B852845400E539C62B9BD5EC0F0A5BE767C284540", LW_PARSER_CHECK_NONE); + lwg2 = lwgeom_from_hexwkb("0106000020E61000000100000001030000000100000007000000280EC3FB8CCA5EC0A5CDC747233C45402787C8F58CCA5EC0659EA2761E3C45400CED58DF8FCA5EC0C37FAE6E1E3C4540AE97B8E08FCA5EC00346F58B1F3C4540250359FD8ECA5EC05460628E1F3C45403738F4018FCA5EC05DC84042233C4540280EC3FB8CCA5EC0A5CDC747233C4540", LW_PARSER_CHECK_NONE); d = lwgeom_distance_spheroid(lwg1, lwg2, &s, 0.0); CU_ASSERT_DOUBLE_EQUAL(d, 23630.8003, 0.1); lwgeom_free(lwg1); @@ -902,7 +902,7 @@ static void test_spheroid_area(void) gbox.flags = gflags(0, 0, 1); /* Medford lot test polygon */ - lwg = lwgeom_from_wkt("POLYGON((-122.848227067007 42.5007249610493,-122.848309475585 42.5007179884263,-122.848327688675 42.500835880696,-122.848245279942 42.5008428533324,-122.848227067007 42.5007249610493))", PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt("POLYGON((-122.848227067007 42.5007249610493,-122.848309475585 42.5007179884263,-122.848327688675 42.500835880696,-122.848245279942 42.5008428533324,-122.848227067007 42.5007249610493))", LW_PARSER_CHECK_NONE); lwgeom_calculate_gbox_geodetic(lwg, &gbox); a1 = lwgeom_area_sphere(lwg, &s); a2 = lwgeom_area_spheroid(lwg, &s); @@ -912,7 +912,7 @@ static void test_spheroid_area(void) lwgeom_free(lwg); /* Big-ass polygon */ - lwg = lwgeom_from_wkt("POLYGON((-2 3, -2 4, -1 4, -1 3, -2 3))", PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt("POLYGON((-2 3, -2 4, -1 4, -1 3, -2 3))", LW_PARSER_CHECK_NONE); lwgeom_calculate_gbox_geodetic(lwg, &gbox); a1 = lwgeom_area_sphere(lwg, &s); a2 = lwgeom_area_spheroid(lwg, &s); @@ -922,7 +922,7 @@ static void test_spheroid_area(void) lwgeom_free(lwg); /* One-degree square */ - lwg = lwgeom_from_wkt("POLYGON((8.5 2,8.5 1,9.5 1,9.5 2,8.5 2))", PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt("POLYGON((8.5 2,8.5 1,9.5 1,9.5 2,8.5 2))", LW_PARSER_CHECK_NONE); lwgeom_calculate_gbox_geodetic(lwg, &gbox); a1 = lwgeom_area_sphere(lwg, &s); a2 = lwgeom_area_spheroid(lwg, &s); @@ -932,7 +932,7 @@ static void test_spheroid_area(void) lwgeom_free(lwg); /* One-degree square *near* dateline */ - lwg = lwgeom_from_wkt("POLYGON((179.5 2,179.5 1,178.5 1,178.5 2,179.5 2))", PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt("POLYGON((179.5 2,179.5 1,178.5 1,178.5 2,179.5 2))", LW_PARSER_CHECK_NONE); lwgeom_calculate_gbox_geodetic(lwg, &gbox); a1 = lwgeom_area_sphere(lwg, &s); a2 = lwgeom_area_spheroid(lwg, &s); @@ -942,7 +942,7 @@ static void test_spheroid_area(void) lwgeom_free(lwg); /* One-degree square *across* dateline */ - lwg = lwgeom_from_wkt("POLYGON((179.5 2,179.5 1,-179.5 1,-179.5 2,179.5 2))", PARSER_CHECK_NONE); + lwg = lwgeom_from_wkt("POLYGON((179.5 2,179.5 1,-179.5 1,-179.5 2,179.5 2))", LW_PARSER_CHECK_NONE); lwgeom_calculate_gbox_geodetic(lwg, &gbox); a1 = lwgeom_area_sphere(lwg, &s); a2 = lwgeom_area_spheroid(lwg, &s); diff --git a/liblwgeom/cunit/cu_geos.c b/liblwgeom/cunit/cu_geos.c index 9a4201276..8e37c7a13 100644 --- a/liblwgeom/cunit/cu_geos.c +++ b/liblwgeom/cunit/cu_geos.c @@ -45,7 +45,7 @@ static void test_geos_noop(void) char *out_ewkt; in_ewkt = ewkt[i]; - geom_in = lwgeom_from_wkt(in_ewkt, PARSER_CHECK_NONE); + geom_in = lwgeom_from_wkt(in_ewkt, LW_PARSER_CHECK_NONE); geom_out = lwgeom_geos_noop(geom_in); if ( ! geom_out ) { fprintf(stderr, "\nNull return from lwgeom_geos_noop with wkt: %s\n", in_ewkt); diff --git a/liblwgeom/cunit/cu_homogenize.c b/liblwgeom/cunit/cu_homogenize.c index 93df25575..db18ee62b 100644 --- a/liblwgeom/cunit/cu_homogenize.c +++ b/liblwgeom/cunit/cu_homogenize.c @@ -23,7 +23,7 @@ static void do_geom_test(char * in, char * out) LWGEOM *g, *h; char *tmp; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_homogenize(g); tmp = lwgeom_to_ewkt(h); if (strcmp(tmp, out)) @@ -42,7 +42,7 @@ static void do_coll_test(char * in, char * out) LWGEOM *g, *h; char *tmp; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwcollection_homogenize((LWCOLLECTION *) g); tmp = lwgeom_to_ewkt(h); if (strcmp(tmp, out)) diff --git a/liblwgeom/cunit/cu_in_wkb.c b/liblwgeom/cunit/cu_in_wkb.c index e6e60cdb1..9fab591e2 100644 --- a/liblwgeom/cunit/cu_in_wkb.c +++ b/liblwgeom/cunit/cu_in_wkb.c @@ -60,7 +60,7 @@ static void cu_wkb_in(char *wkt) if ( hex_b ) free(hex_b); /* Turn WKT into geom */ - lwgeom_parse_wkt(&pr, wkt, PARSER_CHECK_NONE); + lwgeom_parse_wkt(&pr, wkt, LW_PARSER_CHECK_NONE); if ( pr.errcode ) { printf("ERROR: %s\n", pr.message); @@ -75,7 +75,7 @@ static void cu_wkb_in(char *wkt) wkb_a = lwgeom_to_wkb(g_a, WKB_NDR | WKB_EXTENDED, &wkb_size_a); /* Turn WKB back into geom */ - g_b = lwgeom_from_wkb(wkb_a, wkb_size_a, PARSER_CHECK_NONE); + g_b = lwgeom_from_wkb(wkb_a, wkb_size_a, LW_PARSER_CHECK_NONE); /* Turn geom to WKB again */ wkb_b = lwgeom_to_wkb(g_b, WKB_NDR | WKB_EXTENDED, &wkb_size_b); diff --git a/liblwgeom/cunit/cu_in_wkt.c b/liblwgeom/cunit/cu_in_wkt.c index dee7b210b..2bb1a4982 100644 --- a/liblwgeom/cunit/cu_in_wkt.c +++ b/liblwgeom/cunit/cu_in_wkt.c @@ -315,7 +315,7 @@ static void test_wkt_in_errlocation(void) wkt = "LINESTRING((0 0 0,1 1)"; lwgeom_parser_result_init(&p); - rv = lwgeom_parse_wkt(&p, wkt, PARSER_CHECK_ALL); + rv = lwgeom_parse_wkt(&p, wkt, LW_PARSER_CHECK_ALL); CU_ASSERT_EQUAL(12,p.errlocation); lwgeom_parser_result_free(&p); diff --git a/liblwgeom/cunit/cu_libgeom.c b/liblwgeom/cunit/cu_libgeom.c index 65fb4ef18..18d672a62 100644 --- a/liblwgeom/cunit/cu_libgeom.c +++ b/liblwgeom/cunit/cu_libgeom.c @@ -131,37 +131,37 @@ static void test_gserialized_from_lwgeom_size(void) LWGEOM *g; size_t size = 0; - g = lwgeom_from_wkt("POINT(0 0)", PARSER_CHECK_NONE); + g = lwgeom_from_wkt("POINT(0 0)", LW_PARSER_CHECK_NONE); size = gserialized_from_lwgeom_size(g); CU_ASSERT_EQUAL( size, 32 ); lwgeom_free(g); - g = lwgeom_from_wkt("POINT(0 0 0)", PARSER_CHECK_NONE); + g = lwgeom_from_wkt("POINT(0 0 0)", LW_PARSER_CHECK_NONE); size = gserialized_from_lwgeom_size(g); CU_ASSERT_EQUAL( size, 40 ); lwgeom_free(g); - g = lwgeom_from_wkt("MULTIPOINT(0 0 0, 1 1 1)", PARSER_CHECK_NONE); + g = lwgeom_from_wkt("MULTIPOINT(0 0 0, 1 1 1)", LW_PARSER_CHECK_NONE); size = gserialized_from_lwgeom_size(g); CU_ASSERT_EQUAL( size, 80 ); lwgeom_free(g); - g = lwgeom_from_wkt("LINESTRING(0 0, 1 1)", PARSER_CHECK_NONE); + g = lwgeom_from_wkt("LINESTRING(0 0, 1 1)", LW_PARSER_CHECK_NONE); size = gserialized_from_lwgeom_size(g); CU_ASSERT_EQUAL( size, 48 ); lwgeom_free(g); - g = lwgeom_from_wkt("MULTILINESTRING((0 0, 1 1),(0 0, 1 1))", PARSER_CHECK_NONE); + g = lwgeom_from_wkt("MULTILINESTRING((0 0, 1 1),(0 0, 1 1))", LW_PARSER_CHECK_NONE); size = gserialized_from_lwgeom_size(g); CU_ASSERT_EQUAL( size, 96 ); lwgeom_free(g); - g = lwgeom_from_wkt("POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))", PARSER_CHECK_NONE); + g = lwgeom_from_wkt("POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))", LW_PARSER_CHECK_NONE); size = gserialized_from_lwgeom_size(g); CU_ASSERT_EQUAL( size, 104 ); lwgeom_free(g); - g = lwgeom_from_wkt("POLYGON((-1 -1, -1 2, 2 2, 2 -1, -1 -1), (0 0, 0 1, 1 1, 1 0, 0 0))", PARSER_CHECK_NONE); + g = lwgeom_from_wkt("POLYGON((-1 -1, -1 2, 2 2, 2 -1, -1 -1), (0 0, 0 1, 1 1, 1 0, 0 0))", LW_PARSER_CHECK_NONE); size = gserialized_from_lwgeom_size(g); CU_ASSERT_EQUAL( size, 184 ); lwgeom_free(g); @@ -214,7 +214,7 @@ static void test_lwgeom_from_gserialized(void) for ( i = 0; i < 13; i++ ) { in_ewkt = ewkt[i]; - geom = lwgeom_from_wkt(in_ewkt, PARSER_CHECK_NONE); + geom = lwgeom_from_wkt(in_ewkt, LW_PARSER_CHECK_NONE); g = gserialized_from_lwgeom(geom, 0, 0); lwgeom_free(geom); geom = lwgeom_from_gserialized(g); @@ -277,15 +277,15 @@ static void test_lwgeom_count_vertices(void) { LWGEOM *geom; - geom = lwgeom_from_wkt("MULTIPOINT(-1 -1,-1 2.5,2 2,2 -1)", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("MULTIPOINT(-1 -1,-1 2.5,2 2,2 -1)", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(lwgeom_count_vertices(geom),4); lwgeom_free(geom); - geom = lwgeom_from_wkt("SRID=1;MULTILINESTRING((-1 -131,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("SRID=1;MULTILINESTRING((-1 -131,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1),(-1 -1,-1 2.5,2 2,2 -1))", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(lwgeom_count_vertices(geom),16); lwgeom_free(geom); - geom = lwgeom_from_wkt("SRID=4326;MULTIPOLYGON(((-1 -1,-1 2.5,211 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5)),((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("SRID=4326;MULTIPOLYGON(((-1 -1,-1 2.5,211 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5)),((-1 -1,-1 2.5,2 2,2 -1,-1 -1),(0 0,0 1,1 1,1 0,0 0),(-0.5 -0.5,-0.5 -0.4,-0.4 -0.4,-0.4 -0.5,-0.5 -0.5)))", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(lwgeom_count_vertices(geom),30); lwgeom_free(geom); @@ -297,7 +297,7 @@ static void test_on_gser_lwgeom_count_vertices(void) GSERIALIZED *g_ser1; size_t ret_size; - lwgeom = lwgeom_from_wkt("MULTIPOINT(-1 -1,-1 2.5,2 2,2 -1,1 1,2 2,4 5)", PARSER_CHECK_NONE); + lwgeom = lwgeom_from_wkt("MULTIPOINT(-1 -1,-1 2.5,2 2,2 -1,1 1,2 2,4 5)", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(lwgeom_count_vertices(lwgeom),7); g_ser1 = gserialized_from_lwgeom(lwgeom, 1, &ret_size); lwgeom_free(lwgeom); @@ -321,7 +321,7 @@ static void test_lwcollection_extract(void) LWGEOM *geom; LWCOLLECTION *col; - geom = lwgeom_from_wkt("GEOMETRYCOLLECTION(POINT(0 0))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("GEOMETRYCOLLECTION(POINT(0 0))", LW_PARSER_CHECK_NONE); col = lwcollection_extract((LWCOLLECTION*)geom, 1); CU_ASSERT_EQUAL(TYPE_GETTYPE(col->type), MULTIPOINTTYPE); @@ -338,22 +338,22 @@ static void test_lwgeom_free(void) LWGEOM *geom; /* Empty geometries don't seem to free properly (#370) */ - geom = lwgeom_from_wkt("GEOMETRYCOLLECTION EMPTY", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("GEOMETRYCOLLECTION EMPTY", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(geom->type, COLLECTIONTYPE); lwgeom_free(geom); /* Empty geometries don't seem to free properly (#370) */ - geom = lwgeom_from_wkt("POLYGON EMPTY", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("POLYGON EMPTY", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(geom->type, POLYGONTYPE); lwgeom_free(geom); /* Empty geometries don't seem to free properly (#370) */ - geom = lwgeom_from_wkt("LINESTRING EMPTY", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("LINESTRING EMPTY", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(geom->type, LINETYPE); lwgeom_free(geom); /* Empty geometries don't seem to free properly (#370) */ - geom = lwgeom_from_wkt("POINT EMPTY", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("POINT EMPTY", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(geom->type, POINTTYPE); lwgeom_free(geom); @@ -364,7 +364,7 @@ static void do_lwgeom_flip_coordinates(char *in, char *out) LWGEOM *g,*h; char * t; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_flip_coordinates(g); t = lwgeom_to_wkt(g, WKT_EXTENDED, 8, NULL); @@ -556,7 +556,7 @@ static void test_lwgeom_clone(void) char *out_ewkt; in_ewkt = ewkt[i]; - geom = lwgeom_from_wkt(in_ewkt, PARSER_CHECK_NONE); + geom = lwgeom_from_wkt(in_ewkt, LW_PARSER_CHECK_NONE); cloned = lwgeom_clone(geom); out_ewkt = lwgeom_to_ewkt(cloned); if (strcmp(in_ewkt, out_ewkt)) diff --git a/liblwgeom/cunit/cu_measures.c b/liblwgeom/cunit/cu_measures.c index 3bbca782f..fb74ea706 100644 --- a/liblwgeom/cunit/cu_measures.c +++ b/liblwgeom/cunit/cu_measures.c @@ -26,8 +26,8 @@ static void do_test_mindistance2d_tolerance(char *in1, char *in2, double expecte LWGEOM *lw2; double distance; - lw1 = lwgeom_from_wkt(in1, PARSER_CHECK_NONE); - lw2 = lwgeom_from_wkt(in2, PARSER_CHECK_NONE); + lw1 = lwgeom_from_wkt(in1, LW_PARSER_CHECK_NONE); + lw2 = lwgeom_from_wkt(in2, LW_PARSER_CHECK_NONE); distance = lwgeom_mindistance2d_tolerance(lw1, lw2, 0.0); CU_ASSERT_EQUAL(distance, expected_res); @@ -87,7 +87,7 @@ static void test_rect_tree_contains_point(void) int boundary = 0; /* square */ - poly = (LWPOLY*)lwgeom_from_wkt("POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))", PARSER_CHECK_NONE); + poly = (LWPOLY*)lwgeom_from_wkt("POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))", LW_PARSER_CHECK_NONE); tree = rect_tree_new(poly->rings[0]); /* inside square */ @@ -108,7 +108,7 @@ static void test_rect_tree_contains_point(void) lwpoly_free(poly); /* ziggy zaggy horizontal saw tooth polygon */ - poly = (LWPOLY*)lwgeom_from_wkt("POLYGON((0 0, 1 3, 2 0, 3 3, 4 0, 4 5, 0 5, 0 0))", PARSER_CHECK_NONE); + poly = (LWPOLY*)lwgeom_from_wkt("POLYGON((0 0, 1 3, 2 0, 3 3, 4 0, 4 5, 0 5, 0 0))", LW_PARSER_CHECK_NONE); tree = rect_tree_new(poly->rings[0]); /* not in, left side */ @@ -164,7 +164,7 @@ static void test_rect_tree_contains_point(void) lwpoly_free(poly); /* ziggy zaggy vertical saw tooth polygon */ - poly = (LWPOLY*)lwgeom_from_wkt("POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))", PARSER_CHECK_NONE); + poly = (LWPOLY*)lwgeom_from_wkt("POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))", LW_PARSER_CHECK_NONE); tree = rect_tree_new(poly->rings[0]); /* not in, left side */ @@ -235,8 +235,8 @@ static void test_rect_tree_intersects_tree(void) int result; /* total overlap, A == B */ - poly1 = (LWPOLY*)lwgeom_from_wkt("POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))", PARSER_CHECK_NONE); - poly2 = (LWPOLY*)lwgeom_from_wkt("POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))", PARSER_CHECK_NONE); + poly1 = (LWPOLY*)lwgeom_from_wkt("POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))", LW_PARSER_CHECK_NONE); + poly2 = (LWPOLY*)lwgeom_from_wkt("POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))", LW_PARSER_CHECK_NONE); tree1 = rect_tree_new(poly1->rings[0]); tree2 = rect_tree_new(poly2->rings[0]); result = rect_tree_intersects_tree(tree1, tree2); @@ -247,8 +247,8 @@ static void test_rect_tree_intersects_tree(void) rect_tree_free(tree2); /* hiding between the tines of the comb */ - poly1 = (LWPOLY*)lwgeom_from_wkt("POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))", PARSER_CHECK_NONE); - poly2 = (LWPOLY*)lwgeom_from_wkt("POLYGON((0.3 0.7, 0.3 0.8, 0.4 0.8, 0.4 0.7, 0.3 0.7))", PARSER_CHECK_NONE); + poly1 = (LWPOLY*)lwgeom_from_wkt("POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))", LW_PARSER_CHECK_NONE); + poly2 = (LWPOLY*)lwgeom_from_wkt("POLYGON((0.3 0.7, 0.3 0.8, 0.4 0.8, 0.4 0.7, 0.3 0.7))", LW_PARSER_CHECK_NONE); tree1 = rect_tree_new(poly1->rings[0]); tree2 = rect_tree_new(poly2->rings[0]); result = rect_tree_intersects_tree(tree1, tree2); @@ -259,8 +259,8 @@ static void test_rect_tree_intersects_tree(void) rect_tree_free(tree2); /* between the tines, but with a corner overlapping */ - poly1 = (LWPOLY*)lwgeom_from_wkt("POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))", PARSER_CHECK_NONE); - poly2 = (LWPOLY*)lwgeom_from_wkt("POLYGON((0.3 0.7, 0.3 0.8, 0.4 0.8, 1.3 0.3, 0.3 0.7))", PARSER_CHECK_NONE); + poly1 = (LWPOLY*)lwgeom_from_wkt("POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))", LW_PARSER_CHECK_NONE); + poly2 = (LWPOLY*)lwgeom_from_wkt("POLYGON((0.3 0.7, 0.3 0.8, 0.4 0.8, 1.3 0.3, 0.3 0.7))", LW_PARSER_CHECK_NONE); tree1 = rect_tree_new(poly1->rings[0]); tree2 = rect_tree_new(poly2->rings[0]); result = rect_tree_intersects_tree(tree1, tree2); @@ -271,8 +271,8 @@ static void test_rect_tree_intersects_tree(void) rect_tree_free(tree2); /* Just touching the top left corner of the comb */ - poly1 = (LWPOLY*)lwgeom_from_wkt("POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))", PARSER_CHECK_NONE); - poly2 = (LWPOLY*)lwgeom_from_wkt("POLYGON((-1 5, 0 5, 0 7, -1 7, -1 5))", PARSER_CHECK_NONE); + poly1 = (LWPOLY*)lwgeom_from_wkt("POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))", LW_PARSER_CHECK_NONE); + poly2 = (LWPOLY*)lwgeom_from_wkt("POLYGON((-1 5, 0 5, 0 7, -1 7, -1 5))", LW_PARSER_CHECK_NONE); tree1 = rect_tree_new(poly1->rings[0]); tree2 = rect_tree_new(poly2->rings[0]); result = rect_tree_intersects_tree(tree1, tree2); @@ -288,7 +288,7 @@ static void test_rect_tree_intersects_tree(void) static void test_lwgeom_segmentize2d(void) { - LWGEOM *linein = lwgeom_from_wkt("LINESTRING(0 0,10 0)", PARSER_CHECK_NONE); + 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)"); diff --git a/liblwgeom/cunit/cu_misc.c b/liblwgeom/cunit/cu_misc.c index 3a814340a..9a3f2e89e 100644 --- a/liblwgeom/cunit/cu_misc.c +++ b/liblwgeom/cunit/cu_misc.c @@ -25,7 +25,7 @@ static void test_misc_force_2d(void) LWGEOM *geom2d; char *wkt_out; - geom = lwgeom_from_wkt("CIRCULARSTRINGM(-5 0 4,0 5 3,5 0 2,10 -5 1,15 0 0)", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("CIRCULARSTRINGM(-5 0 4,0 5 3,5 0 2,10 -5 1,15 0 0)", LW_PARSER_CHECK_NONE); geom2d = lwgeom_force_2d(geom); wkt_out = lwgeom_to_ewkt(geom2d); CU_ASSERT_STRING_EQUAL("CIRCULARSTRING(-5 0,0 5,5 0,10 -5,15 0)",wkt_out); @@ -33,7 +33,7 @@ static void test_misc_force_2d(void) lwgeom_free(geom2d); lwfree(wkt_out); - geom = lwgeom_from_wkt("GEOMETRYCOLLECTION(POINT(0 0 0),LINESTRING(1 1 1,2 2 2),POLYGON((0 0 1,0 1 1,1 1 1,1 0 1,0 0 1)),CURVEPOLYGON(CIRCULARSTRING(0 0 0,1 1 1,2 2 2,1 1 1,0 0 0)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("GEOMETRYCOLLECTION(POINT(0 0 0),LINESTRING(1 1 1,2 2 2),POLYGON((0 0 1,0 1 1,1 1 1,1 0 1,0 0 1)),CURVEPOLYGON(CIRCULARSTRING(0 0 0,1 1 1,2 2 2,1 1 1,0 0 0)))", LW_PARSER_CHECK_NONE); geom2d = lwgeom_force_2d(geom); wkt_out = lwgeom_to_ewkt(geom2d); CU_ASSERT_STRING_EQUAL("GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(1 1,2 2),POLYGON((0 0,0 1,1 1,1 0,0 0)),CURVEPOLYGON(CIRCULARSTRING(0 0,1 1,2 2,1 1,0 0)))",wkt_out); @@ -48,7 +48,7 @@ static void test_misc_simplify(void) LWGEOM *geom2d; char *wkt_out; - geom = lwgeom_from_wkt("LINESTRING(0 0,0 10,0 51,50 20,30 20,7 32)", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("LINESTRING(0 0,0 10,0 51,50 20,30 20,7 32)", LW_PARSER_CHECK_NONE); geom2d = lwgeom_simplify(geom,2); wkt_out = lwgeom_to_ewkt(geom2d); CU_ASSERT_STRING_EQUAL("LINESTRING(0 0,0 51,50 20,30 20,7 32)",wkt_out); @@ -56,7 +56,7 @@ static void test_misc_simplify(void) lwgeom_free(geom2d); lwfree(wkt_out); - geom = lwgeom_from_wkt("MULTILINESTRING((0 0,0 10,0 51,50 20,30 20,7 32))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("MULTILINESTRING((0 0,0 10,0 51,50 20,30 20,7 32))", LW_PARSER_CHECK_NONE); geom2d = lwgeom_simplify(geom,2); wkt_out = lwgeom_to_ewkt(geom2d); CU_ASSERT_STRING_EQUAL("MULTILINESTRING((0 0,0 51,50 20,30 20,7 32))",wkt_out); @@ -70,28 +70,28 @@ static void test_misc_count_vertices(void) LWGEOM *geom; int count; - geom = lwgeom_from_wkt("GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,1 1),POLYGON((0 0,0 1,1 0,0 0)),CIRCULARSTRING(0 0,0 1,1 1),CURVEPOLYGON(CIRCULARSTRING(0 0,0 1,1 1)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,1 1),POLYGON((0 0,0 1,1 0,0 0)),CIRCULARSTRING(0 0,0 1,1 1),CURVEPOLYGON(CIRCULARSTRING(0 0,0 1,1 1)))", LW_PARSER_CHECK_NONE); count = lwgeom_count_vertices(geom); CU_ASSERT_EQUAL(count,13); lwgeom_free(geom); - geom = lwgeom_from_wkt("GEOMETRYCOLLECTION(CIRCULARSTRING(0 0,0 1,1 1),POINT(0 0),CURVEPOLYGON(CIRCULARSTRING(0 0,0 1,1 1,1 0,0 0)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("GEOMETRYCOLLECTION(CIRCULARSTRING(0 0,0 1,1 1),POINT(0 0),CURVEPOLYGON(CIRCULARSTRING(0 0,0 1,1 1,1 0,0 0)))", LW_PARSER_CHECK_NONE); count = lwgeom_count_vertices(geom); CU_ASSERT_EQUAL(count,9); lwgeom_free(geom); - geom = lwgeom_from_wkt("CURVEPOLYGON((0 0,1 0,0 1,0 0),CIRCULARSTRING(0 0,1 0,1 1,1 0,0 0))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("CURVEPOLYGON((0 0,1 0,0 1,0 0),CIRCULARSTRING(0 0,1 0,1 1,1 0,0 0))", LW_PARSER_CHECK_NONE); count = lwgeom_count_vertices(geom); CU_ASSERT_EQUAL(count,9); lwgeom_free(geom); - geom = lwgeom_from_wkt("POLYGON((0 0,1 0,0 1,0 0))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("POLYGON((0 0,1 0,0 1,0 0))", LW_PARSER_CHECK_NONE); count = lwgeom_count_vertices(geom); CU_ASSERT_EQUAL(count,4); lwgeom_free(geom); - geom = lwgeom_from_wkt("CURVEPOLYGON((0 0,1 0,0 1,0 0),CIRCULARSTRING(0 0,1 0,1 1,1 0,0 0))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("CURVEPOLYGON((0 0,1 0,0 1,0 0),CIRCULARSTRING(0 0,1 0,1 1,1 0,0 0))", LW_PARSER_CHECK_NONE); count = lwgeom_count_vertices(geom); CU_ASSERT_EQUAL(count,9); lwgeom_free(geom); @@ -102,7 +102,7 @@ static void test_misc_area(void) LWGEOM *geom; double area; - geom = lwgeom_from_wkt("LINESTRING EMPTY", PARSER_CHECK_ALL); + geom = lwgeom_from_wkt("LINESTRING EMPTY", LW_PARSER_CHECK_ALL); area = lwgeom_area(geom); CU_ASSERT_DOUBLE_EQUAL(area, 0.0, 0.0001); lwgeom_free(geom); @@ -111,7 +111,7 @@ static void test_misc_area(void) static void test_misc_wkb(void) { static char *wkb = "010A0000000200000001080000000700000000000000000000C00000000000000000000000000000F0BF000000000000F0BF00000000000000000000000000000000000000000000F03F000000000000F0BF000000000000004000000000000000000000000000000000000000000000004000000000000000C00000000000000000010200000005000000000000000000F0BF00000000000000000000000000000000000000000000E03F000000000000F03F00000000000000000000000000000000000000000000F03F000000000000F0BF0000000000000000"; - LWGEOM *geom = lwgeom_from_hexwkb(wkb, PARSER_CHECK_ALL); + LWGEOM *geom = lwgeom_from_hexwkb(wkb, LW_PARSER_CHECK_ALL); char *str = lwgeom_to_wkt(geom, WKB_ISO, 8, 0); CU_ASSERT_STRING_EQUAL(str, "CURVEPOLYGON(CIRCULARSTRING(-2 0,-1 -1,0 0,1 -1,2 0,0 2,-2 0),(-1 0,0 0.5,1 0,0 1,-1 0))"); lwfree(str); diff --git a/liblwgeom/cunit/cu_out_geojson.c b/liblwgeom/cunit/cu_out_geojson.c index 614a5e99c..325ffda2a 100644 --- a/liblwgeom/cunit/cu_out_geojson.c +++ b/liblwgeom/cunit/cu_out_geojson.c @@ -23,7 +23,7 @@ static void do_geojson_test(char * in, char * out, char * srs, int precision, in LWGEOM *g; char * h; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_to_geojson(g, srs, precision, has_bbox); if (strcmp(h, out)) @@ -41,7 +41,7 @@ static void do_geojson_unsupported(char * in, char * out) LWGEOM *g; char *h; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_to_geojson(g, NULL, 0, 0); if (strcmp(cu_error_msg, out)) diff --git a/liblwgeom/cunit/cu_out_gml.c b/liblwgeom/cunit/cu_out_gml.c index e8f31d112..92b873a8b 100644 --- a/liblwgeom/cunit/cu_out_gml.c +++ b/liblwgeom/cunit/cu_out_gml.c @@ -24,7 +24,7 @@ static void do_gml2_test(char * in, char * out, char * srs, int precision) LWGEOM *g; char *h; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_to_gml2(g, srs, precision, "gml:"); if (strcmp(h, out)) @@ -41,7 +41,7 @@ static void do_gml2_test_prefix(char * in, char * out, char * srs, int precision LWGEOM *g; char *h; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_to_gml2(g, srs, precision, prefix); if (strcmp(h, out)) @@ -58,7 +58,7 @@ static void do_gml3_test_opts(char * in, char * out, char * srs, int precision, LWGEOM *g; char *h; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_to_gml3(g, srs, precision, opts, "gml:"); if (strcmp(h, out)) @@ -77,7 +77,7 @@ static void do_gml3_test(char * in, char * out, char * srs, int precision, int i int opts = LW_GML_IS_DIMS; if ( is_geodetic ) opts |= LW_GML_IS_DEGREE; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_to_gml3(g, srs, precision, opts, "gml:"); if (strcmp(h, out)) @@ -97,7 +97,7 @@ static void do_gml3_test_prefix(char * in, char * out, char * srs, int precision if ( is_geodetic ) opts |= LW_GML_IS_DEGREE; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_to_gml3(g, srs, precision, opts, prefix); if (strcmp(h, out)) @@ -118,7 +118,7 @@ static void do_gml3_test_nodims(char * in, char * out, char * srs, int precision if ( is_geodetic ) opts |= LW_GML_IS_DEGREE; if ( is_dims ) opts |= LW_GML_IS_DIMS; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_to_gml3(g, srs, precision, opts, prefix); if (strcmp(h, out)) @@ -135,7 +135,7 @@ static void do_gml2_unsupported(char * in, char * out) LWGEOM *g; char *h; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_to_gml2(g, NULL, 0, ""); if (strcmp(cu_error_msg, out)) @@ -154,7 +154,7 @@ static void do_gml3_unsupported(char * in, char * out) char *h; int opts = LW_GML_IS_DIMS; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_to_gml3(g, NULL, 0, opts, ""); if (strcmp(cu_error_msg, out)) diff --git a/liblwgeom/cunit/cu_out_kml.c b/liblwgeom/cunit/cu_out_kml.c index a142f7b07..5fee60e38 100644 --- a/liblwgeom/cunit/cu_out_kml.c +++ b/liblwgeom/cunit/cu_out_kml.c @@ -23,7 +23,7 @@ static void do_kml_test(char * in, char * out, int precision) LWGEOM *g; char * h; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_to_kml2(g, precision, ""); if (strcmp(h, out)) @@ -41,7 +41,7 @@ static void do_kml_unsupported(char * in, char * out) LWGEOM *g; char *h; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_to_kml2(g, 0, ""); if (strcmp(cu_error_msg, out)) @@ -61,7 +61,7 @@ static void do_kml_test_prefix(char * in, char * out, int precision, const char LWGEOM *g; char * h; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_to_kml2(g, precision, prefix); if (strcmp(h, out)) diff --git a/liblwgeom/cunit/cu_out_svg.c b/liblwgeom/cunit/cu_out_svg.c index 5e8423312..db630ea1d 100644 --- a/liblwgeom/cunit/cu_out_svg.c +++ b/liblwgeom/cunit/cu_out_svg.c @@ -23,7 +23,7 @@ static void do_svg_test(char * in, char * out, int precision, int relative) LWGEOM *g; char * h; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_to_svg(g, precision, relative); if (strcmp(h, out)) @@ -41,7 +41,7 @@ static void do_svg_unsupported(char * in, char * out) LWGEOM *g; char *h; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_to_svg(g, 0, 0); if (strcmp(cu_error_msg, out)) diff --git a/liblwgeom/cunit/cu_out_wkb.c b/liblwgeom/cunit/cu_out_wkb.c index 8363f1f13..16fca0eca 100644 --- a/liblwgeom/cunit/cu_out_wkb.c +++ b/liblwgeom/cunit/cu_out_wkb.c @@ -49,7 +49,7 @@ static int clean_wkb_out_suite(void) */ static void cu_wkb_from_hexwkb(char *hexwkb) { - LWGEOM *g = lwgeom_from_hexwkb(hexwkb, PARSER_CHECK_NONE); + LWGEOM *g = lwgeom_from_hexwkb(hexwkb, LW_PARSER_CHECK_NONE); if ( s ) free(s); s = (char*)lwgeom_to_wkb(g, WKB_HEX | WKB_XDR | WKB_EXTENDED, 0); lwgeom_free(g); @@ -60,7 +60,7 @@ static void cu_wkb_from_hexwkb(char *hexwkb) */ static void cu_wkb(char *wkt) { - LWGEOM *g = lwgeom_from_wkt(wkt, PARSER_CHECK_NONE); + LWGEOM *g = lwgeom_from_wkt(wkt, LW_PARSER_CHECK_NONE); if ( s ) free(s); s = (char*)lwgeom_to_wkb(g, WKB_HEX | WKB_XDR | WKB_EXTENDED, NULL); lwgeom_free(g); diff --git a/liblwgeom/cunit/cu_out_wkt.c b/liblwgeom/cunit/cu_out_wkt.c index 13ed019f2..989042960 100644 --- a/liblwgeom/cunit/cu_out_wkt.c +++ b/liblwgeom/cunit/cu_out_wkt.c @@ -46,7 +46,7 @@ static int clean_wkt_out_suite(void) static char* cu_wkt(char *wkt, uchar variant) { - LWGEOM *g = lwgeom_from_wkt(wkt, PARSER_CHECK_NONE); + LWGEOM *g = lwgeom_from_wkt(wkt, LW_PARSER_CHECK_NONE); if ( s ) free(s); if ( ! g ) { diff --git a/liblwgeom/cunit/cu_out_x3d.c b/liblwgeom/cunit/cu_out_x3d.c index 33a9e0f5a..6141c083b 100644 --- a/liblwgeom/cunit/cu_out_x3d.c +++ b/liblwgeom/cunit/cu_out_x3d.c @@ -23,7 +23,7 @@ static void do_x3d3_test(char * in, char * out, char * srs, int precision) LWGEOM *g; char * h; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_to_x3d3(g, srs, precision, 0, ""); if (strcmp(h, out)) @@ -41,7 +41,7 @@ static void do_x3d3_unsupported(char * in, char * out) LWGEOM *g; char *h; - g = lwgeom_from_wkt(in, PARSER_CHECK_NONE); + g = lwgeom_from_wkt(in, LW_PARSER_CHECK_NONE); h = lwgeom_to_x3d3(g, NULL, 0, 0, ""); if (strcmp(cu_error_msg, out)) diff --git a/liblwgeom/cunit/cu_print.c b/liblwgeom/cunit/cu_print.c index 5563f61f9..028ac191c 100644 --- a/liblwgeom/cunit/cu_print.c +++ b/liblwgeom/cunit/cu_print.c @@ -21,7 +21,7 @@ static void test_lwprint_assert_format(char * point_wkt, const char * format, const char * expected) { - LWPOINT * test_point = (LWPOINT*)lwgeom_from_wkt(point_wkt, PARSER_CHECK_NONE); + LWPOINT * test_point = (LWPOINT*)lwgeom_from_wkt(point_wkt, LW_PARSER_CHECK_NONE); int num_old_failures, num_new_failures; char * actual; cu_error_msg_reset(); @@ -43,7 +43,7 @@ static void test_lwprint_assert_format(char * point_wkt, const char * format, co } static void test_lwprint_assert_error(char * point_wkt, const char * format) { - LWPOINT * test_point = (LWPOINT*)lwgeom_from_wkt(point_wkt, PARSER_CHECK_NONE); + LWPOINT * test_point = (LWPOINT*)lwgeom_from_wkt(point_wkt, LW_PARSER_CHECK_NONE); cu_error_msg_reset(); char* tmp = lwpoint_to_latlon(test_point, format); lwfree(tmp); diff --git a/liblwgeom/cunit/cu_ptarray.c b/liblwgeom/cunit/cu_ptarray.c index ff6b0af46..4594589a2 100644 --- a/liblwgeom/cunit/cu_ptarray.c +++ b/liblwgeom/cunit/cu_ptarray.c @@ -22,7 +22,7 @@ static LWGEOM* lwgeom_from_text(const char *str) { LWGEOM_PARSER_RESULT r; - if( LW_FAILURE == lwgeom_parse_wkt(&r, (char*)str, PARSER_CHECK_NONE) ) + if( LW_FAILURE == lwgeom_parse_wkt(&r, (char*)str, LW_PARSER_CHECK_NONE) ) return NULL; return r.geom; } diff --git a/liblwgeom/cunit/cu_surface.c b/liblwgeom/cunit/cu_surface.c index 5b95548ea..4175acbcc 100644 --- a/liblwgeom/cunit/cu_surface.c +++ b/liblwgeom/cunit/cu_surface.c @@ -23,7 +23,7 @@ void triangle_parse(void) cu_error_msg_reset(); /* Because i don't trust that much prior tests... ;) */ /* 2 dims */ - geom = lwgeom_from_wkt("TRIANGLE((0 1,2 3,4 5,0 1))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TRIANGLE((0 1,2 3,4 5,0 1))", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); CU_ASSERT_EQUAL(geom->type, TRIANGLETYPE); tmp = lwgeom_to_ewkt(geom); @@ -31,7 +31,7 @@ void triangle_parse(void) lwfree(tmp); lwgeom_free(geom); /* 3DM */ - geom = lwgeom_from_wkt("TRIANGLEM((0 1 2,3 4 5,6 7 8,0 1 2))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TRIANGLEM((0 1 2,3 4 5,6 7 8,0 1 2))", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); CU_ASSERT_EQUAL(geom->type, TRIANGLETYPE); tmp = lwgeom_to_ewkt(geom); @@ -40,59 +40,59 @@ void triangle_parse(void) lwgeom_free(geom); /* ERROR: a missing Z values */ - geom = lwgeom_from_wkt("TRIANGLE((0 1 2,3 4 5,6 7,0 1 2))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TRIANGLE((0 1 2,3 4 5,6 7,0 1 2))", LW_PARSER_CHECK_NONE); CU_ASSERT_STRING_EQUAL("can not mix dimensionality in a geometry", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* ERROR: non closed rings */ - geom = lwgeom_from_wkt("TRIANGLE((0 1 2,3 4 5,6 7 8,0 0 2))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TRIANGLE((0 1 2,3 4 5,6 7 8,0 0 2))", LW_PARSER_CHECK_NONE); CU_ASSERT_STRING_EQUAL("geometry contains non-closed rings", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* ERROR: non closed face in Z dim */ - geom = lwgeom_from_wkt("TRIANGLE((0 1 2,3 4 5,6 7 8,0 1 3))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TRIANGLE((0 1 2,3 4 5,6 7 8,0 1 3))", LW_PARSER_CHECK_NONE); CU_ASSERT_STRING_EQUAL("geometry contains non-closed rings", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* ERROR: non closed face in Z dim, with a 4D geom */ - geom = lwgeom_from_wkt("TRIANGLE((0 1 2 3,4 5 6 7,8 9 10 11,0 1 3 3))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TRIANGLE((0 1 2 3,4 5 6 7,8 9 10 11,0 1 3 3))", LW_PARSER_CHECK_NONE); CU_ASSERT_STRING_EQUAL("geometry contains non-closed rings", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* ERROR: only 3 points in a face */ - geom = lwgeom_from_wkt("TRIANGLE((0 1 2,3 4 5,0 1 2))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TRIANGLE((0 1 2,3 4 5,0 1 2))", LW_PARSER_CHECK_NONE); CU_ASSERT_STRING_EQUAL("triangle must have exactly 4 points", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* ERROR: more than 4 points in a face */ - geom = lwgeom_from_wkt("TRIANGLE((0 1 2,3 4 5,6 7 8,9 10 11,0 1 2))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TRIANGLE((0 1 2,3 4 5,6 7 8,9 10 11,0 1 2))", LW_PARSER_CHECK_NONE); CU_ASSERT_STRING_EQUAL("triangle must have exactly 4 points", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* ERROR: no interior rings allowed */ - geom = lwgeom_from_wkt("TRIANGLE((0 1 2,3 4 5,6 7 8,0 1 2),(9 10 11,12 13 14,15 16 17,9 10 11)", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TRIANGLE((0 1 2,3 4 5,6 7 8,0 1 2),(9 10 11,12 13 14,15 16 17,9 10 11)", LW_PARSER_CHECK_NONE); CU_ASSERT_STRING_EQUAL("parse error - invalid geometry", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* EMPTY face */ - geom = lwgeom_from_wkt("TRIANGLE EMPTY", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TRIANGLE EMPTY", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); /* NOTA: Theses 3 ASSERT results will change a day cf #294 */ CU_ASSERT_EQUAL(geom->type, TRIANGLETYPE); -// CU_ASSERT_STRING_EQUAL("TRIANGLE EMPTY", lwgeom_to_wkt(geom, PARSER_CHECK_NONE)); +// CU_ASSERT_STRING_EQUAL("TRIANGLE EMPTY", lwgeom_to_wkt(geom, LW_PARSER_CHECK_NONE)); lwgeom_free(geom); /* explicit SRID */ - geom = lwgeom_from_wkt("SRID=4326;TRIANGLE((0 1 2,3 4 5,6 7 8,0 1 2))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("SRID=4326;TRIANGLE((0 1 2,3 4 5,6 7 8,0 1 2))", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); CU_ASSERT_EQUAL(geom->type, TRIANGLETYPE); CU_ASSERT_EQUAL(geom->srid, 4326); @@ -102,7 +102,7 @@ void triangle_parse(void) lwgeom_free(geom); /* geography support */ - geom = lwgeom_from_wkt("TRIANGLE((0 1 2,3 4 5,6 7 8,0 1 2))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TRIANGLE((0 1 2,3 4 5,6 7 8,0 1 2))", LW_PARSER_CHECK_NONE); g = gserialized_from_lwgeom(geom, 1, 0); CU_ASSERT_EQUAL(gserialized_get_type(g), TRIANGLETYPE); lwgeom_free(geom); @@ -119,7 +119,7 @@ void tin_parse(void) cu_error_msg_reset(); /* Because i don't trust that much prior tests... ;) */ /* empty */ - geom = lwgeom_from_wkt("TIN EMPTY", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TIN EMPTY", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); /* NOTA: Theses 3 ASSERT results will change a day cf #294 @@ -131,7 +131,7 @@ void tin_parse(void) lwgeom_free(geom); /* 2 dims */ - geom = lwgeom_from_wkt("TIN(((0 1,2 3,4 5,0 1)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TIN(((0 1,2 3,4 5,0 1)))", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); CU_ASSERT_EQUAL(geom->type, TINTYPE); tmp = lwgeom_to_ewkt(geom); @@ -140,7 +140,7 @@ void tin_parse(void) lwgeom_free(geom); /* 3DM */ - geom = lwgeom_from_wkt("TINM(((0 1 2,3 4 5,6 7 8,0 1 2)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TINM(((0 1 2,3 4 5,6 7 8,0 1 2)))", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); CU_ASSERT_EQUAL(geom->type, TINTYPE); tmp = lwgeom_to_ewkt(geom); @@ -149,49 +149,49 @@ void tin_parse(void) lwgeom_free(geom); /* ERROR: a missing Z values */ - geom = lwgeom_from_wkt("TIN(((0 1 2,3 4 5,6 7,0 1 2)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TIN(((0 1 2,3 4 5,6 7,0 1 2)))", LW_PARSER_CHECK_NONE); CU_ASSERT_STRING_EQUAL("can not mix dimensionality in a geometry", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* ERROR: non closed rings */ - geom = lwgeom_from_wkt("TIN(((0 1 2,3 4 5,6 7 8,0 0 2)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TIN(((0 1 2,3 4 5,6 7 8,0 0 2)))", LW_PARSER_CHECK_NONE); CU_ASSERT_STRING_EQUAL("geometry contains non-closed rings", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* ERROR: non closed face in Z dim */ - geom = lwgeom_from_wkt("TIN(((0 1 2,3 4 5,6 7 8,0 1 3)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TIN(((0 1 2,3 4 5,6 7 8,0 1 3)))", LW_PARSER_CHECK_NONE); CU_ASSERT_STRING_EQUAL("geometry contains non-closed rings", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* ERROR: non closed face in Z dim, with a 4D geom */ - geom = lwgeom_from_wkt("TIN(((0 1 2 3,4 5 6 7,8 9 10 11,0 1 3 3)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TIN(((0 1 2 3,4 5 6 7,8 9 10 11,0 1 3 3)))", LW_PARSER_CHECK_NONE); CU_ASSERT_STRING_EQUAL("geometry contains non-closed rings", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* ERROR: only 3 points in a face */ - geom = lwgeom_from_wkt("TIN(((0 1 2,3 4 5,0 1 2)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TIN(((0 1 2,3 4 5,0 1 2)))", LW_PARSER_CHECK_NONE); CU_ASSERT_STRING_EQUAL("triangle must have exactly 4 points", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* ERROR: more than 3 points in a face */ - geom = lwgeom_from_wkt("TIN(((0 1 2,3 4 5,6 7 8,9 10 11,0 1 2)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TIN(((0 1 2,3 4 5,6 7 8,9 10 11,0 1 2)))", LW_PARSER_CHECK_NONE); CU_ASSERT_STRING_EQUAL("triangle must have exactly 4 points", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* ERROR: use ring for triangle */ - geom = lwgeom_from_wkt("TIN(((0 1 2,3 4 5,6 7 8,0 1 2),(9 10 11,12 13 14,15 16 17,9 10 11)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TIN(((0 1 2,3 4 5,6 7 8,0 1 2),(9 10 11,12 13 14,15 16 17,9 10 11)))", LW_PARSER_CHECK_NONE); CU_ASSERT_STRING_EQUAL("parse error - invalid geometry", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* EMPTY face */ - geom = lwgeom_from_wkt("TIN EMPTY", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TIN EMPTY", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); /* NOTA: Theses 3 ASSERT results will change a day cf #294 @@ -201,7 +201,7 @@ void tin_parse(void) lwgeom_free(geom); /* A simple tetrahedron */ - geom = lwgeom_from_wkt("TIN(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TIN(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); CU_ASSERT_EQUAL(geom->type, TINTYPE); CU_ASSERT_EQUAL(geom->srid, SRID_UNKNOWN); @@ -211,7 +211,7 @@ void tin_parse(void) lwgeom_free(geom); /* A 4D tetrahedron */ - geom = lwgeom_from_wkt("TIN(((0 0 0 0,0 0 1 0,0 1 0 2,0 0 0 0)),((0 0 0 0,0 1 0 0,1 0 0 4,0 0 0 0)),((0 0 0 0,1 0 0 0,0 0 1 6,0 0 0 0)),((1 0 0 0,0 1 0 0,0 0 1 0,1 0 0 0)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TIN(((0 0 0 0,0 0 1 0,0 1 0 2,0 0 0 0)),((0 0 0 0,0 1 0 0,1 0 0 4,0 0 0 0)),((0 0 0 0,1 0 0 0,0 0 1 6,0 0 0 0)),((1 0 0 0,0 1 0 0,0 0 1 0,1 0 0 0)))", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); CU_ASSERT_EQUAL(geom->type, TINTYPE); CU_ASSERT_EQUAL(FLAGS_GET_M(geom->flags), 1); @@ -222,7 +222,7 @@ void tin_parse(void) lwgeom_free(geom); /* explicit SRID */ - geom = lwgeom_from_wkt("SRID=4326;TIN(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("SRID=4326;TIN(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); CU_ASSERT_EQUAL(geom->type, TINTYPE); CU_ASSERT_EQUAL(geom->srid, 4326); @@ -232,7 +232,7 @@ void tin_parse(void) lwgeom_free(geom); /* geography support */ - geom = lwgeom_from_wkt("TIN(((0 1 2,3 4 5,6 7 8,0 1 2)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("TIN(((0 1 2,3 4 5,6 7 8,0 1 2)))", LW_PARSER_CHECK_NONE); g = gserialized_from_lwgeom(geom, 1, 0); CU_ASSERT_EQUAL(gserialized_get_type(g), TINTYPE); lwgeom_free(geom); @@ -246,7 +246,7 @@ check_tgeom(char *ewkt, int type, uint32 srid, int is_solid) LWGEOM *g1, *g2; TGEOM *tgeom; - g1 = lwgeom_from_wkt(ewkt, PARSER_CHECK_NONE); + g1 = lwgeom_from_wkt(ewkt, LW_PARSER_CHECK_NONE); if (strlen(cu_error_msg)) printf("\n[%s], %s\n", ewkt, cu_error_msg); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); @@ -316,7 +316,7 @@ void polyhedralsurface_parse(void) cu_error_msg_reset(); /* Because i don't trust that much prior tests... ;) */ /* 2 dims */ - geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 1,2 3,4 5,0 1)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 1,2 3,4 5,0 1)))", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); CU_ASSERT_EQUAL(geom->type, POLYHEDRALSURFACETYPE); tmp = lwgeom_to_hexwkb(geom, WKB_NDR | WKB_EXTENDED, 0); @@ -330,7 +330,7 @@ void polyhedralsurface_parse(void) lwgeom_free(geom); /* 3DM */ - geom = lwgeom_from_wkt("POLYHEDRALSURFACEM(((0 1 2,3 4 5,6 7 8,0 1 2)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("POLYHEDRALSURFACEM(((0 1 2,3 4 5,6 7 8,0 1 2)))", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); CU_ASSERT_EQUAL(geom->type, POLYHEDRALSURFACETYPE); tmp = lwgeom_to_ewkt(geom); @@ -342,13 +342,13 @@ void polyhedralsurface_parse(void) lwgeom_free(geom); /* ERROR: a missing Z values */ - geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 1 2,3 4 5,6 7,0 1 2)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 1 2,3 4 5,6 7,0 1 2)))", LW_PARSER_CHECK_NONE); CU_ASSERT_STRING_EQUAL("can not mix dimensionality in a geometry", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* 1 face with 1 interior ring */ - geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 1 2,3 4 5,6 7 8,0 1 2),(9 10 11,12 13 14,15 16 17,9 10 11)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 1 2,3 4 5,6 7 8,0 1 2),(9 10 11,12 13 14,15 16 17,9 10 11)))", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); CU_ASSERT_EQUAL(geom->type, POLYHEDRALSURFACETYPE); tmp = lwgeom_to_ewkt(geom); @@ -360,31 +360,31 @@ void polyhedralsurface_parse(void) lwgeom_free(geom); /* ERROR: non closed rings */ - geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 1 2,3 4 5,6 7 8,0 0 2)))", PARSER_CHECK_ALL); + geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 1 2,3 4 5,6 7 8,0 0 2)))", LW_PARSER_CHECK_ALL); CU_ASSERT_STRING_EQUAL("geometry contains non-closed rings", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* ERROR: non closed face in Z dim */ - geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 1 2,3 4 5,6 7 8,0 1 3)))", PARSER_CHECK_ALL); + geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 1 2,3 4 5,6 7 8,0 1 3)))", LW_PARSER_CHECK_ALL); CU_ASSERT_STRING_EQUAL("geometry contains non-closed rings", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* ERROR: non closed face in Z dim, with a 4D geom */ - geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 1 2 3,4 5 6 7,8 9 10 11,0 1 3 3)))", PARSER_CHECK_ALL); + geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 1 2 3,4 5 6 7,8 9 10 11,0 1 3 3)))", LW_PARSER_CHECK_ALL); CU_ASSERT_STRING_EQUAL("geometry contains non-closed rings", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* ERROR: only 3 points in a face */ - geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 1 2,3 4 5,0 1 2)))", PARSER_CHECK_ALL); + geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 1 2,3 4 5,0 1 2)))", LW_PARSER_CHECK_ALL); CU_ASSERT_STRING_EQUAL("geometry requires more points", cu_error_msg); cu_error_msg_reset(); lwgeom_free(geom); /* EMPTY face */ - geom = lwgeom_from_wkt("POLYHEDRALSURFACE EMPTY", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("POLYHEDRALSURFACE EMPTY", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); /* NOTA: Theses 3 ASSERT results will change a day cf #294 @@ -395,7 +395,7 @@ void polyhedralsurface_parse(void) lwgeom_free(geom); /* A simple tetrahedron */ - geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); CU_ASSERT_EQUAL(geom->type, POLYHEDRALSURFACETYPE); CU_ASSERT_EQUAL(geom->srid, SRID_UNKNOWN); @@ -408,7 +408,7 @@ void polyhedralsurface_parse(void) lwgeom_free(geom); /* A 4D tetrahedron */ - geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 0 0 0,0 0 1 0,0 1 0 2,0 0 0 0)),((0 0 0 0,0 1 0 0,1 0 0 4,0 0 0 0)),((0 0 0 0,1 0 0 0,0 0 1 6,0 0 0 0)),((1 0 0 0,0 1 0 0,0 0 1 0,1 0 0 0)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 0 0 0,0 0 1 0,0 1 0 2,0 0 0 0)),((0 0 0 0,0 1 0 0,1 0 0 4,0 0 0 0)),((0 0 0 0,1 0 0 0,0 0 1 6,0 0 0 0)),((1 0 0 0,0 1 0 0,0 0 1 0,1 0 0 0)))", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); CU_ASSERT_EQUAL(geom->type, POLYHEDRALSURFACETYPE); CU_ASSERT_EQUAL(FLAGS_GET_M(geom->flags), 1); @@ -423,7 +423,7 @@ void polyhedralsurface_parse(void) /* explicit SRID */ - geom = lwgeom_from_wkt("SRID=4326;POLYHEDRALSURFACE(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("SRID=4326;POLYHEDRALSURFACE(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))", LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); CU_ASSERT_EQUAL(geom->type, POLYHEDRALSURFACETYPE); CU_ASSERT_EQUAL(geom->srid, 4326); @@ -437,7 +437,7 @@ void polyhedralsurface_parse(void) /* geography support */ - geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 1 2,3 4 5,6 7 8,0 1 2)))", PARSER_CHECK_NONE); + geom = lwgeom_from_wkt("POLYHEDRALSURFACE(((0 1 2,3 4 5,6 7 8,0 1 2)))", LW_PARSER_CHECK_NONE); g = gserialized_from_lwgeom(geom, 1, 0); CU_ASSERT_EQUAL(gserialized_get_type(g), POLYHEDRALSURFACETYPE); lwgeom_free(geom); @@ -516,7 +516,7 @@ check_dimension(char *ewkt, int dim) { LWGEOM *geom; - geom = lwgeom_from_wkt(ewkt, PARSER_CHECK_NONE); + geom = lwgeom_from_wkt(ewkt, LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); CU_ASSERT_EQUAL(lwgeom_dimensionality(geom), dim); lwgeom_free(geom); @@ -545,7 +545,7 @@ check_perimeter(char *ewkt, int dim, double p) LWGEOM *geom; TGEOM *tgeom; - geom = lwgeom_from_wkt(ewkt, PARSER_CHECK_NONE); + geom = lwgeom_from_wkt(ewkt, LW_PARSER_CHECK_NONE); CU_ASSERT_EQUAL(strlen(cu_error_msg), 0); tgeom = tgeom_from_lwgeom(geom); diff --git a/liblwgeom/liblwgeom.h b/liblwgeom/liblwgeom.h index ddf9e6cac..936ae0c11 100644 --- a/liblwgeom/liblwgeom.h +++ b/liblwgeom/liblwgeom.h @@ -1996,19 +1996,17 @@ extern int gserialized_get_gbox_p(const GSERIALIZED *g, GBOX *gbox); /** * Parser check flags * - * TODO: give these an LW_ prefix - * * @see lwgeom_from_wkb * @see lwgeom_from_hexwkb * @see lwgeom_parse_wkt */ -#define PARSER_CHECK_MINPOINTS 1 -#define PARSER_CHECK_ODD 2 -#define PARSER_CHECK_CLOSURE 4 -#define PARSER_CHECK_ZCLOSURE 8 +#define LW_PARSER_CHECK_MINPOINTS 1 +#define LW_PARSER_CHECK_ODD 2 +#define LW_PARSER_CHECK_CLOSURE 4 +#define LW_PARSER_CHECK_ZCLOSURE 8 -#define PARSER_CHECK_NONE 0 -#define PARSER_CHECK_ALL (PARSER_CHECK_MINPOINTS | PARSER_CHECK_ODD | PARSER_CHECK_CLOSURE) +#define LW_PARSER_CHECK_NONE 0 +#define LW_PARSER_CHECK_ALL (LW_PARSER_CHECK_MINPOINTS | LW_PARSER_CHECK_ODD | LW_PARSER_CHECK_CLOSURE) /** * Parser result structure: returns the result of attempting to convert @@ -2112,17 +2110,17 @@ extern char* lwgeom_to_hexwkb(const LWGEOM *geom, uchar variant, size_t *size_ extern char *lwgeom_to_ewkt(const LWGEOM *lwgeom); /** - * @param check parser check flags, see PARSER_CHECK_* macros + * @param check parser check flags, see LW_PARSER_CHECK_* macros */ extern LWGEOM* lwgeom_from_wkb(const uchar *wkb, const size_t wkb_size, const char check); /** - * @param check parser check flags, see PARSER_CHECK_* macros + * @param check parser check flags, see LW_PARSER_CHECK_* macros */ extern LWGEOM* lwgeom_from_wkt(const char *wkt, const char check); /** - * @param check parser check flags, see PARSER_CHECK_* macros + * @param check parser check flags, see LW_PARSER_CHECK_* macros */ extern LWGEOM* lwgeom_from_hexwkb(const char *hexwkb, const char check); diff --git a/liblwgeom/lwin_wkb.c b/liblwgeom/lwin_wkb.c index a8d6abf75..0f1848550 100644 --- a/liblwgeom/lwin_wkb.c +++ b/liblwgeom/lwin_wkb.c @@ -401,7 +401,7 @@ static LWLINE* lwline_from_wkb_state(wkb_parse_state *s) if( pa == NULL || pa->npoints == 0 ) return lwline_construct_empty(s->srid, s->has_z, s->has_m); - if( s->check & PARSER_CHECK_MINPOINTS && pa->npoints < 2 ) + if( s->check & LW_PARSER_CHECK_MINPOINTS && pa->npoints < 2 ) { lwerror("%s must have at least two points", lwtype_name(s->lwtype)); return NULL; @@ -426,13 +426,13 @@ static LWCIRCSTRING* lwcircstring_from_wkb_state(wkb_parse_state *s) if( pa == NULL || pa->npoints == 0 ) return lwcircstring_construct_empty(s->srid, s->has_z, s->has_m); - if( s->check & PARSER_CHECK_MINPOINTS && pa->npoints < 3 ) + if( s->check & LW_PARSER_CHECK_MINPOINTS && pa->npoints < 3 ) { lwerror("%s must have at least three points", lwtype_name(s->lwtype)); return NULL; } - if( s->check & PARSER_CHECK_ODD && ! (pa->npoints % 2) ) + if( s->check & LW_PARSER_CHECK_ODD && ! (pa->npoints % 2) ) { lwerror("%s must have an odd number of points", lwtype_name(s->lwtype)); return NULL; @@ -466,7 +466,7 @@ static LWPOLY* lwpoly_from_wkb_state(wkb_parse_state *s) continue; /* Check for at least four points. */ - if( s->check & PARSER_CHECK_MINPOINTS && pa->npoints < 4 ) + if( s->check & LW_PARSER_CHECK_MINPOINTS && pa->npoints < 4 ) { LWDEBUGF(2, "%s must have at least four points in each ring", lwtype_name(s->lwtype)); lwerror("%s must have at least four points in each ring", lwtype_name(s->lwtype)); @@ -474,7 +474,7 @@ static LWPOLY* lwpoly_from_wkb_state(wkb_parse_state *s) } /* Check that first and last points are the same. */ - if( s->check & PARSER_CHECK_CLOSURE && ! ptarray_isclosed2d(pa) ) + if( s->check & LW_PARSER_CHECK_CLOSURE && ! ptarray_isclosed2d(pa) ) { LWDEBUGF(2, "%s must have closed rings", lwtype_name(s->lwtype)); lwerror("%s must have closed rings", lwtype_name(s->lwtype)); @@ -518,20 +518,20 @@ static LWTRIANGLE* lwtriangle_from_wkb_state(wkb_parse_state *s) return tri; /* Check for at least four points. */ - if( s->check & PARSER_CHECK_MINPOINTS && pa->npoints < 4 ) + if( s->check & LW_PARSER_CHECK_MINPOINTS && pa->npoints < 4 ) { LWDEBUGF(2, "%s must have at least four points", lwtype_name(s->lwtype)); lwerror("%s must have at least four points", lwtype_name(s->lwtype)); return NULL; } - if( s->check & PARSER_CHECK_CLOSURE && ! ptarray_isclosed(pa) ) + if( s->check & LW_PARSER_CHECK_CLOSURE && ! ptarray_isclosed(pa) ) { lwerror("%s must have closed rings", lwtype_name(s->lwtype)); return NULL; } - if( s->check & PARSER_CHECK_ZCLOSURE && ! ptarray_isclosedz(pa) ) + if( s->check & LW_PARSER_CHECK_ZCLOSURE && ! ptarray_isclosedz(pa) ) { lwerror("%s must have closed rings", lwtype_name(s->lwtype)); return NULL; @@ -587,7 +587,7 @@ static LWCOLLECTION* lwcollection_from_wkb_state(wkb_parse_state *s) /* Be strict in polyhedral surface closures */ if ( s->lwtype == POLYHEDRALSURFACETYPE ) - s->check |= PARSER_CHECK_ZCLOSURE; + s->check |= LW_PARSER_CHECK_ZCLOSURE; for ( i = 0; i < ngeoms; i++ ) { @@ -699,8 +699,8 @@ LWGEOM* lwgeom_from_wkb_state(wkb_parse_state *s) * a one-ring polygon to have 10 rings, causing the WKB reader to walk off the * end of the memory). * -* Check is a bitmask of: PARSER_CHECK_MINPOINTS, PARSER_CHECK_ODD, -* PARSER_CHECK_CLOSURE, PARSER_CHECK_NONE, PARSER_CHECK_ALL +* Check is a bitmask of: LW_PARSER_CHECK_MINPOINTS, LW_PARSER_CHECK_ODD, +* LW_PARSER_CHECK_CLOSURE, LW_PARSER_CHECK_NONE, LW_PARSER_CHECK_ALL */ LWGEOM* lwgeom_from_wkb(const uchar *wkb, const size_t wkb_size, const char check) { @@ -719,7 +719,7 @@ LWGEOM* lwgeom_from_wkb(const uchar *wkb, const size_t wkb_size, const char chec s.pos = wkb; /* Hand the check catch-all values */ - if ( check & PARSER_CHECK_NONE ) + if ( check & LW_PARSER_CHECK_NONE ) s.check = 0; else s.check = check; diff --git a/liblwgeom/lwin_wkt.c b/liblwgeom/lwin_wkt.c index 8f486dd68..4401657b7 100644 --- a/liblwgeom/lwin_wkt.c +++ b/liblwgeom/lwin_wkt.c @@ -335,7 +335,7 @@ LWGEOM* wkt_parser_linestring_new(POINTARRAY *pa, char *dimensionality) } /* Apply check for not enough points, if requested. */ - if( (global_parser_result.parser_check_flags & PARSER_CHECK_MINPOINTS) && (pa->npoints < 2) ) + if( (global_parser_result.parser_check_flags & LW_PARSER_CHECK_MINPOINTS) && (pa->npoints < 2) ) { ptarray_free(pa); SET_PARSER_ERROR(PARSER_ERROR_MOREPOINTS); @@ -369,7 +369,7 @@ LWGEOM* wkt_parser_circularstring_new(POINTARRAY *pa, char *dimensionality) } /* Apply check for not enough points, if requested. */ - if( (global_parser_result.parser_check_flags & PARSER_CHECK_MINPOINTS) && (pa->npoints < 3) ) + if( (global_parser_result.parser_check_flags & LW_PARSER_CHECK_MINPOINTS) && (pa->npoints < 3) ) { ptarray_free(pa); SET_PARSER_ERROR(PARSER_ERROR_MOREPOINTS); @@ -377,7 +377,7 @@ LWGEOM* wkt_parser_circularstring_new(POINTARRAY *pa, char *dimensionality) } /* Apply check for odd number of points, if requested. */ - if( (global_parser_result.parser_check_flags & PARSER_CHECK_ODD) && ((pa->npoints % 2) == 0) ) + if( (global_parser_result.parser_check_flags & LW_PARSER_CHECK_ODD) && ((pa->npoints % 2) == 0) ) { ptarray_free(pa); SET_PARSER_ERROR(PARSER_ERROR_ODDPOINTS); @@ -469,7 +469,7 @@ LWGEOM* wkt_parser_polygon_add_ring(LWGEOM *poly, POINTARRAY *pa, char dimcheck) } /* Apply check for minimum number of points, if requested. */ - if( (global_parser_result.parser_check_flags & PARSER_CHECK_MINPOINTS) && (pa->npoints < 4) ) + if( (global_parser_result.parser_check_flags & LW_PARSER_CHECK_MINPOINTS) && (pa->npoints < 4) ) { ptarray_free(pa); lwgeom_free(poly); @@ -478,7 +478,7 @@ LWGEOM* wkt_parser_polygon_add_ring(LWGEOM *poly, POINTARRAY *pa, char dimcheck) } /* Apply check for not closed rings, if requested. */ - if( (global_parser_result.parser_check_flags & PARSER_CHECK_CLOSURE) && + if( (global_parser_result.parser_check_flags & LW_PARSER_CHECK_CLOSURE) && ! (dimcheck == 'Z' ? ptarray_isclosedz(pa) : ptarray_isclosed2d(pa)) ) { ptarray_free(pa); @@ -571,7 +571,7 @@ LWGEOM* wkt_parser_curvepolygon_add_ring(LWGEOM *poly, LWGEOM *ring) } /* Apply check for minimum number of points, if requested. */ - if( (global_parser_result.parser_check_flags & PARSER_CHECK_MINPOINTS) && + if( (global_parser_result.parser_check_flags & LW_PARSER_CHECK_MINPOINTS) && (lwgeom_count_vertices(ring) < 4) ) { LWDEBUG(4,"number of points is incorrect"); @@ -582,7 +582,7 @@ LWGEOM* wkt_parser_curvepolygon_add_ring(LWGEOM *poly, LWGEOM *ring) } /* Apply check for not closed rings, if requested. */ - if( (global_parser_result.parser_check_flags & PARSER_CHECK_CLOSURE) ) + if( (global_parser_result.parser_check_flags & LW_PARSER_CHECK_CLOSURE) ) { int is_closed = 1; LWDEBUG(4,"checking ring closure"); diff --git a/loader/pgsql2shp-core.c b/loader/pgsql2shp-core.c index 878a5882e..d47253bdc 100644 --- a/loader/pgsql2shp-core.c +++ b/loader/pgsql2shp-core.c @@ -2128,7 +2128,7 @@ int ShpLoaderGenerateShapeRow(SHPDUMPERSTATE *state) LWDEBUGF(4, "HexEWKB - length: %d value: %s", strlen(hexewkb), hexewkb); /* Deserialize the LWGEOM */ - lwgeom = lwgeom_from_hexwkb(hexewkb, PARSER_CHECK_NONE); + lwgeom = lwgeom_from_hexwkb(hexewkb, LW_PARSER_CHECK_NONE); if (!lwgeom) { snprintf(state->message, SHPDUMPERMSGLEN, _("Error parsing HEXEWKB for record %d"), state->currow); diff --git a/postgis/geography_inout.c b/postgis/geography_inout.c index 9c3fc98ee..a53725573 100644 --- a/postgis/geography_inout.c +++ b/postgis/geography_inout.c @@ -132,7 +132,7 @@ Datum geography_in(PG_FUNCTION_ARGS) if ( str[0] == '0' ) { /* TODO: 20101206: No parser checks! This is inline with current 1.5 behavior, but needs discussion */ - lwgeom = lwgeom_from_hexwkb(str, PARSER_CHECK_NONE); + lwgeom = lwgeom_from_hexwkb(str, LW_PARSER_CHECK_NONE); /* Error out if something went sideways */ if ( ! lwgeom ) ereport(ERROR,(errmsg("parse error - invalid geometry"))); @@ -140,7 +140,7 @@ Datum geography_in(PG_FUNCTION_ARGS) /* WKT then. */ else { - if ( lwgeom_parse_wkt(&lwg_parser_result, str, PARSER_CHECK_ALL) == LW_FAILURE ) + if ( lwgeom_parse_wkt(&lwg_parser_result, str, LW_PARSER_CHECK_ALL) == LW_FAILURE ) PG_PARSER_ERROR(lwg_parser_result); lwgeom = lwg_parser_result.geom; diff --git a/postgis/lwgeom_inout.c b/postgis/lwgeom_inout.c index e86433433..fd1617496 100644 --- a/postgis/lwgeom_inout.c +++ b/postgis/lwgeom_inout.c @@ -92,7 +92,7 @@ Datum LWGEOM_in(PG_FUNCTION_ARGS) size_t hexsize = strlen(str); unsigned char *wkb = bytes_from_hexbytes(str, hexsize); /* TODO: 20101206: No parser checks! This is inline with current 1.5 behavior, but needs discussion */ - lwgeom = lwgeom_from_wkb(wkb, hexsize/2, PARSER_CHECK_NONE); + lwgeom = lwgeom_from_wkb(wkb, hexsize/2, LW_PARSER_CHECK_NONE); /* If we picked up an SRID at the head of the WKB set it manually */ if ( srid ) lwgeom_set_srid(lwgeom, srid); /* Add a bbox if necessary */ @@ -104,7 +104,7 @@ Datum LWGEOM_in(PG_FUNCTION_ARGS) /* WKT then. */ else { - if ( lwgeom_parse_wkt(&lwg_parser_result, str, PARSER_CHECK_ALL) == LW_FAILURE ) + if ( lwgeom_parse_wkt(&lwg_parser_result, str, LW_PARSER_CHECK_ALL) == LW_FAILURE ) { PG_PARSER_ERROR(lwg_parser_result); } @@ -323,7 +323,7 @@ Datum LWGEOMFromWKB(PG_FUNCTION_ARGS) LWGEOM *lwgeom; uchar *wkb = (uchar*)VARDATA(bytea_wkb); - lwgeom = lwgeom_from_wkb(wkb, VARSIZE(bytea_wkb)-VARHDRSZ, PARSER_CHECK_ALL); + lwgeom = lwgeom_from_wkb(wkb, VARSIZE(bytea_wkb)-VARHDRSZ, LW_PARSER_CHECK_ALL); if ( ( PG_NARGS()>1) && ( ! PG_ARGISNULL(1) )) { @@ -485,7 +485,7 @@ Datum LWGEOM_recv(PG_FUNCTION_ARGS) PG_LWGEOM *geom; LWGEOM *lwgeom; - lwgeom = lwgeom_from_wkb((uchar*)buf->data, buf->len, PARSER_CHECK_ALL); + lwgeom = lwgeom_from_wkb((uchar*)buf->data, buf->len, LW_PARSER_CHECK_ALL); if ( lwgeom_needs_bbox(lwgeom) ) lwgeom_add_bbox(lwgeom); diff --git a/postgis/lwgeom_ogc.c b/postgis/lwgeom_ogc.c index 1a92be37b..df4df7f4a 100644 --- a/postgis/lwgeom_ogc.c +++ b/postgis/lwgeom_ogc.c @@ -752,7 +752,7 @@ Datum LWGEOM_from_text(PG_FUNCTION_ARGS) POSTGIS_DEBUG(2, "LWGEOM_from_text"); POSTGIS_DEBUGF(3, "wkt: [%s]", wkt); - if (lwgeom_parse_wkt(&lwg_parser_result, wkt, PARSER_CHECK_ALL) == LW_FAILURE) + if (lwgeom_parse_wkt(&lwg_parser_result, wkt, LW_PARSER_CHECK_ALL) == LW_FAILURE) PG_PARSER_ERROR(lwg_parser_result); lwgeom = lwg_parser_result.geom;