PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwline_is_trajectory()

int lwline_is_trajectory ( const LWLINE geom)

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

478 {
479  POINT3DM p;
480  int i, n;
481  double m = -1 * FLT_MAX;
482 
483  if ( ! FLAGS_GET_M(line->flags) ) {
484  lwnotice("Line does not have M dimension");
485  return LW_FALSE;
486  }
487 
488  n = line->points->npoints;
489  if ( n < 2 ) return LW_TRUE; /* empty or single-point are "good" */
490 
491  for (i=0; i<n; ++i) {
492  getPoint3dm_p(line->points, i, &p);
493  if ( p.m <= m ) {
494  lwnotice("Measure of vertex %d (%g) not bigger than measure of vertex %d (%g)",
495  i, p.m, i-1, m);
496  return LW_FALSE;
497  }
498  m = p.m;
499  }
500 
501  return LW_TRUE;
502 }
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:177
int getPoint3dm_p(const POINTARRAY *pa, int n, POINT3DM *point)
Definition: lwgeom_api.c:266
#define LW_FALSE
Definition: liblwgeom.h:77
double m
Definition: liblwgeom.h:346
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:141
Here is the call graph for this function:
Here is the caller graph for this function: