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

Definition at line 572 of file g_box.c.

References GBOX::flags, LWCOLLECTION::flags, gbox_duplicate(), gbox_merge(), LWCOLLECTION::geoms, LW_FAILURE, LW_FALSE, LW_SUCCESS, LW_TRUE, lwgeom_calculate_gbox_cartesian(), LWCOLLECTION::ngeoms, and result.

Referenced by lwgeom_calculate_gbox_cartesian().

573 {
574  GBOX subbox;
575  int i;
576  int result = LW_FAILURE;
577  int first = LW_TRUE;
578  assert(coll);
579  if ( (coll->ngeoms == 0) || !gbox)
580  return LW_FAILURE;
581 
582  subbox.flags = coll->flags;
583 
584  for ( i = 0; i < coll->ngeoms; i++ )
585  {
586  if ( lwgeom_calculate_gbox_cartesian((LWGEOM*)(coll->geoms[i]), &subbox) == LW_SUCCESS )
587  {
588  /* Keep a copy of the sub-bounding box for later
589  if ( coll->geoms[i]->bbox )
590  lwfree(coll->geoms[i]->bbox);
591  coll->geoms[i]->bbox = gbox_copy(&subbox); */
592  if ( first )
593  {
594  gbox_duplicate(&subbox, gbox);
595  first = LW_FALSE;
596  }
597  else
598  {
599  gbox_merge(&subbox, gbox);
600  }
601  result = LW_SUCCESS;
602  }
603  }
604  return result;
605 }
void gbox_duplicate(const GBOX *original, GBOX *duplicate)
Copy the values of original GBOX into duplicate.
Definition: g_box.c:369
#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
uint8_t flags
Definition: liblwgeom.h:460
#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
uint8_t flags
Definition: liblwgeom.h:247
int lwgeom_calculate_gbox_cartesian(const LWGEOM *lwgeom, GBOX *gbox)
Calculate the 2-4D bounding box of a geometry.
Definition: g_box.c:607

Here is the call graph for this function:

Here is the caller graph for this function: