PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ lwline_is_trajectory()

int lwline_is_trajectory ( const LWLINE line)

Definition at line 454 of file lwline.c.

455 {
456  if (!FLAGS_GET_M(line->flags))
457  {
458  lwnotice("Line does not have M dimension");
459  return LW_FALSE;
460  }
461 
462  uint32_t n = line->points->npoints;
463 
464  if (n < 2)
465  return LW_TRUE; /* empty or single-point are "good" */
466 
467  double m = -1 * FLT_MAX;
468  for (uint32_t i = 0; i < n; ++i)
469  {
470  POINT3DM p;
471  if (!getPoint3dm_p(line->points, i, &p))
472  return LW_FALSE;
473  if (p.m <= m)
474  {
475  lwnotice(
476  "Measure of vertex %d (%g) not bigger than measure of vertex %d (%g)", i, p.m, i - 1, m);
477  return LW_FALSE;
478  }
479  m = p.m;
480  }
481 
482  return LW_TRUE;
483 }
#define LW_FALSE
Definition: liblwgeom.h:94
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:166
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:93
int getPoint3dm_p(const POINTARRAY *pa, uint32_t n, POINT3DM *point)
Definition: lwgeom_api.c:268
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:177
lwflags_t flags
Definition: liblwgeom.h:485
POINTARRAY * points
Definition: liblwgeom.h:483
double m
Definition: liblwgeom.h:408
uint32_t npoints
Definition: liblwgeom.h:427

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

Here is the call graph for this function:
Here is the caller graph for this function: