PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwcollection_make_geos_friendly()

LWGEOM * lwcollection_make_geos_friendly ( LWCOLLECTION g)

Definition at line 285 of file liblwgeom/lwgeom_geos_clean.c.

286 {
287  LWGEOM** new_geoms;
288  uint32_t i, new_ngeoms = 0;
289  LWCOLLECTION* ret;
290 
291  /* enough space for all components */
292  new_geoms = lwalloc(sizeof(LWGEOM*) * g->ngeoms);
293 
294  ret = lwalloc(sizeof(LWCOLLECTION));
295  memcpy(ret, g, sizeof(LWCOLLECTION));
296  ret->maxgeoms = g->ngeoms;
297 
298  for (i = 0; i < g->ngeoms; i++)
299  {
300  LWGEOM* newg = lwgeom_make_geos_friendly(g->geoms[i]);
301  if (newg) new_geoms[new_ngeoms++] = newg;
302  }
303 
304  ret->bbox = NULL; /* recompute later... */
305 
306  ret->ngeoms = new_ngeoms;
307  if (new_ngeoms)
308  ret->geoms = new_geoms;
309  else
310  {
311  free(new_geoms);
312  ret->geoms = NULL;
313  ret->maxgeoms = 0;
314  }
315 
316  return (LWGEOM*)ret;
317 }
static LWGEOM * lwgeom_make_geos_friendly(LWGEOM *geom)
void * lwalloc(size_t size)
Definition: lwutil.c:229
void free(void *)
uint32_t ngeoms
Definition: liblwgeom.h:510
uint32_t maxgeoms
Definition: liblwgeom.h:511
GBOX * bbox
Definition: liblwgeom.h:508
LWGEOM ** geoms
Definition: liblwgeom.h:512
unsigned int uint32_t
Definition: uthash.h:78

References LWCOLLECTION::bbox, free(), LWCOLLECTION::geoms, lwalloc(), lwgeom_make_geos_friendly(), LWCOLLECTION::maxgeoms, and LWCOLLECTION::ngeoms.

Referenced by lwgeom_make_geos_friendly().

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