PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwcollection_calculate_gbox_geodetic()

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

Definition at line 2993 of file lwgeodetic.c.

2994 {
2995  GBOX subbox;
2996  uint32_t i;
2997  int result = LW_FAILURE;
2998  int first = LW_TRUE;
2999  assert(coll);
3000  if ( coll->ngeoms == 0 )
3001  return LW_FAILURE;
3002 
3003  subbox.flags = gbox->flags;
3004 
3005  for ( i = 0; i < coll->ngeoms; i++ )
3006  {
3007  if ( lwgeom_calculate_gbox_geodetic((LWGEOM*)(coll->geoms[i]), &subbox) == LW_SUCCESS )
3008  {
3009  /* Keep a copy of the sub-bounding box for later */
3010  if ( coll->geoms[i]->bbox )
3011  lwfree(coll->geoms[i]->bbox);
3012  coll->geoms[i]->bbox = gbox_copy(&subbox);
3013  if ( first )
3014  {
3015  gbox_duplicate(&subbox, gbox);
3016  first = LW_FALSE;
3017  }
3018  else
3019  {
3020  gbox_merge(&subbox, gbox);
3021  }
3022  result = LW_SUCCESS;
3023  }
3024  }
3025  return result;
3026 }
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
GBOX * gbox_copy(const GBOX *box)
Return a copy of the GBOX, based on dimensionality of flags.
Definition: g_box.c:433
#define LW_FALSE
Definition: liblwgeom.h:77
#define LW_FAILURE
Definition: liblwgeom.h:79
#define LW_SUCCESS
Definition: liblwgeom.h:80
void lwfree(void *mem)
Definition: lwutil.c:244
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
int lwgeom_calculate_gbox_geodetic(const LWGEOM *geom, GBOX *gbox)
Calculate the geodetic bounding box for an LWGEOM.
Definition: lwgeodetic.c:3028
uint8_t flags
Definition: liblwgeom.h:294
uint32_t ngeoms
Definition: liblwgeom.h:510
LWGEOM ** geoms
Definition: liblwgeom.h:512
GBOX * bbox
Definition: liblwgeom.h:401
unsigned int uint32_t
Definition: uthash.h:78

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(), and LWCOLLECTION::ngeoms.

Referenced by lwgeom_calculate_gbox_geodetic().

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