PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwcollection_segmentize2d()

LWCOLLECTION* lwcollection_segmentize2d ( LWCOLLECTION col,
double  dist 
)

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

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