PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ gbox_to_string()

char* gbox_to_string ( const GBOX gbox)

Allocate a string representation of the GBOX, based on dimensionality of flags.

Definition at line 369 of file g_box.c.

References GBOX::flags, FLAGS_GET_GEODETIC, FLAGS_GET_M, FLAGS_GET_Z, lwalloc(), GBOX::mmax, GBOX::mmin, GBOX::xmax, GBOX::xmin, GBOX::ymax, GBOX::ymin, GBOX::zmax, and GBOX::zmin.

Referenced by _postgis_gserialized_sel(), gbox_check_poles(), geography_bestsrid(), geography_point_outside(), gserialized_gist_sel(), lwpoly_covers_point2d(), nd_box_from_gbox(), test_gbox_from_spherical_coordinates(), test_gbox_to_string_truncated(), and test_gserialized_get_gbox_geocentric().

370 {
371  static int sz = 138;
372  char *str = NULL;
373 
374  if ( ! gbox )
375  return strdup("NULL POINTER");
376 
377  str = (char*)lwalloc(sz);
378 
379  if ( FLAGS_GET_GEODETIC(gbox->flags) )
380  {
381  snprintf(str, sz, "GBOX((%.8g,%.8g,%.8g),(%.8g,%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->zmin, gbox->xmax, gbox->ymax, gbox->zmax);
382  return str;
383  }
384  if ( FLAGS_GET_Z(gbox->flags) && FLAGS_GET_M(gbox->flags) )
385  {
386  snprintf(str, sz, "GBOX((%.8g,%.8g,%.8g,%.8g),(%.8g,%.8g,%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->zmin, gbox->mmin, gbox->xmax, gbox->ymax, gbox->zmax, gbox->mmax);
387  return str;
388  }
389  if ( FLAGS_GET_Z(gbox->flags) )
390  {
391  snprintf(str, sz, "GBOX((%.8g,%.8g,%.8g),(%.8g,%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->zmin, gbox->xmax, gbox->ymax, gbox->zmax);
392  return str;
393  }
394  if ( FLAGS_GET_M(gbox->flags) )
395  {
396  snprintf(str, sz, "GBOX((%.8g,%.8g,%.8g),(%.8g,%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->mmin, gbox->xmax, gbox->ymax, gbox->mmax);
397  return str;
398  }
399  snprintf(str, sz, "GBOX((%.8g,%.8g),(%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->xmax, gbox->ymax);
400  return str;
401 }
#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
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
void * lwalloc(size_t size)
Definition: lwutil.c:199
Here is the call graph for this function:
Here is the caller graph for this function: