PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ lwcollection_calculate_gbox_cartesian()

static int lwcollection_calculate_gbox_cartesian ( LWCOLLECTION coll,
GBOX gbox 
)
static

Definition at line 705 of file gbox.c.

706{
707 GBOX subbox;
708 uint32_t i;
709 int result = LW_FAILURE;
710 int first = LW_TRUE;
711 assert(coll);
712 if ( (coll->ngeoms == 0) || !gbox)
713 return LW_FAILURE;
714
715 subbox.flags = coll->flags;
716
717 for ( i = 0; i < coll->ngeoms; i++ )
718 {
719 if ( lwgeom_calculate_gbox_cartesian((LWGEOM*)(coll->geoms[i]), &subbox) == LW_SUCCESS )
720 {
721 /* Keep a copy of the sub-bounding box for later
722 if ( coll->geoms[i]->bbox )
723 lwfree(coll->geoms[i]->bbox);
724 coll->geoms[i]->bbox = gbox_copy(&subbox); */
725 if ( first )
726 {
727 gbox_duplicate(&subbox, gbox);
728 first = LW_FALSE;
729 }
730 else
731 {
732 gbox_merge(&subbox, gbox);
733 }
734 result = LW_SUCCESS;
735 }
736 }
737 return result;
738}
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:433
int lwgeom_calculate_gbox_cartesian(const LWGEOM *lwgeom, GBOX *gbox)
Calculate the 2-4D bounding box of a geometry.
Definition gbox.c:740
#define LW_FALSE
Definition liblwgeom.h:108
#define LW_FAILURE
Definition liblwgeom.h:110
#define LW_SUCCESS
Definition liblwgeom.h:111
#define LW_TRUE
Return types for functions with status returns.
Definition liblwgeom.h:107
lwflags_t flags
Definition liblwgeom.h:339
lwflags_t flags
Definition liblwgeom.h:563
uint32_t ngeoms
Definition liblwgeom.h:566
LWGEOM ** geoms
Definition liblwgeom.h:561

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: