PostGIS  2.1.10dev-r@@SVN_REVISION@@
LWGEOM * lwcollection_make_geos_friendly ( LWCOLLECTION g)

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

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

Referenced by lwgeom_make_geos_friendly().

310 {
311  LWGEOM **new_geoms;
312  uint32_t i, new_ngeoms=0;
313  LWCOLLECTION *ret;
314 
315  /* enough space for all components */
316  new_geoms = lwalloc(sizeof(LWGEOM *)*g->ngeoms);
317 
318  ret = lwalloc(sizeof(LWCOLLECTION));
319  memcpy(ret, g, sizeof(LWCOLLECTION));
320  ret->maxgeoms = g->ngeoms;
321 
322  for (i=0; i<g->ngeoms; i++)
323  {
324  LWGEOM* newg = lwgeom_make_geos_friendly(g->geoms[i]);
325  if ( newg ) new_geoms[new_ngeoms++] = newg;
326  }
327 
328  ret->bbox = NULL; /* recompute later... */
329 
330  ret->ngeoms = new_ngeoms;
331  if ( new_ngeoms )
332  {
333  ret->geoms = new_geoms;
334  }
335  else
336  {
337  free(new_geoms);
338  ret->geoms = NULL;
339  ret->maxgeoms = 0;
340  }
341 
342  return (LWGEOM*)ret;
343 }
static LWGEOM * lwgeom_make_geos_friendly(LWGEOM *geom)
GBOX * bbox
Definition: liblwgeom.h:461
LWGEOM ** geoms
Definition: liblwgeom.h:465
void * lwalloc(size_t size)
Definition: lwutil.c:175

Here is the call graph for this function:

Here is the caller graph for this function: