PostGIS  2.2.7dev-r@@SVN_REVISION@@
int lwline_is_trajectory ( const LWLINE geom)

Definition at line 448 of file lwline.c.

References LWLINE::flags, FLAGS_GET_M, getPoint3dm_p(), LW_FALSE, LW_TRUE, lwnotice(), POINT3DM::m, POINTARRAY::npoints, and LWLINE::points.

Referenced by lwgeom_is_trajectory().

449 {
450  POINT3DM p;
451  int i, n;
452  double m = -1 * FLT_MAX;
453 
454  if ( ! FLAGS_GET_M(line->flags) ) {
455  lwnotice("Line does not have M dimension");
456  return LW_FALSE;
457  }
458 
459  n = line->points->npoints;
460  if ( n < 2 ) return LW_TRUE; /* empty or single-point are "good" */
461 
462  for (i=0; i<n; ++i) {
463  getPoint3dm_p(line->points, i, &p);
464  if ( p.m <= m ) {
465  lwnotice("Measure of vertex %d (%g) not bigger than measure of vertex %d (%g)",
466  i, p.m, i-1, m);
467  return LW_FALSE;
468  }
469  m = p.m;
470  }
471 
472  return LW_TRUE;
473 }
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:61
int getPoint3dm_p(const POINTARRAY *pa, int n, POINT3DM *point)
Definition: lwgeom_api.c:369
#define LW_FALSE
Definition: liblwgeom.h:62
double m
Definition: liblwgeom.h:330
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:61
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:125

Here is the call graph for this function:

Here is the caller graph for this function: