17 #include "CUnit/Basic.h"
18 #include "CUnit/CUnit.h"
83 CU_ASSERT( out == NULL );
89 CU_ASSERT( out == NULL );
95 CU_ASSERT( out == NULL );
101 in =
lwgeom_from_text(
"CIRCULARSTRING(29.2893218813453 70.7106781186548,100 100,200 0)");
122 #ifndef SKIP_TEST_RETAIN_ANGLE
164 CU_ASSERT( out == NULL );
169 CU_ASSERT( out == NULL );
190 #ifndef SKIP_TEST_RETAIN_ANGLE
258 "2696000.553 1125699.831999999936670, "
259 "2695950.552000000141561 1125749.833000000100583, "
260 "2695865.195999999996275 1125835.189000)");
271 #ifndef SKIP_TEST_RETAIN_ANGLE
302 CU_ASSERT( out == NULL );
307 CU_ASSERT( out == NULL );
329 #ifndef SKIP_TEST_RETAIN_ANGLE
360 fprintf(stderr,
"linearization is not direction neutral:\n");
362 fprintf(stderr,
"OUT1: %s\n",
str);
365 fprintf(stderr,
"OUT2: %s\n",
str);
404 in =
lwgeom_from_text(
"COMPOUNDCURVE(CIRCULARSTRING(-1 0,0 1,0 -1),(0 -1,-1 -1))");
416 in =
lwgeom_from_text(
"COMPOUNDCURVE((-3 -3,-1 0),CIRCULARSTRING(-1 0,0 1,0 -1),(0 -1,0 -1.5,0 -2),CIRCULARSTRING(0 -2,-1 -3,1 -3),(1 -3,5 5))");
425 "COMPOUNDCURVE((-3 -3,-1 0),CIRCULARSTRING(-1 0,0.70710678 "
426 "0.70710678,0 -1),(0 -1,0 -1.5,0 -2),CIRCULARSTRING(0 "
427 "-2,-0.70710678 -3.70710678,1 -3),(1 -3,5 5))");
432 in =
lwgeom_from_text(
"COMPOUNDCURVE(CIRCULARSTRING(-1 0,0 1,0 -1),CIRCULARSTRING(0 -1,-1 -2,1 -2))");
441 "COMPOUNDCURVE(CIRCULARSTRING(-1 0,0.70710678 0.70710678,0 "
442 "-1),CIRCULARSTRING(0 -1,-0.70710678 -2.70710678,1 -2))");
447 in =
lwgeom_from_text(
"COMPOUNDCURVE((0 0, 1 1), CIRCULARSTRING(1 1, 2 2, 3 1), (3 1, 4 4))");
497 in =
lwgeom_from_text(
"GEOMETRYCOLLECTION(LINESTRING(10 10,10 11),LINESTRING(10 11,11 11),LINESTRING(11 11,10 10))");
503 ASSERT_STRING_EQUAL(
str,
"GEOMETRYCOLLECTION(LINESTRING(10 10,10 11),LINESTRING(10 11,11 11),LINESTRING(11 11,10 10))");
508 in =
lwgeom_from_text(
"GEOMETRYCOLLECTION(LINESTRING(4 4,4 8),CIRCULARSTRING(4 8,6 10,8 8),LINESTRING(8 8,8 4))");
515 ASSERT_STRING_EQUAL(
str,
"GEOMETRYCOLLECTION(LINESTRING(4 4,4 8),CIRCULARSTRING(4 8,6 10,8 8),LINESTRING(8 8,8 4))");
527 CU_pSuite suite = CU_add_suite(
"lwstroke", NULL, NULL);
static void test_unstroke()
static char * lwgeom_to_text(const LWGEOM *geom, int prec)
static void test_lwcurve_linearize(void)
static LWGEOM * lwgeom_from_text(const char *str)
void lwstroke_suite_setup(void)
void cu_error_msg_reset()
char cu_error_msg[MAX_CUNIT_ERROR_LENGTH+1]
#define ASSERT_INT_EQUAL(o, e)
#define PG_ADD_TEST(suite, testfunc)
#define ASSERT_STRING_EQUAL(o, e)
@ LW_LINEARIZE_TOLERANCE_TYPE_MAX_ANGLE
Tolerance expresses the maximum angle between the radii generating approximation line vertices,...
@ LW_LINEARIZE_TOLERANCE_TYPE_SEGS_PER_QUAD
Tolerance expresses the number of segments to use for each quarter of circle (quadrant).
@ LW_LINEARIZE_TOLERANCE_TYPE_MAX_DEVIATION
Tolerance expresses the maximum distance between an arbitrary point on the curve and the closest poin...
char lwgeom_same(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2)
geom1 same as geom2 iff
void lwgeom_free(LWGEOM *geom)
LWGEOM * lwcurve_linearize(const LWGEOM *geom, double tol, LW_LINEARIZE_TOLERANCE_TYPE type, int flags)
#define LW_PARSER_CHECK_NONE
LWGEOM * lwgeom_unstroke(const LWGEOM *geom)
LWGEOM * lwgeom_stroke(const LWGEOM *geom, uint32_t perQuad)
int lwgeom_parse_wkt(LWGEOM_PARSER_RESULT *parser_result, char *wktstr, int parse_flags)
Parse a WKT geometry string into an LWGEOM structure.
uint32_t lwgeom_count_vertices(const LWGEOM *geom)
Count the total number of vertices in any LWGEOM.
@ LW_LINEARIZE_FLAG_SYMMETRIC
Symmetric linearization means that the output vertices would be the same no matter the order of the p...
@ LW_LINEARIZE_FLAG_RETAIN_ANGLE
Retain angle instructs the engine to try its best to retain the requested angle between generating ra...
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
LWGEOM * lwgeom_grid(const LWGEOM *lwgeom, const gridspec *grid)
void lwgeom_reverse_in_place(LWGEOM *lwgeom)
Reverse vertex order of LWGEOM.
Parser result structure: returns the result of attempting to convert (E)WKT/(E)WKB to LWGEOM.