PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ lwline_make_geos_friendly()

LWGEOM * lwline_make_geos_friendly ( LWLINE line)

Definition at line 256 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().

257 {
258  LWGEOM* ret;
259 
260  if (line->points->npoints == 1) /* 0 is fine, 2 is fine */
261  {
262 #if 1
263  /* Duplicate point */
264  line->points = ptarray_addPoint(line->points,
265  getPoint_internal(line->points, 0),
266  FLAGS_NDIMS(line->points->flags),
267  line->points->npoints);
268  ret = (LWGEOM*)line;
269 #else
270  /* Turn into a point */
271  ret = (LWGEOM*)lwpoint_construct(line->srid, 0, line->points);
272 #endif
273  return ret;
274  }
275  else
276  {
277  return (LWGEOM*)line;
278  /* return lwline_clone(line); */
279  }
280 }
int32_t srid
Definition: liblwgeom.h:423
POINTARRAY * ptarray_addPoint(const POINTARRAY *pa, uint8_t *p, size_t pdims, uint32_t where)
Add a point in a pointarray.
Definition: ptarray.c:503
uint8_t flags
Definition: liblwgeom.h:371
uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
Definition: ptarray.c:1750
LWPOINT * lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point)
Definition: lwpoint.c:129
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:151
POINTARRAY * points
Definition: liblwgeom.h:424
uint32_t npoints
Definition: liblwgeom.h:373
Here is the call graph for this function:
Here is the caller graph for this function: