PostGIS  2.5.2dev-r@@SVN_REVISION@@

◆ lwline_is_trajectory()

int lwline_is_trajectory ( const LWLINE line)

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

464 {
465  POINT3DM p;
466  int i, n;
467  double m = -1 * FLT_MAX;
468 
469  if ( ! FLAGS_GET_M(line->flags) ) {
470  lwnotice("Line does not have M dimension");
471  return LW_FALSE;
472  }
473 
474  n = line->points->npoints;
475  if ( n < 2 ) return LW_TRUE; /* empty or single-point are "good" */
476 
477  for (i=0; i<n; ++i) {
478  getPoint3dm_p(line->points, i, &p);
479  if ( p.m <= m ) {
480  lwnotice("Measure of vertex %d (%g) not bigger than measure of vertex %d (%g)",
481  i, p.m, i-1, m);
482  return LW_FALSE;
483  }
484  m = p.m;
485  }
486 
487  return LW_TRUE;
488 }
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:177
#define LW_FALSE
Definition: liblwgeom.h:76
double m
Definition: liblwgeom.h:348
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:140
uint8_t flags
Definition: liblwgeom.h:421
int getPoint3dm_p(const POINTARRAY *pa, uint32_t n, POINT3DM *point)
Definition: lwgeom_api.c:267
POINTARRAY * points
Definition: liblwgeom.h:424
uint32_t npoints
Definition: liblwgeom.h:373
Here is the call graph for this function:
Here is the caller graph for this function: