PostGIS  2.5.0dev-r@@SVN_REVISION@@
static void test_lwgeom_is_trajectory ( void  )
static

Definition at line 1229 of file cu_measures.c.

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().

1230 {
1231  LWGEOM *g;
1232  int ret;
1233 
1234  g = lwgeom_from_wkt("POINT M(0 0 1)", LW_PARSER_CHECK_NONE);
1235  ret = lwgeom_is_trajectory(g);
1236  lwgeom_free(g);
1237  ASSERT_INT_EQUAL(ret, LW_FALSE); /* not a linestring */
1238 
1239  g = lwgeom_from_wkt("LINESTRING Z(0 0 1, 0 0 1)", LW_PARSER_CHECK_NONE);
1240  ret = lwgeom_is_trajectory(g);
1241  lwgeom_free(g);
1242  ASSERT_INT_EQUAL(ret, LW_FALSE); /* no measure */
1243 
1244  g = lwgeom_from_wkt("LINESTRING M(0 0 1, 0 0 1)", LW_PARSER_CHECK_NONE);
1245  ret = lwgeom_is_trajectory(g);
1246  lwgeom_free(g);
1247  ASSERT_INT_EQUAL(ret, LW_FALSE); /* same measure in two points */
1248 
1249  g = lwgeom_from_wkt("LINESTRING M(0 0 1, 0 0 0)", LW_PARSER_CHECK_NONE);
1250  ret = lwgeom_is_trajectory(g);
1251  lwgeom_free(g);
1252  ASSERT_INT_EQUAL(ret, LW_FALSE); /* backward measure */
1253 
1254  g = lwgeom_from_wkt("LINESTRING M(0 0 1, 1 0 3, 2 2 2)", LW_PARSER_CHECK_NONE);
1255  ret = lwgeom_is_trajectory(g);
1256  lwgeom_free(g);
1257  ASSERT_INT_EQUAL(ret, LW_FALSE); /* backward measure */
1258 
1259  g = lwgeom_from_wkt("LINESTRING M(0 0 1, 0 0 2)", LW_PARSER_CHECK_NONE);
1260  ret = lwgeom_is_trajectory(g);
1261  lwgeom_free(g);
1262  ASSERT_INT_EQUAL(ret, LW_TRUE); /* ok (still) */
1263 
1264  g = lwgeom_from_wkt("LINESTRING M EMPTY", LW_PARSER_CHECK_NONE);
1265  ret = lwgeom_is_trajectory(g);
1266  lwgeom_free(g);
1267  ASSERT_INT_EQUAL(ret, LW_TRUE); /* ok (empty) */
1268 
1269  g = lwgeom_from_wkt("LINESTRING M (0 0 1)", LW_PARSER_CHECK_NONE);
1270  ret = lwgeom_is_trajectory(g);
1271  lwgeom_free(g);
1272  ASSERT_INT_EQUAL(ret, LW_TRUE); /* ok (corner case) */
1273 }
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:2386
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1137
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1998
#define LW_FALSE
Definition: liblwgeom.h:76
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
#define ASSERT_INT_EQUAL(o, e)

Here is the call graph for this function:

Here is the caller graph for this function: