PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ lwline_is_trajectory()

int lwline_is_trajectory ( const LWLINE line)

Definition at line 464 of file lwline.c.

465{
466 if (!FLAGS_GET_M(line->flags))
467 {
468 lwnotice("Line does not have M dimension");
469 return LW_FALSE;
470 }
471
472 uint32_t n = line->points->npoints;
473
474 if (n < 2)
475 return LW_TRUE; /* empty or single-point are "good" */
476
477 double m = -1 * FLT_MAX;
478 for (uint32_t i = 0; i < n; ++i)
479 {
480 POINT3DM p;
481 if (!getPoint3dm_p(line->points, i, &p))
482 return LW_FALSE;
483 if (p.m <= m)
484 {
485 lwnotice(
486 "Measure of vertex %d (%g) not bigger than measure of vertex %d (%g)", i, p.m, i - 1, m);
487 return LW_FALSE;
488 }
489 m = p.m;
490 }
491
492 return LW_TRUE;
493}
#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,...) __attribute__((format(printf
Write a notice out to the notice handler.
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: