PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ test_misc_simplify()

static void test_misc_simplify ( void  )
static

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

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

Referenced by misc_suite_setup().

45 {
46  LWGEOM *geom;
47  LWGEOM *geom2d;
48  char *wkt_out;
49 
50  geom = lwgeom_from_wkt("LINESTRING(0 0,0 10,0 51,50 20,30 20,7 32)", LW_PARSER_CHECK_NONE);
51  geom2d = lwgeom_simplify(geom, 2, LW_FALSE);
52  wkt_out = lwgeom_to_ewkt(geom2d);
53  CU_ASSERT_STRING_EQUAL("LINESTRING(0 0,0 51,50 20,30 20,7 32)",wkt_out);
54  lwgeom_free(geom);
55  lwgeom_free(geom2d);
56  lwfree(wkt_out);
57 
58  geom = lwgeom_from_wkt("MULTILINESTRING((0 0,0 10,0 51,50 20,30 20,7 32))", LW_PARSER_CHECK_NONE);
59  geom2d = lwgeom_simplify(geom, 2, LW_FALSE);
60  wkt_out = lwgeom_to_ewkt(geom2d);
61  CU_ASSERT_STRING_EQUAL("MULTILINESTRING((0 0,0 51,50 20,30 20,7 32))",wkt_out);
62  lwgeom_free(geom);
63  lwgeom_free(geom2d);
64  lwfree(wkt_out);
65 }
void lwfree(void *mem)
Definition: lwutil.c:244
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:518
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2013
#define LW_FALSE
Definition: liblwgeom.h:77
LWGEOM * lwgeom_simplify(const LWGEOM *igeom, double dist, int preserve_collapsed)
Definition: lwgeom.c:1602
Here is the call graph for this function:
Here is the caller graph for this function: