PostGIS  2.5.0dev-r@@SVN_REVISION@@
static LWMPOINT* lwmline_locate_along ( const LWMLINE lwmline,
double  m,
double  offset 
)
static

Definition at line 149 of file lwlinearreferencing.c.

References LWMPOINT::geoms, LWMLINE::geoms, lwgeom_get_srid(), lwgeom_has_m(), lwgeom_has_z(), lwgeom_is_empty(), lwline_locate_along(), lwmline_as_lwgeom(), lwmpoint_add_lwpoint(), lwmpoint_construct_empty(), lwmpoint_free(), LWMPOINT::ngeoms, and LWMLINE::ngeoms.

Referenced by lwgeom_locate_along().

150 {
151  LWMPOINT *lwmpoint = NULL;
152  LWGEOM *lwg = lwmline_as_lwgeom(lwmline);
153  uint32_t i, j;
154 
155  /* Return degenerates upwards */
156  if ( (!lwmline) || (lwmline->ngeoms < 1) ) return NULL;
157 
158  /* Construct return */
160 
161  /* Locate along each sub-line */
162  for ( i = 0; i < lwmline->ngeoms; i++ )
163  {
164  LWMPOINT *along = lwline_locate_along(lwmline->geoms[i], m, offset);
165  if ( along )
166  {
167  if ( ! lwgeom_is_empty((LWGEOM*)along) )
168  {
169  for ( j = 0; j < along->ngeoms; j++ )
170  {
171  lwmpoint_add_lwpoint(lwmpoint, along->geoms[j]);
172  }
173  }
174  /* Free the containing geometry, but leave the sub-geometries around */
175  along->ngeoms = 0;
176  lwmpoint_free(along);
177  }
178  }
179  return lwmpoint;
180 }
uint32_t ngeoms
Definition: liblwgeom.h:467
static LWMPOINT * lwline_locate_along(const LWLINE *lwline, double m, double offset)
int32_t lwgeom_get_srid(const LWGEOM *geom)
Return SRID number.
Definition: lwgeom.c:909
LWGEOM * lwmline_as_lwgeom(const LWMLINE *obj)
Definition: lwgeom.c:289
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
Definition: lwgeom.c:923
unsigned int uint32_t
Definition: uthash.h:78
void lwmpoint_free(LWMPOINT *mpt)
Definition: lwmpoint.c:72
LWPOINT ** geoms
Definition: liblwgeom.h:469
LWMPOINT * lwmpoint_construct_empty(int srid, char hasz, char hasm)
Definition: lwmpoint.c:39
uint32_t ngeoms
Definition: liblwgeom.h:480
LWLINE ** geoms
Definition: liblwgeom.h:482
LWMPOINT * lwmpoint_add_lwpoint(LWMPOINT *mobj, const LWPOINT *obj)
Definition: lwmpoint.c:45
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
Definition: lwgeom.c:1386
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
Definition: lwgeom.c:930

Here is the call graph for this function:

Here is the caller graph for this function: