PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwcompound_get_endpoint()

LWPOINT* lwcompound_get_endpoint ( const LWCOMPOUND lwcmp)

Definition at line 241 of file lwcompound.c.

References LWCOMPOUND::geoms, lwline_get_lwpoint(), LWCOMPOUND::ngeoms, POINTARRAY::npoints, and LWLINE::points.

Referenced by LWGEOM_endpoint_linestring().

242 {
243  LWLINE *lwline;
244  if ( lwcmp->ngeoms < 1 )
245  {
246  return NULL;
247  }
248 
249  lwline = (LWLINE*)(lwcmp->geoms[lwcmp->ngeoms-1]);
250 
251  if ( (!lwline) || (!lwline->points) || (lwline->points->npoints < 1) )
252  {
253  return NULL;
254  }
255 
256  return lwline_get_lwpoint(lwline, lwline->points->npoints-1);
257 }
int npoints
Definition: liblwgeom.h:355
LWGEOM ** geoms
Definition: liblwgeom.h:506
int ngeoms
Definition: liblwgeom.h:504
LWPOINT * lwline_get_lwpoint(const LWLINE *line, int where)
Returns freshly allocated LWPOINT that corresponds to the index where.
Definition: lwline.c:295
POINTARRAY * points
Definition: liblwgeom.h:406
Here is the call graph for this function:
Here is the caller graph for this function: