PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ ptarray_locate_along()

static POINTARRAY* ptarray_locate_along ( const POINTARRAY pa,
double  m,
double  offset 
)
static

Definition at line 79 of file lwlinearreferencing.c.

80 {
81  uint32_t i;
82  POINT4D p1, p2, pn;
83  POINTARRAY *dpa = NULL;
84 
85  /* Can't do anything with degenerate point arrays */
86  if ( ! pa || pa->npoints < 2 ) return NULL;
87 
88  /* Walk through each segment in the point array */
89  for ( i = 1; i < pa->npoints; i++ )
90  {
91  getPoint4d_p(pa, i-1, &p1);
92  getPoint4d_p(pa, i, &p2);
93 
94  /* No derived point? Move to next segment. */
95  if ( segment_locate_along(&p1, &p2, m, offset, &pn) == LW_FALSE )
96  continue;
97 
98  /* No pointarray, make a fresh one */
99  if ( dpa == NULL )
101 
102  /* Add our new point to the array */
103  ptarray_append_point(dpa, &pn, 0);
104  }
105 
106  return dpa;
107 }
#define LW_FALSE
Definition: liblwgeom.h:77
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition: ptarray.c:70
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
Definition: lwgeom_api.c:123
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,...
Definition: ptarray.c:156
int ptarray_has_z(const POINTARRAY *pa)
Definition: ptarray.c:36
int ptarray_has_m(const POINTARRAY *pa)
Definition: ptarray.c:43
static int segment_locate_along(const POINT4D *p1, const POINT4D *p2, double m, double offset, POINT4D *pn)
uint32_t npoints
Definition: liblwgeom.h:374
unsigned int uint32_t
Definition: uthash.h:78

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

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