PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ test_force_2d()

static void test_force_2d ( void  )
static

Definition at line 23 of file cu_force_dims.c.

24{
25 LWGEOM *geom;
26 LWGEOM *geom2d;
27 char *wkt_out;
28
29 geom = lwgeom_from_wkt("CIRCULARSTRINGM(-5 0 4,0 5 3,5 0 2,10 -5 1,15 0 0)", LW_PARSER_CHECK_NONE);
30 geom2d = lwgeom_force_2d(geom);
31 wkt_out = lwgeom_to_ewkt(geom2d);
32 ASSERT_STRING_EQUAL("CIRCULARSTRING(-5 0,0 5,5 0,10 -5,15 0)", wkt_out);
33 lwgeom_free(geom);
34 lwgeom_free(geom2d);
35 lwfree(wkt_out);
36
37 geom = lwgeom_from_wkt(
38 "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)))",
40 geom2d = lwgeom_force_2d(geom);
41 wkt_out = lwgeom_to_ewkt(geom2d);
43 "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)))",
44 wkt_out);
45 lwgeom_free(geom);
46 lwgeom_free(geom2d);
47 lwfree(wkt_out);
48}
#define ASSERT_STRING_EQUAL(o, e)
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
#define LW_PARSER_CHECK_NONE
Definition liblwgeom.h:2149
LWGEOM * lwgeom_force_2d(const LWGEOM *geom)
Strip out the Z/M components of an LWGEOM.
Definition lwgeom.c:821
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an allocated string.
Definition lwgeom.c:593
void lwfree(void *mem)
Definition lwutil.c:248
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition lwin_wkt.c:940

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

Referenced by force_dims_suite_setup().

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