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

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

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

Referenced by lwgeom_make_geos_friendly().

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

Here is the call graph for this function:

Here is the caller graph for this function: