PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ gserialized_from_lwgeom_any()

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

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

826 {
827  assert(geom);
828  assert(buf);
829 
830  LWDEBUGF(2, "Input type (%d) %s, hasz: %d hasm: %d",
831  geom->type, lwtype_name(geom->type),
832  FLAGS_GET_Z(geom->flags), FLAGS_GET_M(geom->flags));
833  LWDEBUGF(2, "LWGEOM(%p) uint8_t(%p)", geom, buf);
834 
835  switch (geom->type)
836  {
837  case POINTTYPE:
838  return gserialized_from_lwpoint((LWPOINT *)geom, buf);
839  case LINETYPE:
840  return gserialized_from_lwline((LWLINE *)geom, buf);
841  case POLYGONTYPE:
842  return gserialized_from_lwpoly((LWPOLY *)geom, buf);
843  case TRIANGLETYPE:
844  return gserialized_from_lwtriangle((LWTRIANGLE *)geom, buf);
845  case CIRCSTRINGTYPE:
846  return gserialized_from_lwcircstring((LWCIRCSTRING *)geom, buf);
847  case CURVEPOLYTYPE:
848  case COMPOUNDTYPE:
849  case MULTIPOINTTYPE:
850  case MULTILINETYPE:
851  case MULTICURVETYPE:
852  case MULTIPOLYGONTYPE:
853  case MULTISURFACETYPE:
855  case TINTYPE:
856  case COLLECTIONTYPE:
857  return gserialized_from_lwcollection((LWCOLLECTION *)geom, buf);
858  default:
859  lwerror("Unknown geometry type: %d - %s", geom->type, lwtype_name(geom->type));
860  return 0;
861  }
862  return 0;
863 }
#define LINETYPE
Definition: liblwgeom.h:85
#define MULTICURVETYPE
Definition: liblwgeom.h:94
static size_t gserialized_from_lwcollection(const LWCOLLECTION *coll, uint8_t *buf)
Definition: g_serialized.c:792
#define POLYGONTYPE
Definition: liblwgeom.h:86
uint8_t flags
Definition: liblwgeom.h:396
#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:715
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
static size_t gserialized_from_lwpoly(const LWPOLY *poly, uint8_t *buf)
Definition: g_serialized.c:662
static size_t gserialized_from_lwpoint(const LWPOINT *point, uint8_t *buf)
Definition: g_serialized.c:588
#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:395
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
static size_t gserialized_from_lwcircstring(const LWCIRCSTRING *curve, uint8_t *buf)
Definition: g_serialized.c:756
#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:621
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:102
#define COLLECTIONTYPE
Definition: liblwgeom.h:90
Here is the call graph for this function:
Here is the caller graph for this function: