PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwline_make_geos_friendly()

LWGEOM * lwline_make_geos_friendly ( LWLINE line)

Definition at line 270 of file liblwgeom/lwgeom_geos_clean.c.

References POINTARRAY::flags, FLAGS_NDIMS, getPoint_internal(), lwpoint_construct(), POINTARRAY::npoints, LWLINE::points, ptarray_addPoint(), and LWLINE::srid.

Referenced by LWGEOM_GEOS_getPointN(), and lwgeom_make_geos_friendly().

271 {
272  LWGEOM *ret;
273 
274  if (line->points->npoints == 1) /* 0 is fine, 2 is fine */
275  {
276 #if 1
277  /* Duplicate point */
278  line->points = ptarray_addPoint(line->points,
279  getPoint_internal(line->points, 0),
280  FLAGS_NDIMS(line->points->flags),
281  line->points->npoints);
282  ret = (LWGEOM*)line;
283 #else
284  /* Turn into a point */
285  ret = (LWGEOM*)lwpoint_construct(line->srid, 0, line->points);
286 #endif
287  return ret;
288  }
289  else
290  {
291  return (LWGEOM*)line;
292  /* return lwline_clone(line); */
293  }
294 }
int npoints
Definition: liblwgeom.h:371
int32_t srid
Definition: liblwgeom.h:421
POINTARRAY * ptarray_addPoint(const POINTARRAY *pa, uint8_t *p, size_t pdims, uint32_t where)
Add a point in a pointarray.
Definition: ptarray.c:504
uint8_t flags
Definition: liblwgeom.h:369
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
Definition: ptarray.c:1753
LWPOINT * lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point)
Definition: lwpoint.c:129
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:152
POINTARRAY * points
Definition: liblwgeom.h:422
Here is the call graph for this function:
Here is the caller graph for this function: