27 CU_ASSERT_STRING_EQUAL(
"TRIANGLE((0 1,2 3,4 5,0 1))", tmp);
35 CU_ASSERT_STRING_EQUAL(
"TRIANGLEM((0 1 2,3 4 5,6 7 8,0 1 2))", tmp);
41 CU_ASSERT_STRING_EQUAL(
"can not mix dimensionality in a geometry",
cu_error_msg);
47 CU_ASSERT_STRING_EQUAL(
"geometry contains non-closed rings",
cu_error_msg);
53 CU_ASSERT_STRING_EQUAL(
"geometry contains non-closed rings",
cu_error_msg);
59 CU_ASSERT_STRING_EQUAL(
"geometry contains non-closed rings",
cu_error_msg);
65 CU_ASSERT_STRING_EQUAL(
"triangle must have exactly 4 points",
cu_error_msg);
71 CU_ASSERT_STRING_EQUAL(
"triangle must have exactly 4 points",
cu_error_msg);
77 CU_ASSERT_STRING_EQUAL(
"parse error - invalid geometry",
cu_error_msg);
86 CU_ASSERT_STRING_EQUAL(
"TRIANGLE EMPTY", tmp);
94 CU_ASSERT_EQUAL(geom->
srid, 4326);
96 CU_ASSERT_STRING_EQUAL(
"SRID=4326;TRIANGLE((0 1 2,3 4 5,6 7 8,0 1 2))", tmp);
122 CU_ASSERT_STRING_EQUAL(
"TIN EMPTY", tmp);
131 CU_ASSERT_STRING_EQUAL(
"TIN(((0 1,2 3,4 5,0 1)))", tmp);
140 CU_ASSERT_STRING_EQUAL(
"TINM(((0 1 2,3 4 5,6 7 8,0 1 2)))", tmp);
146 CU_ASSERT_STRING_EQUAL(
"can not mix dimensionality in a geometry",
cu_error_msg);
152 CU_ASSERT_STRING_EQUAL(
"geometry contains non-closed rings",
cu_error_msg);
158 CU_ASSERT_STRING_EQUAL(
"geometry contains non-closed rings",
cu_error_msg);
164 CU_ASSERT_STRING_EQUAL(
"geometry contains non-closed rings",
cu_error_msg);
170 CU_ASSERT_STRING_EQUAL(
"triangle must have exactly 4 points",
cu_error_msg);
176 CU_ASSERT_STRING_EQUAL(
"triangle must have exactly 4 points",
cu_error_msg);
182 CU_ASSERT_STRING_EQUAL(
"parse error - invalid geometry",
cu_error_msg);
191 CU_ASSERT_STRING_EQUAL(
"TIN EMPTY", tmp);
196 geom =
lwgeom_from_wkt(
"TIN(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))",
LW_PARSER_CHECK_NONE);
201 CU_ASSERT_STRING_EQUAL(
"TIN(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))", tmp);
206 geom =
lwgeom_from_wkt(
"TIN(((0 0 0 0,0 0 1 0,0 1 0 2,0 0 0 0)),((0 0 0 0,0 1 0 0,1 0 0 4,0 0 0 0)),((0 0 0 0,1 0 0 0,0 0 1 6,0 0 0 0)),((1 0 0 0,0 1 0 0,0 0 1 0,1 0 0 0)))",
LW_PARSER_CHECK_NONE);
212 CU_ASSERT_STRING_EQUAL(
"TIN(((0 0 0 0,0 0 1 0,0 1 0 2,0 0 0 0)),((0 0 0 0,0 1 0 0,1 0 0 4,0 0 0 0)),((0 0 0 0,1 0 0 0,0 0 1 6,0 0 0 0)),((1 0 0 0,0 1 0 0,0 0 1 0,1 0 0 0)))", tmp);
217 geom =
lwgeom_from_wkt(
"SRID=4326;TIN(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))",
LW_PARSER_CHECK_NONE);
220 CU_ASSERT_EQUAL(geom->
srid, 4326);
222 CU_ASSERT_STRING_EQUAL(
"SRID=4326;TIN(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))", tmp);
248 CU_ASSERT_STRING_EQUAL(
"010F00000001000000010300000001000000040000000000000000000000000000000000F03F00000000000000400000000000000840000000000000104000000000000014400000000000000000000000000000F03F", tmp);
251 CU_ASSERT_STRING_EQUAL(
"POLYHEDRALSURFACE(((0 1,2 3,4 5,0 1)))", tmp);
260 CU_ASSERT_STRING_EQUAL(
"POLYHEDRALSURFACEM(((0 1 2,3 4 5,6 7 8,0 1 2)))", tmp);
263 CU_ASSERT_STRING_EQUAL(
"010F00004001000000010300004001000000040000000000000000000000000000000000F03F000000000000004000000000000008400000000000001040000000000000144000000000000018400000000000001C4000000000000020400000000000000000000000000000F03F0000000000000040", tmp);
269 CU_ASSERT_STRING_EQUAL(
"can not mix dimensionality in a geometry",
cu_error_msg);
278 CU_ASSERT_STRING_EQUAL(
"POLYHEDRALSURFACE(((0 1 2,3 4 5,6 7 8,0 1 2),(9 10 11,12 13 14,15 16 17,9 10 11)))", tmp);
281 CU_ASSERT_STRING_EQUAL(
"010F00008001000000010300008002000000040000000000000000000000000000000000F03F000000000000004000000000000008400000000000001040000000000000144000000000000018400000000000001C4000000000000020400000000000000000000000000000F03F00000000000000400400000000000000000022400000000000002440000000000000264000000000000028400000000000002A400000000000002C400000000000002E4000000000000030400000000000003140000000000000224000000000000024400000000000002640", tmp);
287 CU_ASSERT_STRING_EQUAL(
"geometry contains non-closed rings",
cu_error_msg);
293 CU_ASSERT_STRING_EQUAL(
"geometry contains non-closed rings",
cu_error_msg);
299 CU_ASSERT_STRING_EQUAL(
"geometry contains non-closed rings",
cu_error_msg);
305 CU_ASSERT_STRING_EQUAL(
"geometry requires more points",
cu_error_msg);
314 CU_ASSERT_STRING_EQUAL(
"010F00000000000000", tmp);
317 CU_ASSERT_STRING_EQUAL(
"POLYHEDRALSURFACE EMPTY", tmp);
322 geom =
lwgeom_from_wkt(
"POLYHEDRALSURFACE(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))",
LW_PARSER_CHECK_NONE);
327 CU_ASSERT_STRING_EQUAL(
"POLYHEDRALSURFACE(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))", tmp);
330 CU_ASSERT_STRING_EQUAL(
"010F000080040000000103000080010000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F03F0000000000000000000000000000F03F0000000000000000000000000000000000000000000000000000000000000000010300008001000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000F03F0000000000000000000000000000F03F0000000000000000000000000000000000000000000000000000000000000000000000000000000001030000800100000004000000000000000000000000000000000000000000000000000000000000000000F03F0000000000000000000000000000000000000000000000000000000000000000000000000000F03F00000000000000000000000000000000000000000000000001030000800100000004000000000000000000F03F000000000000000000000000000000000000000000000000000000000000F03F000000000000000000000000000000000000000000000000000000000000F03F000000000000F03F00000000000000000000000000000000", tmp);
335 geom =
lwgeom_from_wkt(
"POLYHEDRALSURFACE(((0 0 0 0,0 0 1 0,0 1 0 2,0 0 0 0)),((0 0 0 0,0 1 0 0,1 0 0 4,0 0 0 0)),((0 0 0 0,1 0 0 0,0 0 1 6,0 0 0 0)),((1 0 0 0,0 1 0 0,0 0 1 0,1 0 0 0)))",
LW_PARSER_CHECK_NONE);
341 CU_ASSERT_STRING_EQUAL(
"POLYHEDRALSURFACE(((0 0 0 0,0 0 1 0,0 1 0 2,0 0 0 0)),((0 0 0 0,0 1 0 0,1 0 0 4,0 0 0 0)),((0 0 0 0,1 0 0 0,0 0 1 6,0 0 0 0)),((1 0 0 0,0 1 0 0,0 0 1 0,1 0 0 0)))", tmp);
344 CU_ASSERT_STRING_EQUAL(
"010F0000C00400000001030000C00100000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F03F00000000000000000000000000000000000000000000F03F00000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000001030000C0010000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F03F00000000000000000000000000000000000000000000F03F000000000000000000000000000000000000000000001040000000000000000000000000000000000000000000000000000000000000000001030000C001000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000F03F00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F03F0000000000001840000000000000000000000000000000000000000000000000000000000000000001030000C00100000004000000000000000000F03F0000000000000000000000000000000000000000000000000000000000000000000000000000F03F0000000000000000000000000000000000000000000000000000000000000000000000000000F03F0000000000000000000000000000F03F000000000000000000000000000000000000000000000000", tmp);
350 geom =
lwgeom_from_wkt(
"SRID=4326;POLYHEDRALSURFACE(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))",
LW_PARSER_CHECK_NONE);
353 CU_ASSERT_EQUAL(geom->
srid, 4326);
355 CU_ASSERT_STRING_EQUAL(
"SRID=4326;POLYHEDRALSURFACE(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))", tmp);
358 CU_ASSERT_STRING_EQUAL(
"010F0000A0E6100000040000000103000080010000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F03F0000000000000000000000000000F03F0000000000000000000000000000000000000000000000000000000000000000010300008001000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000F03F0000000000000000000000000000F03F0000000000000000000000000000000000000000000000000000000000000000000000000000000001030000800100000004000000000000000000000000000000000000000000000000000000000000000000F03F0000000000000000000000000000000000000000000000000000000000000000000000000000F03F00000000000000000000000000000000000000000000000001030000800100000004000000000000000000F03F000000000000000000000000000000000000000000000000000000000000F03F000000000000000000000000000000000000000000000000000000000000F03F000000000000F03F00000000000000000000000000000000", tmp);
395 check_dimension(
"POLYHEDRALSURFACE(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))", 3);
396 check_dimension(
"TIN(((0 0 0,0 0 1,0 1 0,0 0 0)),((0 0 0,0 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,0 0 1,0 0 0)),((1 0 0,0 1 0,0 0 1,1 0 0)))", 3);
406 CU_pSuite suite = CU_add_suite(
"surface", NULL, NULL);
void surface_dimension(void)
void triangle_parse(void)
static void check_dimension(char *ewkt, int dim)
void polyhedralsurface_parse(void)
void surface_suite_setup(void)
uint32_t gserialized_get_type(const GSERIALIZED *s)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
GSERIALIZED * gserialized_from_lwgeom(LWGEOM *geom, size_t *size)
Allocate a new GSERIALIZED from an LWGEOM.
void cu_error_msg_reset()
char cu_error_msg[MAX_CUNIT_ERROR_LENGTH+1]
#define PG_ADD_TEST(suite, testfunc)
#define LW_PARSER_CHECK_ALL
void lwgeom_free(LWGEOM *geom)
#define LW_PARSER_CHECK_NONE
uint8_t * lwgeom_to_wkb(const LWGEOM *geom, uint8_t variant, size_t *size_out)
Convert LWGEOM to a char* in WKB format.
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
#define POLYHEDRALSURFACETYPE
char * lwgeom_to_hexwkb(const LWGEOM *geom, uint8_t variant, size_t *size_out)
#define FLAGS_GET_M(flags)
char * lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
WKT emitter function.
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
int lwgeom_dimensionality(const LWGEOM *geom)
Return the dimensionality (relating to point/line/poly) of an lwgeom.
#define SRID_UNKNOWN
Unknown SRID value.