PostGIS  2.1.10dev-r@@SVN_REVISION@@
static size_t gserialized_from_gbox ( const GBOX gbox,
uint8_t *  buf 
)
static

Definition at line 840 of file g_serialized.c.

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

Referenced by gserialized_from_lwgeom().

841 {
842  uint8_t *loc = buf;
843  float f;
844  size_t return_size;
845 
846  assert(buf);
847 
848  f = next_float_down(gbox->xmin);
849  memcpy(loc, &f, sizeof(float));
850  loc += sizeof(float);
851 
852  f = next_float_up(gbox->xmax);
853  memcpy(loc, &f, sizeof(float));
854  loc += sizeof(float);
855 
856  f = next_float_down(gbox->ymin);
857  memcpy(loc, &f, sizeof(float));
858  loc += sizeof(float);
859 
860  f = next_float_up(gbox->ymax);
861  memcpy(loc, &f, sizeof(float));
862  loc += sizeof(float);
863 
864  if ( FLAGS_GET_GEODETIC(gbox->flags) )
865  {
866  f = next_float_down(gbox->zmin);
867  memcpy(loc, &f, sizeof(float));
868  loc += sizeof(float);
869 
870  f = next_float_up(gbox->zmax);
871  memcpy(loc, &f, sizeof(float));
872  loc += sizeof(float);
873 
874  return_size = (size_t)(loc - buf);
875  LWDEBUGF(4, "returning size %d", return_size);
876  return return_size;
877  }
878 
879  if ( FLAGS_GET_Z(gbox->flags) )
880  {
881  f = next_float_down(gbox->zmin);
882  memcpy(loc, &f, sizeof(float));
883  loc += sizeof(float);
884 
885  f = next_float_up(gbox->zmax);
886  memcpy(loc, &f, sizeof(float));
887  loc += sizeof(float);
888 
889  }
890 
891  if ( FLAGS_GET_M(gbox->flags) )
892  {
893  f = next_float_down(gbox->mmin);
894  memcpy(loc, &f, sizeof(float));
895  loc += sizeof(float);
896 
897  f = next_float_up(gbox->mmax);
898  memcpy(loc, &f, sizeof(float));
899  loc += sizeof(float);
900  }
901  return_size = (size_t)(loc - buf);
902  LWDEBUGF(4, "returning size %d", return_size);
903  return return_size;
904 }
#define FLAGS_GET_GEODETIC(flags)
Definition: liblwgeom.h:109
double xmax
Definition: liblwgeom.h:249
float next_float_down(double d)
Definition: lwgeom_api.c:129
float next_float_up(double d)
Definition: lwgeom_api.c:145
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
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55

Here is the call graph for this function:

Here is the caller graph for this function: