PostGIS  3.6.1dev-r@@SVN_REVISION@@

◆ lwcompound_get_endpoint()

LWPOINT* lwcompound_get_endpoint ( const LWCOMPOUND lwcmp)

Definition at line 282 of file lwcompound.c.

283 {
284  LWLINE *lwline;
285  if ( lwcmp->ngeoms < 1 )
286  {
287  return NULL;
288  }
289 
290  lwline = (LWLINE*)(lwcmp->geoms[lwcmp->ngeoms-1]);
291 
292  if ( (!lwline) || (!lwline->points) || (lwline->points->npoints < 1) )
293  {
294  return NULL;
295  }
296 
297  return lwline_get_lwpoint(lwline, lwline->points->npoints-1);
298 }
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: