PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwcollection_calculate_gbox_cartesian()

static int lwcollection_calculate_gbox_cartesian ( LWCOLLECTION coll,
GBOX gbox 
)
static

Definition at line 643 of file g_box.c.

644 {
645  GBOX subbox;
646  uint32_t i;
647  int result = LW_FAILURE;
648  int first = LW_TRUE;
649  assert(coll);
650  if ( (coll->ngeoms == 0) || !gbox)
651  return LW_FAILURE;
652 
653  subbox.flags = coll->flags;
654 
655  for ( i = 0; i < coll->ngeoms; i++ )
656  {
657  if ( lwgeom_calculate_gbox_cartesian((LWGEOM*)(coll->geoms[i]), &subbox) == LW_SUCCESS )
658  {
659  /* Keep a copy of the sub-bounding box for later
660  if ( coll->geoms[i]->bbox )
661  lwfree(coll->geoms[i]->bbox);
662  coll->geoms[i]->bbox = gbox_copy(&subbox); */
663  if ( first )
664  {
665  gbox_duplicate(&subbox, gbox);
666  first = LW_FALSE;
667  }
668  else
669  {
670  gbox_merge(&subbox, gbox);
671  }
672  result = LW_SUCCESS;
673  }
674  }
675  return result;
676 }
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:264
void gbox_duplicate(const GBOX *original, GBOX *duplicate)
Copy the values of original GBOX into duplicate.
Definition: g_box.c:440
int lwgeom_calculate_gbox_cartesian(const LWGEOM *lwgeom, GBOX *gbox)
Calculate the 2-4D bounding box of a geometry.
Definition: g_box.c:678
#define LW_FALSE
Definition: liblwgeom.h:77
#define LW_FAILURE
Definition: liblwgeom.h:79
#define LW_SUCCESS
Definition: liblwgeom.h:80
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
uint8_t flags
Definition: liblwgeom.h:294
uint32_t ngeoms
Definition: liblwgeom.h:510
uint8_t flags
Definition: liblwgeom.h:507
LWGEOM ** geoms
Definition: liblwgeom.h:512
unsigned int uint32_t
Definition: uthash.h:78

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

Referenced by lwgeom_calculate_gbox_cartesian().

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