PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwmline_locate_along()

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

Definition at line 148 of file lwlinearreferencing.c.

149 {
150  LWMPOINT *lwmpoint = NULL;
151  LWGEOM *lwg = lwmline_as_lwgeom(lwmline);
152  uint32_t i, j;
153 
154  /* Return degenerates upwards */
155  if ( (!lwmline) || (lwmline->ngeoms < 1) ) return NULL;
156 
157  /* Construct return */
159 
160  /* Locate along each sub-line */
161  for ( i = 0; i < lwmline->ngeoms; i++ )
162  {
163  LWMPOINT *along = lwline_locate_along(lwmline->geoms[i], m, offset);
164  if ( along )
165  {
166  if ( ! lwgeom_is_empty((LWGEOM*)along) )
167  {
168  for ( j = 0; j < along->ngeoms; j++ )
169  {
170  lwmpoint_add_lwpoint(lwmpoint, along->geoms[j]);
171  }
172  }
173  /* Free the containing geometry, but leave the sub-geometries around */
174  along->ngeoms = 0;
175  lwmpoint_free(along);
176  }
177  }
178  return lwmpoint;
179 }
int32_t lwgeom_get_srid(const LWGEOM *geom)
Return SRID number.
Definition: lwgeom.c:916
void lwmpoint_free(LWMPOINT *mpt)
Definition: lwmpoint.c:72
LWGEOM * lwmline_as_lwgeom(const LWMLINE *obj)
Definition: lwgeom.c:290
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
Definition: lwgeom.c:930
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:1393
LWMPOINT * lwmpoint_construct_empty(int 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:937
static LWMPOINT * lwline_locate_along(const LWLINE *lwline, double m, double offset)
LWLINE ** geoms
Definition: liblwgeom.h:486
uint32_t ngeoms
Definition: liblwgeom.h:484
unsigned int uint32_t
Definition: uthash.h:78

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: