PostGIS  2.5.2dev-r@@SVN_REVISION@@

◆ gserialized_from_lwgeom_any()

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

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

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