PostGIS  2.3.7dev-r@@SVN_REVISION@@
static POINTARRAY* ptarray_locate_along ( const POINTARRAY pa,
double  m,
double  offset 
)
static

Definition at line 80 of file lwlinearreferencing.c.

References getPoint4d_p(), LW_FALSE, POINTARRAY::npoints, ptarray_append_point(), ptarray_construct_empty(), ptarray_has_m(), ptarray_has_z(), and segment_locate_along().

Referenced by lwline_locate_along().

81 {
82  int i;
83  POINT4D p1, p2, pn;
84  POINTARRAY *dpa = NULL;
85 
86  /* Can't do anything with degenerate point arrays */
87  if ( ! pa || pa->npoints < 2 ) return NULL;
88 
89  /* Walk through each segment in the point array */
90  for ( i = 1; i < pa->npoints; i++ )
91  {
92  getPoint4d_p(pa, i-1, &p1);
93  getPoint4d_p(pa, i, &p2);
94 
95  /* No derived point? Move to next segment. */
96  if ( segment_locate_along(&p1, &p2, m, offset, &pn) == LW_FALSE )
97  continue;
98 
99  /* No pointarray, make a fresh one */
100  if ( dpa == NULL )
102 
103  /* Add our new point to the array */
104  ptarray_append_point(dpa, &pn, 0);
105  }
106 
107  return dpa;
108 }
int npoints
Definition: liblwgeom.h:370
static int segment_locate_along(const POINT4D *p1, const POINT4D *p2, double m, double offset, POINT4D *pn)
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition: ptarray.c:70
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int allow_duplicates)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE, then a duplicate point will not be added.
Definition: ptarray.c:156
#define LW_FALSE
Definition: liblwgeom.h:76
int ptarray_has_m(const POINTARRAY *pa)
Definition: ptarray.c:43
int ptarray_has_z(const POINTARRAY *pa)
Definition: ptarray.c:36
int getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *point)
Definition: lwgeom_api.c:244

Here is the call graph for this function:

Here is the caller graph for this function: