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

Definition at line 1228 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().

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

Here is the call graph for this function:

Here is the caller graph for this function: