PostGIS  2.2.7dev-r@@SVN_REVISION@@
int gbox_is_valid ( const GBOX gbox)

Return false if any of the dimensions is NaN or infinite.

Definition at line 174 of file g_box.c.

References GBOX::flags, FLAGS_GET_GEODETIC, FLAGS_GET_M, FLAGS_GET_Z, LW_FALSE, LW_TRUE, GBOX::mmax, GBOX::mmin, GBOX::xmax, GBOX::xmin, GBOX::ymax, GBOX::ymin, GBOX::zmax, and GBOX::zmin.

Referenced by compute_gserialized_stats_mode().

175 {
176  /* X */
177  if ( ! isfinite(gbox->xmin) || isnan(gbox->xmin) ||
178  ! isfinite(gbox->xmax) || isnan(gbox->xmax) )
179  return LW_FALSE;
180 
181  /* Y */
182  if ( ! isfinite(gbox->ymin) || isnan(gbox->ymin) ||
183  ! isfinite(gbox->ymax) || isnan(gbox->ymax) )
184  return LW_FALSE;
185 
186  /* Z */
187  if ( FLAGS_GET_GEODETIC(gbox->flags) || FLAGS_GET_Z(gbox->flags) )
188  {
189  if ( ! isfinite(gbox->zmin) || isnan(gbox->zmin) ||
190  ! isfinite(gbox->zmax) || isnan(gbox->zmax) )
191  return LW_FALSE;
192  }
193 
194  /* M */
195  if ( FLAGS_GET_M(gbox->flags) )
196  {
197  if ( ! isfinite(gbox->mmin) || isnan(gbox->mmin) ||
198  ! isfinite(gbox->mmax) || isnan(gbox->mmax) )
199  return LW_FALSE;
200  }
201 
202  return LW_TRUE;
203 }
#define FLAGS_GET_GEODETIC(flags)
Definition: liblwgeom.h:127
double xmax
Definition: liblwgeom.h:277
double zmax
Definition: liblwgeom.h:281
double ymin
Definition: liblwgeom.h:278
double xmin
Definition: liblwgeom.h:276
#define LW_FALSE
Definition: liblwgeom.h:62
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:61
double ymax
Definition: liblwgeom.h:279
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:124
uint8_t flags
Definition: liblwgeom.h:275
double mmin
Definition: liblwgeom.h:282
double zmin
Definition: liblwgeom.h:280
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:125
double mmax
Definition: liblwgeom.h:283

Here is the caller graph for this function: