PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ test_misc_simplify()

static void test_misc_simplify ( void  )
static

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

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 
66  geom = lwgeom_from_wkt("POLYGON((0 0,1 1,1 3,0 4,-2 3,-1 1,0 0))", LW_PARSER_CHECK_NONE);
67  geom2d = lwgeom_simplify(geom, 1, LW_FALSE);
68  wkt_out = lwgeom_to_ewkt(geom2d);
69  CU_ASSERT_STRING_EQUAL("POLYGON((0 0,0 4,-2 3,0 0))", wkt_out);
70  lwgeom_free(geom);
71  lwgeom_free(geom2d);
72  lwfree(wkt_out);
73 }
LWGEOM * lwgeom_simplify(const LWGEOM *igeom, double dist, int preserve_collapsed)
Simplification.
Definition: lwgeom.c:1848
#define LW_FALSE
Definition: liblwgeom.h:108
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2060
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:547
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: