PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ test_misc_simplify()

static void test_misc_simplify ( void  )
static

Definition at line 23 of file liblwgeom/cunit/cu_misc.c.

24 {
25  LWGEOM *geom;
26  LWGEOM *geom2d;
27  char *wkt_out;
28 
29  geom = lwgeom_from_wkt("LINESTRING(0 0,0 10,0 51,50 20,30 20,7 32)", LW_PARSER_CHECK_NONE);
30  geom2d = lwgeom_simplify(geom, 2, LW_FALSE);
31  wkt_out = lwgeom_to_ewkt(geom2d);
32  CU_ASSERT_STRING_EQUAL("LINESTRING(0 0,0 51,50 20,30 20,7 32)",wkt_out);
33  lwgeom_free(geom);
34  lwgeom_free(geom2d);
35  lwfree(wkt_out);
36 
37  geom = lwgeom_from_wkt("MULTILINESTRING((0 0,0 10,0 51,50 20,30 20,7 32))", LW_PARSER_CHECK_NONE);
38  geom2d = lwgeom_simplify(geom, 2, LW_FALSE);
39  wkt_out = lwgeom_to_ewkt(geom2d);
40  CU_ASSERT_STRING_EQUAL("MULTILINESTRING((0 0,0 51,50 20,30 20,7 32))",wkt_out);
41  lwgeom_free(geom);
42  lwgeom_free(geom2d);
43  lwfree(wkt_out);
44 
45  geom = lwgeom_from_wkt("POLYGON((0 0,1 1,1 3,0 4,-2 3,-1 1,0 0))", LW_PARSER_CHECK_NONE);
46  geom2d = lwgeom_simplify(geom, 1, LW_FALSE);
47  wkt_out = lwgeom_to_ewkt(geom2d);
48  CU_ASSERT_STRING_EQUAL("POLYGON((0 0,0 4,-2 3,0 0))", wkt_out);
49  lwgeom_free(geom);
50  lwgeom_free(geom2d);
51  lwfree(wkt_out);
52 }
LWGEOM * lwgeom_simplify(const LWGEOM *igeom, double dist, int preserve_collapsed)
Simplification.
Definition: lwgeom.c:1870
#define LW_FALSE
Definition: liblwgeom.h:94
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1155
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2114
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:565
void lwfree(void *mem)
Definition: lwutil.c:242
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:905

References LW_FALSE, LW_PARSER_CHECK_NONE, lwfree(), lwgeom_free(), lwgeom_from_wkt(), lwgeom_simplify(), and lwgeom_to_ewkt().

Referenced by misc_suite_setup().

Here is the call graph for this function:
Here is the caller graph for this function: