PostGIS  3.2.2dev-r@@SVN_REVISION@@

◆ lwcollection_calculate_gbox_geodetic()

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

Definition at line 2967 of file lwgeodetic.c.

2968 {
2969  GBOX subbox = {0};
2970  uint32_t i;
2971  int result = LW_FAILURE;
2972  int first = LW_TRUE;
2973  assert(coll);
2974  if ( coll->ngeoms == 0 )
2975  return LW_FAILURE;
2976 
2977  subbox.flags = gbox->flags;
2978 
2979  for ( i = 0; i < coll->ngeoms; i++ )
2980  {
2981  if ( lwgeom_calculate_gbox_geodetic((LWGEOM*)(coll->geoms[i]), &subbox) == LW_SUCCESS )
2982  {
2983  /* Keep a copy of the sub-bounding box for later */
2984  if ( coll->geoms[i]->bbox )
2985  lwfree(coll->geoms[i]->bbox);
2986  coll->geoms[i]->bbox = gbox_copy(&subbox);
2987  if ( first )
2988  {
2989  gbox_duplicate(&subbox, gbox);
2990  first = LW_FALSE;
2991  }
2992  else
2993  {
2994  gbox_merge(&subbox, gbox);
2995  }
2996  result = LW_SUCCESS;
2997  }
2998  }
2999  return result;
3000 }
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: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:108
#define LW_FAILURE
Definition: liblwgeom.h:110
#define LW_SUCCESS
Definition: liblwgeom.h:111
void lwfree(void *mem)
Definition: lwutil.c:242
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:107
int lwgeom_calculate_gbox_geodetic(const LWGEOM *geom, GBOX *gbox)
Calculate the geodetic bounding box for an LWGEOM.
Definition: lwgeodetic.c:3002
lwflags_t flags
Definition: liblwgeom.h:367
uint32_t ngeoms
Definition: liblwgeom.h:594
LWGEOM ** geoms
Definition: liblwgeom.h:589
GBOX * bbox
Definition: liblwgeom.h:472

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: