PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ test_misc_simplify()

static void test_misc_simplify ( void  )
static

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

22 {
23  LWGEOM *geom;
24  LWGEOM *geom2d;
25  char *wkt_out;
26 
27  geom = lwgeom_from_wkt("LINESTRING(0 0,0 10,0 51,50 20,30 20,7 32)", LW_PARSER_CHECK_NONE);
28  geom2d = lwgeom_simplify(geom, 2, LW_FALSE);
29  wkt_out = lwgeom_to_ewkt(geom2d);
30  CU_ASSERT_STRING_EQUAL("LINESTRING(0 0,0 51,50 20,30 20,7 32)",wkt_out);
31  lwgeom_free(geom);
32  lwgeom_free(geom2d);
33  lwfree(wkt_out);
34 
35  geom = lwgeom_from_wkt("MULTILINESTRING((0 0,0 10,0 51,50 20,30 20,7 32))", LW_PARSER_CHECK_NONE);
36  geom2d = lwgeom_simplify(geom, 2, LW_FALSE);
37  wkt_out = lwgeom_to_ewkt(geom2d);
38  CU_ASSERT_STRING_EQUAL("MULTILINESTRING((0 0,0 51,50 20,30 20,7 32))",wkt_out);
39  lwgeom_free(geom);
40  lwgeom_free(geom2d);
41  lwfree(wkt_out);
42 
43  geom = lwgeom_from_wkt("POLYGON((0 0,1 1,1 3,0 4,-2 3,-1 1,0 0))", LW_PARSER_CHECK_NONE);
44  geom2d = lwgeom_simplify(geom, 1, LW_FALSE);
45  wkt_out = lwgeom_to_ewkt(geom2d);
46  CU_ASSERT_STRING_EQUAL("POLYGON((0 0,0 4,-2 3,0 0))", wkt_out);
47  lwgeom_free(geom);
48  lwgeom_free(geom2d);
49  lwfree(wkt_out);
50 }
LWGEOM * lwgeom_simplify(const LWGEOM *igeom, double dist, int preserve_collapsed)
Simplification.
Definition: lwgeom.c:1847
#define LW_FALSE
Definition: liblwgeom.h:108
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2085
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:548
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: