PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ gserialized_from_lwgeom_any()

static size_t gserialized_from_lwgeom_any ( const LWGEOM geom,
uint8_t buf 
)
static

Definition at line 1066 of file g_serialized.c.

References CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LWGEOM::flags, FLAGS_GET_M, FLAGS_GET_Z, gserialized_from_lwcircstring(), gserialized_from_lwcollection(), gserialized_from_lwline(), gserialized_from_lwpoint(), gserialized_from_lwpoly(), gserialized_from_lwtriangle(), LINETYPE, LWDEBUGF, lwerror(), lwtype_name(), MULTICURVETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, MULTISURFACETYPE, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, TINTYPE, TRIANGLETYPE, LWGEOM::type, and LWCOLLECTION::type.

Referenced by gserialized_from_lwcollection(), gserialized_from_lwgeom(), gserialized_from_lwgeom_size(), and test_gserialized_peek_gbox_p_fails_for_unsupported_cases().

1067 {
1068  assert(geom);
1069  assert(buf);
1070 
1071  LWDEBUGF(2, "Input type (%d) %s, hasz: %d hasm: %d",
1072  geom->type, lwtype_name(geom->type),
1073  FLAGS_GET_Z(geom->flags), FLAGS_GET_M(geom->flags));
1074  LWDEBUGF(2, "LWGEOM(%p) uint8_t(%p)", geom, buf);
1075 
1076  switch (geom->type)
1077  {
1078  case POINTTYPE:
1079  return gserialized_from_lwpoint((LWPOINT *)geom, buf);
1080  case LINETYPE:
1081  return gserialized_from_lwline((LWLINE *)geom, buf);
1082  case POLYGONTYPE:
1083  return gserialized_from_lwpoly((LWPOLY *)geom, buf);
1084  case TRIANGLETYPE:
1085  return gserialized_from_lwtriangle((LWTRIANGLE *)geom, buf);
1086  case CIRCSTRINGTYPE:
1087  return gserialized_from_lwcircstring((LWCIRCSTRING *)geom, buf);
1088  case CURVEPOLYTYPE:
1089  case COMPOUNDTYPE:
1090  case MULTIPOINTTYPE:
1091  case MULTILINETYPE:
1092  case MULTICURVETYPE:
1093  case MULTIPOLYGONTYPE:
1094  case MULTISURFACETYPE:
1095  case POLYHEDRALSURFACETYPE:
1096  case TINTYPE:
1097  case COLLECTIONTYPE:
1098  return gserialized_from_lwcollection((LWCOLLECTION *)geom, buf);
1099  default:
1100  lwerror("Unknown geometry type: %d - %s", geom->type, lwtype_name(geom->type));
1101  return 0;
1102  }
1103  return 0;
1104 }
#define LINETYPE
Definition: liblwgeom.h:85
#define MULTICURVETYPE
Definition: liblwgeom.h:94
static size_t gserialized_from_lwcollection(const LWCOLLECTION *coll, uint8_t *buf)
#define POLYGONTYPE
Definition: liblwgeom.h:86
uint8_t flags
Definition: liblwgeom.h:399
#define CURVEPOLYTYPE
Definition: liblwgeom.h:93
#define COMPOUNDTYPE
Definition: liblwgeom.h:92
#define MULTIPOINTTYPE
Definition: liblwgeom.h:87
#define TRIANGLETYPE
Definition: liblwgeom.h:97
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:96
static size_t gserialized_from_lwtriangle(const LWTRIANGLE *triangle, uint8_t *buf)
Definition: g_serialized.c:956
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
static size_t gserialized_from_lwpoly(const LWPOLY *poly, uint8_t *buf)
Definition: g_serialized.c:903
static size_t gserialized_from_lwpoint(const LWPOINT *point, uint8_t *buf)
Definition: g_serialized.c:829
#define TINTYPE
Definition: liblwgeom.h:98
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:139
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:89
#define MULTISURFACETYPE
Definition: liblwgeom.h:95
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:140
uint8_t type
Definition: liblwgeom.h:398
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
static size_t gserialized_from_lwcircstring(const LWCIRCSTRING *curve, uint8_t *buf)
Definition: g_serialized.c:997
#define MULTILINETYPE
Definition: liblwgeom.h:88
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
static size_t gserialized_from_lwline(const LWLINE *line, uint8_t *buf)
Definition: g_serialized.c:862
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
#define COLLECTIONTYPE
Definition: liblwgeom.h:90
Here is the call graph for this function:
Here is the caller graph for this function: