PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ lwcompound_get_endpoint()

LWPOINT* lwcompound_get_endpoint ( const LWCOMPOUND lwcmp)

Definition at line 254 of file lwcompound.c.

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

Referenced by LWGEOM_endpoint_linestring().

255 {
256  LWLINE *lwline;
257  if ( lwcmp->ngeoms < 1 )
258  {
259  return NULL;
260  }
261 
262  lwline = (LWLINE*)(lwcmp->geoms[lwcmp->ngeoms-1]);
263 
264  if ( (!lwline) || (!lwline->points) || (lwline->points->npoints < 1) )
265  {
266  return NULL;
267  }
268 
269  return lwline_get_lwpoint(lwline, lwline->points->npoints-1);
270 }
LWGEOM ** geoms
Definition: liblwgeom.h:524
uint32_t ngeoms
Definition: liblwgeom.h:522
LWPOINT * lwline_get_lwpoint(const LWLINE *line, uint32_t where)
Returns freshly allocated LWPOINT that corresponds to the index where.
Definition: lwline.c:318
POINTARRAY * points
Definition: liblwgeom.h:424
uint32_t npoints
Definition: liblwgeom.h:373
Here is the call graph for this function:
Here is the caller graph for this function: