PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ lwcollection_calculate_gbox_cartesian()

static int lwcollection_calculate_gbox_cartesian ( LWCOLLECTION coll,
GBOX gbox 
)
static

Definition at line 717 of file gbox.c.

718 {
719  GBOX subbox = {0};
720  uint32_t i;
721  int result = LW_FAILURE;
722  int first = LW_TRUE;
723  assert(coll);
724  if ( (coll->ngeoms == 0) || !gbox)
725  return LW_FAILURE;
726 
727  subbox.flags = coll->flags;
728 
729  for ( i = 0; i < coll->ngeoms; i++ )
730  {
731  if ( lwgeom_calculate_gbox_cartesian((LWGEOM*)(coll->geoms[i]), &subbox) == LW_SUCCESS )
732  {
733  /* Keep a copy of the sub-bounding box for later
734  if ( coll->geoms[i]->bbox )
735  lwfree(coll->geoms[i]->bbox);
736  coll->geoms[i]->bbox = gbox_copy(&subbox); */
737  if ( first )
738  {
739  gbox_duplicate(&subbox, gbox);
740  first = LW_FALSE;
741  }
742  else
743  {
744  gbox_merge(&subbox, gbox);
745  }
746  result = LW_SUCCESS;
747  }
748  }
749  return result;
750 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:267
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: gbox.c:257
void gbox_duplicate(const GBOX *original, GBOX *duplicate)
Copy the values of original GBOX into duplicate.
Definition: gbox.c:445
int lwgeom_calculate_gbox_cartesian(const LWGEOM *lwgeom, GBOX *gbox)
Calculate the 2-4D bounding box of a geometry.
Definition: gbox.c:752
#define LW_FALSE
Definition: liblwgeom.h:94
#define LW_FAILURE
Definition: liblwgeom.h:96
#define LW_SUCCESS
Definition: liblwgeom.h:97
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:93
lwflags_t flags
Definition: liblwgeom.h:353
lwflags_t flags
Definition: liblwgeom.h:577
uint32_t ngeoms
Definition: liblwgeom.h:580
LWGEOM ** geoms
Definition: liblwgeom.h:575

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().

Here is the call graph for this function:
Here is the caller graph for this function: