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

Definition at line 127 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().

128 {
129  LWMPOINT *lwmpoint = NULL;
130  LWGEOM *lwg = lwmline_as_lwgeom(lwmline);
131  int i, j;
132 
133  /* Return degenerates upwards */
134  if ( (!lwmline) || (lwmline->ngeoms < 1) ) return NULL;
135 
136  /* Construct return */
138 
139  /* Locate along each sub-line */
140  for ( i = 0; i < lwmline->ngeoms; i++ )
141  {
142  LWMPOINT *along = lwline_locate_along(lwmline->geoms[i], m, offset);
143  if ( along )
144  {
145  if ( ! lwgeom_is_empty((LWGEOM*)along) )
146  {
147  for ( j = 0; j < along->ngeoms; j++ )
148  {
149  lwmpoint_add_lwpoint(lwmpoint, along->geoms[j]);
150  }
151  }
152  /* Free the containing geometry, but leave the sub-geometries around */
153  along->ngeoms = 0; lwmpoint_free(along);
154  }
155  }
156  return lwmpoint;
157 }
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:778
LWGEOM * lwmline_as_lwgeom(const LWMLINE *obj)
Definition: lwgeom.c:209
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
Definition: lwgeom.c:792
int ngeoms
Definition: liblwgeom.h:437
void lwmpoint_free(LWMPOINT *mpt)
Definition: lwmpoint.c:59
LWPOINT ** geoms
Definition: liblwgeom.h:426
LWMPOINT * lwmpoint_construct_empty(int srid, char hasz, char hasm)
Definition: lwmpoint.c:26
LWLINE ** geoms
Definition: liblwgeom.h:439
LWMPOINT * lwmpoint_add_lwpoint(LWMPOINT *mobj, const LWPOINT *obj)
Definition: lwmpoint.c:32
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:1229
int ngeoms
Definition: liblwgeom.h:424
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
Definition: lwgeom.c:799

Here is the call graph for this function:

Here is the caller graph for this function: