PostGIS  2.1.10dev-r@@SVN_REVISION@@
LWCOLLECTION * lwcollection_grid ( LWCOLLECTION coll,
gridspec grid 
)

Definition at line 479 of file lwgeom_functions_analytic.c.

References LWCOLLECTION::geoms, lwcollection_construct(), lwcollection_construct_empty(), lwgeom_grid(), LWCOLLECTION::ngeoms, LWCOLLECTION::srid, and LWCOLLECTION::type.

Referenced by lwgeom_grid().

480 {
481  uint32 i;
482  LWGEOM **geoms;
483  uint32 ngeoms=0;
484 
485  geoms = palloc(coll->ngeoms * sizeof(LWGEOM *));
486 
487  for (i=0; i<coll->ngeoms; i++)
488  {
489  LWGEOM *g = lwgeom_grid(coll->geoms[i], grid);
490  if ( g ) geoms[ngeoms++] = g;
491  }
492 
493  if ( ! ngeoms ) return lwcollection_construct_empty(coll->type, coll->srid, 0, 0);
494 
495  return lwcollection_construct(coll->type, coll->srid,
496  NULL, ngeoms, geoms);
497 }
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:30
uint8_t type
Definition: liblwgeom.h:459
unsigned int uint32
Definition: shpopen.c:274
LWGEOM ** geoms
Definition: liblwgeom.h:465
int32_t srid
Definition: liblwgeom.h:462
LWGEOM * lwgeom_grid(LWGEOM *lwgeom, gridspec *grid)
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
Definition: lwcollection.c:81

Here is the call graph for this function:

Here is the caller graph for this function: