PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwcompound_get_endpoint()

LWPOINT* lwcompound_get_endpoint ( const LWCOMPOUND lwcmp)

Definition at line 254 of file lwcompound.c.

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 }
LWPOINT * lwline_get_lwpoint(const LWLINE *line, uint32_t where)
Returns freshly allocated LWPOINT that corresponds to the index where.
Definition: lwline.c:318
uint32_t ngeoms
Definition: liblwgeom.h:523
LWGEOM ** geoms
Definition: liblwgeom.h:525
POINTARRAY * points
Definition: liblwgeom.h:425
uint32_t npoints
Definition: liblwgeom.h:374

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: