PostGIS  3.4.0dev-r@@SVN_REVISION@@
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages

◆ lwcollection_calculate_gbox_geodetic()

static int lwcollection_calculate_gbox_geodetic ( const LWCOLLECTION coll,
GBOX gbox 
)
static

Definition at line 2992 of file lwgeodetic.c.

2993 {
2994  GBOX subbox = {0};
2995  uint32_t i;
2996  int result = LW_FAILURE;
2997  int first = LW_TRUE;
2998  assert(coll);
2999  if ( coll->ngeoms == 0 )
3000  return LW_FAILURE;
3001 
3002  subbox.flags = gbox->flags;
3003 
3004  for ( i = 0; i < coll->ngeoms; i++ )
3005  {
3006  if ( lwgeom_calculate_gbox_geodetic((LWGEOM*)(coll->geoms[i]), &subbox) == LW_SUCCESS )
3007  {
3008  /* Keep a copy of the sub-bounding box for later */
3009  if ( coll->geoms[i]->bbox )
3010  lwfree(coll->geoms[i]->bbox);
3011  coll->geoms[i]->bbox = gbox_copy(&subbox);
3012  if ( first )
3013  {
3014  gbox_duplicate(&subbox, gbox);
3015  first = LW_FALSE;
3016  }
3017  else
3018  {
3019  gbox_merge(&subbox, gbox);
3020  }
3021  result = LW_SUCCESS;
3022  }
3023  }
3024  return result;
3025 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:262
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
GBOX * gbox_copy(const GBOX *box)
Return a copy of the GBOX, based on dimensionality of flags.
Definition: gbox.c:426
#define LW_FALSE
Definition: liblwgeom.h:94
#define LW_FAILURE
Definition: liblwgeom.h:96
#define LW_SUCCESS
Definition: liblwgeom.h:97
void lwfree(void *mem)
Definition: lwutil.c:242
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:93
int lwgeom_calculate_gbox_geodetic(const LWGEOM *geom, GBOX *gbox)
Calculate the geodetic bounding box for an LWGEOM.
Definition: lwgeodetic.c:3027
lwflags_t flags
Definition: liblwgeom.h:353
uint32_t ngeoms
Definition: liblwgeom.h:580
LWGEOM ** geoms
Definition: liblwgeom.h:575
GBOX * bbox
Definition: liblwgeom.h:458

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

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