PostGIS  2.1.10dev-r@@SVN_REVISION@@
LWGEOM * lwline_make_geos_friendly ( LWLINE line)

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

283 {
284  LWGEOM *ret;
285 
286  if (line->points->npoints == 1) /* 0 is fine, 2 is fine */
287  {
288 #if 1
289  /* Duplicate point */
290  line->points = ptarray_addPoint(line->points,
291  getPoint_internal(line->points, 0),
292  FLAGS_NDIMS(line->points->flags),
293  line->points->npoints);
294  ret = (LWGEOM*)line;
295 #else
296  /* Turn into a point */
297  ret = (LWGEOM*)lwpoint_construct(line->srid, 0, line->points);
298 #endif
299  return ret;
300  }
301  else
302  {
303  return (LWGEOM*)line;
304  /* return lwline_clone(line); */
305  }
306 }
int npoints
Definition: liblwgeom.h:327
int32_t srid
Definition: liblwgeom.h:377
POINTARRAY * ptarray_addPoint(const POINTARRAY *pa, uint8_t *p, size_t pdims, uint32_t where)
Add a point in a pointarray.
Definition: ptarray.c:481
uint8_t flags
Definition: liblwgeom.h:325
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
Definition: ptarray.c:1645
LWPOINT * lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point)
Definition: lwpoint.c:96
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:118
POINTARRAY * points
Definition: liblwgeom.h:378

Here is the call graph for this function:

Here is the caller graph for this function: