PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ lwline_add_lwpoint()

int lwline_add_lwpoint ( LWLINE line,
LWPOINT point,
uint32_t  where 
)

Add a LWPOINT to an LWLINE.

Definition at line 336 of file lwline.c.

References LWLINE::bbox, getPoint4d_p(), LW_FAILURE, LW_SUCCESS, lwgeom_refresh_bbox(), LWPOINT::point, LWLINE::points, and ptarray_insert_point().

Referenced by LWGEOM_addpoint().

337 {
338  POINT4D pt;
339  getPoint4d_p(point->point, 0, &pt);
340 
341  if ( ptarray_insert_point(line->points, &pt, where) != LW_SUCCESS )
342  return LW_FAILURE;
343 
344  /* Update the bounding box */
345  if ( line->bbox )
346  {
347  lwgeom_refresh_bbox((LWGEOM*)line);
348  }
349 
350  return LW_SUCCESS;
351 }
void lwgeom_refresh_bbox(LWGEOM *lwgeom)
Drop current bbox and calculate a fresh one.
Definition: lwgeom.c:698
GBOX * bbox
Definition: liblwgeom.h:422
#define LW_SUCCESS
Definition: liblwgeom.h:79
POINTARRAY * point
Definition: liblwgeom.h:413
#define LW_FAILURE
Definition: liblwgeom.h:78
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
Definition: lwgeom_api.c:113
int ptarray_insert_point(POINTARRAY *pa, const POINT4D *p, uint32_t where)
Insert a point into an existing POINTARRAY.
Definition: ptarray.c:96
POINTARRAY * points
Definition: liblwgeom.h:424
Here is the call graph for this function:
Here is the caller graph for this function: