PostGIS  2.5.0beta1dev-r@@SVN_REVISION@@

◆ lwpolygon_calculate_gbox_geodetic()

static int lwpolygon_calculate_gbox_geodetic ( const LWPOLY poly,
GBOX gbox 
)
static

Definition at line 2868 of file lwgeodetic.c.

References GBOX::flags, gbox_check_poles(), gbox_duplicate(), gbox_merge(), LW_FAILURE, LW_FALSE, LW_SUCCESS, LW_TRUE, LWPOLY::nrings, ptarray_calculate_gbox_geodetic(), and LWPOLY::rings.

Referenced by lwgeom_calculate_gbox_geodetic().

2869 {
2870  GBOX ringbox;
2871  uint32_t i;
2872  int first = LW_TRUE;
2873  assert(poly);
2874  if ( poly->nrings == 0 )
2875  return LW_FAILURE;
2876  ringbox.flags = gbox->flags;
2877  for ( i = 0; i < poly->nrings; i++ )
2878  {
2879  if ( ptarray_calculate_gbox_geodetic(poly->rings[i], &ringbox) == LW_FAILURE )
2880  return LW_FAILURE;
2881  if ( first )
2882  {
2883  gbox_duplicate(&ringbox, gbox);
2884  first = LW_FALSE;
2885  }
2886  else
2887  {
2888  gbox_merge(&ringbox, gbox);
2889  }
2890  }
2891 
2892  /* If the box wraps a poly, push that axis to the absolute min/max as appropriate */
2893  gbox_check_poles(gbox);
2894 
2895  return LW_SUCCESS;
2896 }
void gbox_duplicate(const GBOX *original, GBOX *duplicate)
Copy the values of original GBOX into duplicate.
Definition: g_box.c:440
#define LW_SUCCESS
Definition: liblwgeom.h:79
uint32_t nrings
Definition: liblwgeom.h:457
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
#define LW_FAILURE
Definition: liblwgeom.h:78
unsigned int uint32_t
Definition: uthash.h:78
#define LW_FALSE
Definition: liblwgeom.h:76
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
POINTARRAY ** rings
Definition: liblwgeom.h:459
int ptarray_calculate_gbox_geodetic(const POINTARRAY *pa, GBOX *gbox)
Calculate geodetic (x/y/z) box and add values to gbox.
Definition: lwgeodetic.c:2801
uint8_t flags
Definition: liblwgeom.h:293
static int gbox_check_poles(GBOX *gbox)
Check to see if this geocentric gbox is wrapped around a pole.
Definition: lwgeodetic.c:307
Here is the call graph for this function:
Here is the caller graph for this function: