PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ gserialized_from_lwgeom_any()

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

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

1071 {
1072  assert(geom);
1073  assert(buf);
1074 
1075  LWDEBUGF(2, "Input type (%d) %s, hasz: %d hasm: %d",
1076  geom->type, lwtype_name(geom->type),
1077  FLAGS_GET_Z(geom->flags), FLAGS_GET_M(geom->flags));
1078  LWDEBUGF(2, "LWGEOM(%p) uint8_t(%p)", geom, buf);
1079 
1080  switch (geom->type)
1081  {
1082  case POINTTYPE:
1083  return gserialized_from_lwpoint((LWPOINT *)geom, buf);
1084  case LINETYPE:
1085  return gserialized_from_lwline((LWLINE *)geom, buf);
1086  case POLYGONTYPE:
1087  return gserialized_from_lwpoly((LWPOLY *)geom, buf);
1088  case TRIANGLETYPE:
1089  return gserialized_from_lwtriangle((LWTRIANGLE *)geom, buf);
1090  case CIRCSTRINGTYPE:
1091  return gserialized_from_lwcircstring((LWCIRCSTRING *)geom, buf);
1092  case CURVEPOLYTYPE:
1093  case COMPOUNDTYPE:
1094  case MULTIPOINTTYPE:
1095  case MULTILINETYPE:
1096  case MULTICURVETYPE:
1097  case MULTIPOLYGONTYPE:
1098  case MULTISURFACETYPE:
1099  case POLYHEDRALSURFACETYPE:
1100  case TINTYPE:
1101  case COLLECTIONTYPE:
1102  return gserialized_from_lwcollection((LWCOLLECTION *)geom, buf);
1103  default:
1104  lwerror("Unknown geometry type: %d - %s", geom->type, lwtype_name(geom->type));
1105  return 0;
1106  }
1107  return 0;
1108 }
#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:397
#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:960
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:906
static size_t gserialized_from_lwpoint(const LWPOINT *point, uint8_t *buf)
Definition: g_serialized.c:832
#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:396
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
static size_t gserialized_from_lwcircstring(const LWCIRCSTRING *curve, uint8_t *buf)
#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:865
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: