PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ lwcollection_segmentize2d()

LWCOLLECTION* lwcollection_segmentize2d ( LWCOLLECTION coll,
double  dist 
)

Definition at line 236 of file lwcollection.c.

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

Referenced by lwgeom_segmentize2d().

237 {
238  uint32_t i;
239  LWGEOM **newgeoms;
240 
241  if ( ! col->ngeoms ) return lwcollection_clone(col);
242 
243  newgeoms = lwalloc(sizeof(LWGEOM *)*col->ngeoms);
244  for (i=0; i<col->ngeoms; i++)
245  {
246  newgeoms[i] = lwgeom_segmentize2d(col->geoms[i], dist);
247  if ( ! newgeoms[i] ) {
248  while (i--) lwgeom_free(newgeoms[i]);
249  lwfree(newgeoms);
250  return NULL;
251  }
252  }
253 
254  return lwcollection_construct(col->type, col->srid, NULL, col->ngeoms, newgeoms);
255 }
void lwfree(void *mem)
Definition: lwutil.c:242
LWCOLLECTION * lwcollection_clone(const LWCOLLECTION *g)
Clone LWCOLLECTION object.
Definition: lwcollection.c:123
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1063
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:43
LWGEOM * lwgeom_segmentize2d(LWGEOM *line, double dist)
Definition: lwgeom.c:681
void * lwalloc(size_t size)
Definition: lwutil.c:227
Here is the call graph for this function:
Here is the caller graph for this function: