PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lwcollection_segmentize2d()

LWCOLLECTION* lwcollection_segmentize2d ( const LWCOLLECTION coll,
double  dist 
)

Definition at line 251 of file lwcollection.c.

252 {
253  uint32_t i, j;
254  LWGEOM** newgeoms;
255 
256  if (!col->ngeoms) return lwcollection_clone(col);
257 
258  newgeoms = lwalloc(sizeof(LWGEOM*) * col->ngeoms);
259  for (i = 0; i < col->ngeoms; i++)
260  {
261  newgeoms[i] = lwgeom_segmentize2d(col->geoms[i], dist);
262  if (!newgeoms[i])
263  {
264  for (j = 0; j < i; j++)
265  lwgeom_free(newgeoms[j]);
266  lwfree(newgeoms);
267  return NULL;
268  }
269  }
270 
271  return lwcollection_construct(
272  col->type, col->srid, NULL, col->ngeoms, newgeoms);
273 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138
LWGEOM * lwgeom_segmentize2d(const LWGEOM *line, double dist)
Definition: lwgeom.c:753
void lwfree(void *mem)
Definition: lwutil.c:242
void * lwalloc(size_t size)
Definition: lwutil.c:227
LWCOLLECTION * lwcollection_clone(const LWCOLLECTION *g)
Clone LWCOLLECTION object.
Definition: lwcollection.c:124
LWCOLLECTION * lwcollection_construct(uint8_t type, int32_t srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:42

References LWCOLLECTION::geoms, lwalloc(), lwcollection_clone(), lwcollection_construct(), lwfree(), lwgeom_free(), lwgeom_segmentize2d(), LWCOLLECTION::ngeoms, LWCOLLECTION::srid, and LWCOLLECTION::type.

Referenced by lwgeom_segmentize2d().

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