PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ lwcompound_get_endpoint()

LWPOINT* lwcompound_get_endpoint ( const LWCOMPOUND lwcmp)

Definition at line 297 of file lwcompound.c.

298 {
299  LWLINE *lwline;
300  if ( lwcmp->ngeoms < 1 )
301  {
302  return NULL;
303  }
304 
305  lwline = (LWLINE*)(lwcmp->geoms[lwcmp->ngeoms-1]);
306 
307  if ( (!lwline) || (!lwline->points) || (lwline->points->npoints < 1) )
308  {
309  return NULL;
310  }
311 
312  return lwline_get_lwpoint(lwline, lwline->points->npoints-1);
313 }
LWPOINT * lwline_get_lwpoint(const LWLINE *line, uint32_t where)
Returns freshly allocated LWPOINT that corresponds to the index where.
Definition: lwline.c:309
uint32_t ngeoms
Definition: liblwgeom.h:594
LWGEOM ** geoms
Definition: liblwgeom.h:589
POINTARRAY * points
Definition: liblwgeom.h:483
uint32_t npoints
Definition: liblwgeom.h:427

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

Referenced by LWGEOM_endpoint_linestring().

Here is the call graph for this function:
Here is the caller graph for this function: