PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ gserialized_from_gbox()

static size_t gserialized_from_gbox ( const GBOX gbox,
uint8_t buf 
)
static

Definition at line 1108 of file g_serialized.c.

1109 {
1110  uint8_t *loc = buf;
1111  float f;
1112  size_t return_size;
1113 
1114  assert(buf);
1115 
1116  f = next_float_down(gbox->xmin);
1117  memcpy(loc, &f, sizeof(float));
1118  loc += sizeof(float);
1119 
1120  f = next_float_up(gbox->xmax);
1121  memcpy(loc, &f, sizeof(float));
1122  loc += sizeof(float);
1123 
1124  f = next_float_down(gbox->ymin);
1125  memcpy(loc, &f, sizeof(float));
1126  loc += sizeof(float);
1127 
1128  f = next_float_up(gbox->ymax);
1129  memcpy(loc, &f, sizeof(float));
1130  loc += sizeof(float);
1131 
1132  if ( FLAGS_GET_GEODETIC(gbox->flags) )
1133  {
1134  f = next_float_down(gbox->zmin);
1135  memcpy(loc, &f, sizeof(float));
1136  loc += sizeof(float);
1137 
1138  f = next_float_up(gbox->zmax);
1139  memcpy(loc, &f, sizeof(float));
1140  loc += sizeof(float);
1141 
1142  return_size = (size_t)(loc - buf);
1143  LWDEBUGF(4, "returning size %d", return_size);
1144  return return_size;
1145  }
1146 
1147  if ( FLAGS_GET_Z(gbox->flags) )
1148  {
1149  f = next_float_down(gbox->zmin);
1150  memcpy(loc, &f, sizeof(float));
1151  loc += sizeof(float);
1152 
1153  f = next_float_up(gbox->zmax);
1154  memcpy(loc, &f, sizeof(float));
1155  loc += sizeof(float);
1156 
1157  }
1158 
1159  if ( FLAGS_GET_M(gbox->flags) )
1160  {
1161  f = next_float_down(gbox->mmin);
1162  memcpy(loc, &f, sizeof(float));
1163  loc += sizeof(float);
1164 
1165  f = next_float_up(gbox->mmax);
1166  memcpy(loc, &f, sizeof(float));
1167  loc += sizeof(float);
1168  }
1169  return_size = (size_t)(loc - buf);
1170  LWDEBUGF(4, "returning size %d", return_size);
1171  return return_size;
1172 }
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:141
float next_float_up(double d)
Definition: lwgeom_api.c:73
float next_float_down(double d)
Definition: lwgeom_api.c:52
#define FLAGS_GET_GEODETIC(flags)
Definition: liblwgeom.h:143
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
double ymax
Definition: liblwgeom.h:298
double zmax
Definition: liblwgeom.h:300
double xmax
Definition: liblwgeom.h:296
double zmin
Definition: liblwgeom.h:299
double mmax
Definition: liblwgeom.h:302
double ymin
Definition: liblwgeom.h:297
double xmin
Definition: liblwgeom.h:295
double mmin
Definition: liblwgeom.h:301
uint8_t flags
Definition: liblwgeom.h:294
unsigned char uint8_t
Definition: uthash.h:79

References floatuint::f, 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().

Here is the call graph for this function:
Here is the caller graph for this function: