PostGIS  3.2.2dev-r@@SVN_REVISION@@

◆ lwcompound_get_endpoint()

LWPOINT* lwcompound_get_endpoint ( const LWCOMPOUND lwcmp)

Definition at line 240 of file lwcompound.c.

241 {
242  LWLINE *lwline;
243  if ( lwcmp->ngeoms < 1 )
244  {
245  return NULL;
246  }
247 
248  lwline = (LWLINE*)(lwcmp->geoms[lwcmp->ngeoms-1]);
249 
250  if ( (!lwline) || (!lwline->points) || (lwline->points->npoints < 1) )
251  {
252  return NULL;
253  }
254 
255  return lwline_get_lwpoint(lwline, lwline->points->npoints-1);
256 }
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:608
LWGEOM ** geoms
Definition: liblwgeom.h:603
POINTARRAY * points
Definition: liblwgeom.h:497
uint32_t npoints
Definition: liblwgeom.h:441

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: