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

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

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

Here is the call graph for this function:

Here is the caller graph for this function: