PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lwmline_locate_along()

static LWMPOINT* lwmline_locate_along ( const LWMLINE lwmline,
double  m,
double  offset 
)
static

Definition at line 149 of file lwlinearreferencing.c.

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))
157  return NULL;
158 
159  /* Construct return */
161 
162  /* Locate along each sub-line */
163  for (i = 0; i < lwmline->ngeoms; i++)
164  {
165  LWMPOINT *along = lwline_locate_along(lwmline->geoms[i], m, offset);
166  if (along)
167  {
168  if (!lwgeom_is_empty((LWGEOM *)along))
169  {
170  for (j = 0; j < along->ngeoms; j++)
171  {
172  lwmpoint_add_lwpoint(lwmpoint, along->geoms[j]);
173  }
174  }
175  /* Free the containing geometry, but leave the sub-geometries around */
176  along->ngeoms = 0;
177  lwmpoint_free(along);
178  }
179  }
180  return lwmpoint;
181 }
int32_t lwgeom_get_srid(const LWGEOM *geom)
Return SRID number.
Definition: lwgeom.c:909
void lwmpoint_free(LWMPOINT *mpt)
Definition: lwmpoint.c:72
LWGEOM * lwmline_as_lwgeom(const LWMLINE *obj)
Definition: lwgeom.c:281
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
Definition: lwgeom.c:916
LWMPOINT * lwmpoint_add_lwpoint(LWMPOINT *mobj, const LWPOINT *obj)
Definition: lwmpoint.c:45
LWMPOINT * lwmpoint_construct_empty(int32_t srid, char hasz, char hasm)
Definition: lwmpoint.c:39
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
Definition: lwgeom.c:923
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition: lwinline.h:193
static LWMPOINT * lwline_locate_along(const LWLINE *lwline, double m, double offset)
LWLINE ** geoms
Definition: liblwgeom.h:533
uint32_t ngeoms
Definition: liblwgeom.h:538

References 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(), and LWMLINE::ngeoms.

Referenced by lwgeom_locate_along().

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