PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void test_misc_force_2d ( void  )
static

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

References LW_PARSER_CHECK_NONE, lwfree(), lwgeom_force_2d(), lwgeom_free(), lwgeom_from_wkt(), and lwgeom_to_ewkt().

Referenced by misc_suite_setup().

23 {
24  LWGEOM *geom;
25  LWGEOM *geom2d;
26  char *wkt_out;
27 
28  geom = lwgeom_from_wkt("CIRCULARSTRINGM(-5 0 4,0 5 3,5 0 2,10 -5 1,15 0 0)", LW_PARSER_CHECK_NONE);
29  geom2d = lwgeom_force_2d(geom);
30  wkt_out = lwgeom_to_ewkt(geom2d);
31  CU_ASSERT_STRING_EQUAL("CIRCULARSTRING(-5 0,0 5,5 0,10 -5,15 0)",wkt_out);
32  lwgeom_free(geom);
33  lwgeom_free(geom2d);
34  lwfree(wkt_out);
35 
36  geom = lwgeom_from_wkt("GEOMETRYCOLLECTION(POINT(0 0 0),LINESTRING(1 1 1,2 2 2),POLYGON((0 0 1,0 1 1,1 1 1,1 0 1,0 0 1)),CURVEPOLYGON(CIRCULARSTRING(0 0 0,1 1 1,2 2 2,1 1 1,0 0 0)))", LW_PARSER_CHECK_NONE);
37  geom2d = lwgeom_force_2d(geom);
38  wkt_out = lwgeom_to_ewkt(geom2d);
39  CU_ASSERT_STRING_EQUAL("GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(1 1,2 2),POLYGON((0 0,0 1,1 1,1 0,0 0)),CURVEPOLYGON(CIRCULARSTRING(0 0,1 1,2 2,1 1,0 0)))",wkt_out);
40  lwgeom_free(geom);
41  lwgeom_free(geom2d);
42  lwfree(wkt_out);
43 }
void lwfree(void *mem)
Definition: lwutil.c:190
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
Definition: lwgeom.c:425
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1006
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:844
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1706
LWGEOM * lwgeom_force_2d(const LWGEOM *geom)
Strip out the Z/M components of an LWGEOM.
Definition: lwgeom.c:646

Here is the call graph for this function:

Here is the caller graph for this function: