PostGIS  2.4.9dev-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 }
int npoints
Definition: liblwgeom.h:371
LWGEOM ** geoms
Definition: liblwgeom.h:522
int ngeoms
Definition: liblwgeom.h:520
LWPOINT * lwline_get_lwpoint(const LWLINE *line, int where)
Returns freshly allocated LWPOINT that corresponds to the index where.
Definition: lwline.c:324
POINTARRAY * points
Definition: liblwgeom.h:422
Here is the call graph for this function:
Here is the caller graph for this function: