PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ lwline_make_geos_friendly()

LWGEOM * lwline_make_geos_friendly ( LWLINE line)

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

292 {
293  LWGEOM* ret;
294 
296 
297  if (line->points->npoints == 1) /* 0 is fine, 2 is fine */
298  {
299 #if 1
300  /* Duplicate point */
301  line->points = ptarray_addPoint(line->points,
302  getPoint_internal(line->points, 0),
303  FLAGS_NDIMS(line->points->flags),
304  line->points->npoints);
305  ret = (LWGEOM*)line;
306 #else
307  /* Turn into a point */
308  ret = (LWGEOM*)lwpoint_construct(line->srid, 0, line->points);
309 #endif
310  return ret;
311  }
312  else
313  {
314  return (LWGEOM*)line;
315  /* return lwline_clone(line); */
316  }
317 }
static void ptarray_strip_nan_coords_in_place(POINTARRAY *pa)
POINTARRAY * ptarray_addPoint(const POINTARRAY *pa, uint8_t *p, size_t pdims, uint32_t where)
Add a point in a pointarray.
Definition: ptarray.c:522
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:179
LWPOINT * lwpoint_construct(int32_t srid, GBOX *bbox, POINTARRAY *point)
Definition: lwpoint.c:129
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: lwinline.h:77
POINTARRAY * points
Definition: liblwgeom.h:483
int32_t srid
Definition: liblwgeom.h:484
lwflags_t flags
Definition: liblwgeom.h:431
uint32_t npoints
Definition: liblwgeom.h:427

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

Referenced by lwgeom_make_geos_friendly().

Here is the call graph for this function:
Here is the caller graph for this function: