PostGIS  2.1.10dev-r@@SVN_REVISION@@
static int lwcollection_calculate_gbox_geodetic ( const LWCOLLECTION coll,
GBOX gbox 
)
static

Definition at line 2577 of file lwgeodetic.c.

References LWGEOM::bbox, GBOX::flags, gbox_copy(), gbox_duplicate(), gbox_merge(), LWCOLLECTION::geoms, LW_FAILURE, LW_FALSE, LW_SUCCESS, LW_TRUE, lwfree(), lwgeom_calculate_gbox_geodetic(), LWCOLLECTION::ngeoms, and result.

Referenced by lwgeom_calculate_gbox_geodetic().

2578 {
2579  GBOX subbox;
2580  int i;
2581  int result = LW_FAILURE;
2582  int first = LW_TRUE;
2583  assert(coll);
2584  if ( coll->ngeoms == 0 )
2585  return LW_FAILURE;
2586 
2587  subbox.flags = gbox->flags;
2588 
2589  for ( i = 0; i < coll->ngeoms; i++ )
2590  {
2591  if ( lwgeom_calculate_gbox_geodetic((LWGEOM*)(coll->geoms[i]), &subbox) == LW_SUCCESS )
2592  {
2593  /* Keep a copy of the sub-bounding box for later */
2594  if ( coll->geoms[i]->bbox )
2595  lwfree(coll->geoms[i]->bbox);
2596  coll->geoms[i]->bbox = gbox_copy(&subbox);
2597  if ( first )
2598  {
2599  gbox_duplicate(&subbox, gbox);
2600  first = LW_FALSE;
2601  }
2602  else
2603  {
2604  gbox_merge(&subbox, gbox);
2605  }
2606  result = LW_SUCCESS;
2607  }
2608  }
2609  return result;
2610 }
GBOX * gbox_copy(const GBOX *box)
Return a copy of the GBOX, based on dimensionality of flags.
Definition: g_box.c:362
GBOX * bbox
Definition: liblwgeom.h:354
void gbox_duplicate(const GBOX *original, GBOX *duplicate)
Copy the values of original GBOX into duplicate.
Definition: g_box.c:369
void lwfree(void *mem)
Definition: lwutil.c:190
#define LW_SUCCESS
Definition: liblwgeom.h:55
char ** result
Definition: liblwgeom.h:218
int gbox_merge(const GBOX *new_box, GBOX *merge_box)
Update the merged GBOX to be large enough to include itself and the new box.
Definition: g_box.c:215
#define LW_FAILURE
Definition: liblwgeom.h:54
#define LW_FALSE
Definition: liblwgeom.h:52
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:51
LWGEOM ** geoms
Definition: liblwgeom.h:465
int lwgeom_calculate_gbox_geodetic(const LWGEOM *geom, GBOX *gbox)
Calculate the geodetic bounding box for an LWGEOM.
Definition: lwgeodetic.c:2612
uint8_t flags
Definition: liblwgeom.h:247

Here is the call graph for this function:

Here is the caller graph for this function: