PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ test_lwgeom_is_trajectory()

static void test_lwgeom_is_trajectory ( void  )
static

Definition at line 1399 of file cu_measures.c.

1400 {
1401  LWGEOM *g;
1402  int ret;
1403 
1404  g = lwgeom_from_wkt("POINT M(0 0 1)", LW_PARSER_CHECK_NONE);
1405  ret = lwgeom_is_trajectory(g);
1406  lwgeom_free(g);
1407  ASSERT_INT_EQUAL(ret, LW_FALSE); /* not a linestring */
1408 
1409  g = lwgeom_from_wkt("LINESTRING Z(0 0 1, 0 0 1)", LW_PARSER_CHECK_NONE);
1410  ret = lwgeom_is_trajectory(g);
1411  lwgeom_free(g);
1412  ASSERT_INT_EQUAL(ret, LW_FALSE); /* no measure */
1413 
1414  g = lwgeom_from_wkt("LINESTRING M(0 0 1, 0 0 1)", LW_PARSER_CHECK_NONE);
1415  ret = lwgeom_is_trajectory(g);
1416  lwgeom_free(g);
1417  ASSERT_INT_EQUAL(ret, LW_FALSE); /* same measure in two points */
1418 
1419  g = lwgeom_from_wkt("LINESTRING M(0 0 1, 0 0 0)", LW_PARSER_CHECK_NONE);
1420  ret = lwgeom_is_trajectory(g);
1421  lwgeom_free(g);
1422  ASSERT_INT_EQUAL(ret, LW_FALSE); /* backward measure */
1423 
1424  g = lwgeom_from_wkt("LINESTRING M(0 0 1, 1 0 3, 2 2 2)", LW_PARSER_CHECK_NONE);
1425  ret = lwgeom_is_trajectory(g);
1426  lwgeom_free(g);
1427  ASSERT_INT_EQUAL(ret, LW_FALSE); /* backward measure */
1428 
1429  g = lwgeom_from_wkt("LINESTRING M(0 0 1, 0 0 2)", LW_PARSER_CHECK_NONE);
1430  ret = lwgeom_is_trajectory(g);
1431  lwgeom_free(g);
1432  ASSERT_INT_EQUAL(ret, LW_TRUE); /* ok (still) */
1433 
1434  g = lwgeom_from_wkt("LINESTRING M EMPTY", LW_PARSER_CHECK_NONE);
1435  ret = lwgeom_is_trajectory(g);
1436  lwgeom_free(g);
1437  ASSERT_INT_EQUAL(ret, LW_TRUE); /* ok (empty) */
1438 
1439  g = lwgeom_from_wkt("LINESTRING M (0 0 1)", LW_PARSER_CHECK_NONE);
1440  ret = lwgeom_is_trajectory(g);
1441  lwgeom_free(g);
1442  ASSERT_INT_EQUAL(ret, LW_TRUE); /* ok (corner case) */
1443 }
#define ASSERT_INT_EQUAL(o, e)
#define LW_FALSE
Definition: liblwgeom.h:77
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2005
int lwgeom_is_trajectory(const LWGEOM *geom)
Return LW_TRUE or LW_FALSE depending on whether or not a geometry is a linestring with measure value ...
Definition: lwgeom.c:2472
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76

References ASSERT_INT_EQUAL, LW_FALSE, LW_PARSER_CHECK_NONE, LW_TRUE, lwgeom_free(), lwgeom_from_wkt(), and lwgeom_is_trajectory().

Referenced by measures_suite_setup().

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