PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ lwcollection_segmentize2d()

LWCOLLECTION* lwcollection_segmentize2d ( const LWCOLLECTION col,
double  dist 
)

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

251 {
252  uint32_t i, j;
253  LWGEOM** newgeoms;
254 
255  if (!col->ngeoms) return lwcollection_clone(col);
256 
257  newgeoms = lwalloc(sizeof(LWGEOM*) * col->ngeoms);
258  for (i = 0; i < col->ngeoms; i++)
259  {
260  newgeoms[i] = lwgeom_segmentize2d(col->geoms[i], dist);
261  if (!newgeoms[i])
262  {
263  for (j = 0; j < i; j++)
264  lwgeom_free(newgeoms[j]);
265  lwfree(newgeoms);
266  return NULL;
267  }
268  }
269 
270  return lwcollection_construct(
271  col->type, col->srid, NULL, col->ngeoms, newgeoms);
272 }
void lwfree(void *mem)
Definition: lwutil.c:244
uint8_t type
Definition: liblwgeom.h:505
LWCOLLECTION * lwcollection_clone(const LWCOLLECTION *g)
Clone LWCOLLECTION object.
Definition: lwcollection.c:123
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
uint32_t ngeoms
Definition: liblwgeom.h:509
LWGEOM * lwgeom_segmentize2d(const LWGEOM *line, double dist)
Definition: lwgeom.c:762
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:511
int32_t srid
Definition: liblwgeom.h:508
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: