PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwgeom_from_gserialized_buffer()

LWGEOM * lwgeom_from_gserialized_buffer ( uint8_t *  data_ptr,
uint8_t  g_flags,
size_t *  g_size 
)
static

Definition at line 1210 of file g_serialized.c.

References CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, FLAGS_GET_BBOX, FLAGS_GET_GEODETIC, FLAGS_GET_M, FLAGS_GET_Z, LINETYPE, lw_get_uint32_t(), lwcircstring_from_gserialized_buffer(), lwcollection_from_gserialized_buffer(), LWDEBUGF, lwerror(), lwline_from_gserialized_buffer(), lwpoint_from_gserialized_buffer(), lwpoly_from_gserialized_buffer(), lwtriangle_from_gserialized_buffer(), lwtype_name(), MULTICURVETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, MULTISURFACETYPE, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, TINTYPE, TRIANGLETYPE, and ovdump::type.

Referenced by gserialized_from_lwgeom(), lwcollection_from_gserialized_buffer(), and lwgeom_from_gserialized().

1211 {
1212  uint32_t type;
1213 
1214  assert(data_ptr);
1215 
1216  type = lw_get_uint32_t(data_ptr);
1217 
1218  LWDEBUGF(2, "Got type %d (%s), hasz=%d hasm=%d geodetic=%d hasbox=%d", type, lwtype_name(type),
1219  FLAGS_GET_Z(g_flags), FLAGS_GET_M(g_flags), FLAGS_GET_GEODETIC(g_flags), FLAGS_GET_BBOX(g_flags));
1220 
1221  switch (type)
1222  {
1223  case POINTTYPE:
1224  return (LWGEOM *)lwpoint_from_gserialized_buffer(data_ptr, g_flags, g_size);
1225  case LINETYPE:
1226  return (LWGEOM *)lwline_from_gserialized_buffer(data_ptr, g_flags, g_size);
1227  case CIRCSTRINGTYPE:
1228  return (LWGEOM *)lwcircstring_from_gserialized_buffer(data_ptr, g_flags, g_size);
1229  case POLYGONTYPE:
1230  return (LWGEOM *)lwpoly_from_gserialized_buffer(data_ptr, g_flags, g_size);
1231  case TRIANGLETYPE:
1232  return (LWGEOM *)lwtriangle_from_gserialized_buffer(data_ptr, g_flags, g_size);
1233  case MULTIPOINTTYPE:
1234  case MULTILINETYPE:
1235  case MULTIPOLYGONTYPE:
1236  case COMPOUNDTYPE:
1237  case CURVEPOLYTYPE:
1238  case MULTICURVETYPE:
1239  case MULTISURFACETYPE:
1240  case POLYHEDRALSURFACETYPE:
1241  case TINTYPE:
1242  case COLLECTIONTYPE:
1243  return (LWGEOM *)lwcollection_from_gserialized_buffer(data_ptr, g_flags, g_size);
1244  default:
1245  lwerror("Unknown geometry type: %d - %s", type, lwtype_name(type));
1246  return NULL;
1247  }
1248 }
#define LINETYPE
Definition: liblwgeom.h:71
static LWLINE * lwline_from_gserialized_buffer(uint8_t *data_ptr, uint8_t g_flags, size_t *g_size)
static LWTRIANGLE * lwtriangle_from_gserialized_buffer(uint8_t *data_ptr, uint8_t g_flags, size_t *g_size)
static LWCIRCSTRING * lwcircstring_from_gserialized_buffer(uint8_t *data_ptr, uint8_t g_flags, size_t *g_size)
#define MULTICURVETYPE
Definition: liblwgeom.h:80
static LWCOLLECTION * lwcollection_from_gserialized_buffer(uint8_t *data_ptr, uint8_t g_flags, size_t *g_size)
static LWPOLY * lwpoly_from_gserialized_buffer(uint8_t *data_ptr, uint8_t g_flags, size_t *g_size)
#define FLAGS_GET_GEODETIC(flags)
Definition: liblwgeom.h:127
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define CURVEPOLYTYPE
Definition: liblwgeom.h:79
#define COMPOUNDTYPE
Definition: liblwgeom.h:78
#define MULTIPOINTTYPE
Definition: liblwgeom.h:73
#define TRIANGLETYPE
Definition: liblwgeom.h:83
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:82
uint32_t lw_get_uint32_t(const uint8_t *loc)
Definition: lwgeom_api.c:569
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
#define FLAGS_GET_BBOX(flags)
Definition: liblwgeom.h:126
#define TINTYPE
Definition: liblwgeom.h:84
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:124
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:75
#define MULTISURFACETYPE
Definition: liblwgeom.h:81
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:125
type
Definition: ovdump.py:41
tuple g_size
Definition: genraster.py:41
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:77
#define MULTILINETYPE
Definition: liblwgeom.h:74
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
static LWPOINT * lwpoint_from_gserialized_buffer(uint8_t *data_ptr, uint8_t g_flags, size_t *g_size)
Definition: g_serialized.c:978
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
#define COLLECTIONTYPE
Definition: liblwgeom.h:76
Here is the call graph for this function:
Here is the caller graph for this function: