PostGIS  2.1.10dev-r@@SVN_REVISION@@
char* gbox_to_string ( const GBOX gbox)

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

Definition at line 328 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(), and test_gserialized_get_gbox_geocentric().

329 {
330  static int sz = 128;
331  char *str = NULL;
332 
333  if ( ! gbox )
334  return strdup("NULL POINTER");
335 
336  str = (char*)lwalloc(sz);
337 
338  if ( FLAGS_GET_GEODETIC(gbox->flags) )
339  {
340  snprintf(str, sz, "GBOX((%.8g,%.8g,%.8g),(%.8g,%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->zmin, gbox->xmax, gbox->ymax, gbox->zmax);
341  return str;
342  }
343  if ( FLAGS_GET_Z(gbox->flags) && FLAGS_GET_M(gbox->flags) )
344  {
345  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);
346  return str;
347  }
348  if ( FLAGS_GET_Z(gbox->flags) )
349  {
350  snprintf(str, sz, "GBOX((%.8g,%.8g,%.8g),(%.8g,%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->zmin, gbox->xmax, gbox->ymax, gbox->zmax);
351  return str;
352  }
353  if ( FLAGS_GET_M(gbox->flags) )
354  {
355  snprintf(str, sz, "GBOX((%.8g,%.8g,%.8g),(%.8g,%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->mmin, gbox->xmax, gbox->ymax, gbox->mmax);
356  return str;
357  }
358  snprintf(str, sz, "GBOX((%.8g,%.8g),(%.8g,%.8g))", gbox->xmin, gbox->ymin, gbox->xmax, gbox->ymax);
359  return str;
360 }
#define FLAGS_GET_GEODETIC(flags)
Definition: liblwgeom.h:109
double xmax
Definition: liblwgeom.h:249
double zmax
Definition: liblwgeom.h:253
double ymin
Definition: liblwgeom.h:250
double xmin
Definition: liblwgeom.h:248
double ymax
Definition: liblwgeom.h:251
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:106
uint8_t flags
Definition: liblwgeom.h:247
double mmin
Definition: liblwgeom.h:254
double zmin
Definition: liblwgeom.h:252
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:107
double mmax
Definition: liblwgeom.h:255
void * lwalloc(size_t size)
Definition: lwutil.c:175

Here is the call graph for this function:

Here is the caller graph for this function: