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

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

136 {
137  LWMPOINT *lwmpoint = NULL;
138  LWGEOM *lwg = lwmline_as_lwgeom(lwmline);
139  int i, j;
140 
141  /* Return degenerates upwards */
142  if ( (!lwmline) || (lwmline->ngeoms < 1) ) return NULL;
143 
144  /* Construct return */
146 
147  /* Locate along each sub-line */
148  for ( i = 0; i < lwmline->ngeoms; i++ )
149  {
150  LWMPOINT *along = lwline_locate_along(lwmline->geoms[i], m, offset);
151  if ( along )
152  {
153  if ( ! lwgeom_is_empty((LWGEOM*)along) )
154  {
155  for ( j = 0; j < along->ngeoms; j++ )
156  {
157  lwmpoint_add_lwpoint(lwmpoint, along->geoms[j]);
158  }
159  }
160  /* Free the containing geometry, but leave the sub-geometries around */
161  along->ngeoms = 0;
162  lwmpoint_free(along);
163  }
164  }
165  return lwmpoint;
166 }
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:822
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:836
int ngeoms
Definition: liblwgeom.h:465
void lwmpoint_free(LWMPOINT *mpt)
Definition: lwmpoint.c:59
LWPOINT ** geoms
Definition: liblwgeom.h:454
LWMPOINT * lwmpoint_construct_empty(int srid, char hasz, char hasm)
Definition: lwmpoint.c:26
LWLINE ** geoms
Definition: liblwgeom.h:467
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:1297
int ngeoms
Definition: liblwgeom.h:452
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
Definition: lwgeom.c:843

Here is the call graph for this function:

Here is the caller graph for this function: