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

Definition at line 865 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().

866 {
867  uint8_t *loc = buf;
868  float f;
869  size_t return_size;
870 
871  assert(buf);
872 
873  f = next_float_down(gbox->xmin);
874  memcpy(loc, &f, sizeof(float));
875  loc += sizeof(float);
876 
877  f = next_float_up(gbox->xmax);
878  memcpy(loc, &f, sizeof(float));
879  loc += sizeof(float);
880 
881  f = next_float_down(gbox->ymin);
882  memcpy(loc, &f, sizeof(float));
883  loc += sizeof(float);
884 
885  f = next_float_up(gbox->ymax);
886  memcpy(loc, &f, sizeof(float));
887  loc += sizeof(float);
888 
889  if ( FLAGS_GET_GEODETIC(gbox->flags) )
890  {
891  f = next_float_down(gbox->zmin);
892  memcpy(loc, &f, sizeof(float));
893  loc += sizeof(float);
894 
895  f = next_float_up(gbox->zmax);
896  memcpy(loc, &f, sizeof(float));
897  loc += sizeof(float);
898 
899  return_size = (size_t)(loc - buf);
900  LWDEBUGF(4, "returning size %d", return_size);
901  return return_size;
902  }
903 
904  if ( FLAGS_GET_Z(gbox->flags) )
905  {
906  f = next_float_down(gbox->zmin);
907  memcpy(loc, &f, sizeof(float));
908  loc += sizeof(float);
909 
910  f = next_float_up(gbox->zmax);
911  memcpy(loc, &f, sizeof(float));
912  loc += sizeof(float);
913 
914  }
915 
916  if ( FLAGS_GET_M(gbox->flags) )
917  {
918  f = next_float_down(gbox->mmin);
919  memcpy(loc, &f, sizeof(float));
920  loc += sizeof(float);
921 
922  f = next_float_up(gbox->mmax);
923  memcpy(loc, &f, sizeof(float));
924  loc += sizeof(float);
925  }
926  return_size = (size_t)(loc - buf);
927  LWDEBUGF(4, "returning size %d", return_size);
928  return return_size;
929 }
#define FLAGS_GET_GEODETIC(flags)
Definition: liblwgeom.h:142
double xmax
Definition: liblwgeom.h:292
float next_float_down(double d)
Definition: lwgeom_api.c:156
float next_float_up(double d)
Definition: lwgeom_api.c:172
double zmax
Definition: liblwgeom.h:296
double ymin
Definition: liblwgeom.h:293
double xmin
Definition: liblwgeom.h:291
double ymax
Definition: liblwgeom.h:294
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:139
uint8_t flags
Definition: liblwgeom.h:290
double mmin
Definition: liblwgeom.h:297
double zmin
Definition: liblwgeom.h:295
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:140
double mmax
Definition: liblwgeom.h:298
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88

Here is the call graph for this function:

Here is the caller graph for this function: