PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwgeom_twkb_type()

static uint8_t lwgeom_twkb_type ( const LWGEOM geom)
static

Definition at line 31 of file lwout_twkb.c.

References COLLECTIONTYPE, LINETYPE, LWDEBUGF, lwerror(), lwtype_name(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, POINTTYPE, POLYGONTYPE, LWGEOM::type, WKB_GEOMETRYCOLLECTION_TYPE, WKB_LINESTRING_TYPE, WKB_MULTILINESTRING_TYPE, WKB_MULTIPOINT_TYPE, WKB_MULTIPOLYGON_TYPE, WKB_POINT_TYPE, and WKB_POLYGON_TYPE.

Referenced by lwgeom_write_to_buffer().

32 {
33  uint8_t twkb_type = 0;
34 
35  LWDEBUGF(2, "Entered lwgeom_twkb_type",0);
36 
37  switch ( geom->type )
38  {
39  case POINTTYPE:
40  twkb_type = WKB_POINT_TYPE;
41  break;
42  case LINETYPE:
43  twkb_type = WKB_LINESTRING_TYPE;
44  break;
45  case POLYGONTYPE:
46  twkb_type = WKB_POLYGON_TYPE;
47  break;
48  case MULTIPOINTTYPE:
49  twkb_type = WKB_MULTIPOINT_TYPE;
50  break;
51  case MULTILINETYPE:
52  twkb_type = WKB_MULTILINESTRING_TYPE;
53  break;
54  case MULTIPOLYGONTYPE:
55  twkb_type = WKB_MULTIPOLYGON_TYPE;
56  break;
57  case COLLECTIONTYPE:
58  twkb_type = WKB_GEOMETRYCOLLECTION_TYPE;
59  break;
60  default:
61  lwerror("Unsupported geometry type: %s [%d]",
62  lwtype_name(geom->type), geom->type);
63  }
64  return twkb_type;
65 }
#define LINETYPE
Definition: liblwgeom.h:86
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
#define WKB_POLYGON_TYPE
#define WKB_POINT_TYPE
Well-Known Binary (WKB) Geometry Types.
#define WKB_LINESTRING_TYPE
#define WKB_MULTIPOLYGON_TYPE
#define WKB_MULTILINESTRING_TYPE
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
#define WKB_MULTIPOINT_TYPE
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
uint8_t type
Definition: liblwgeom.h:396
#define MULTILINETYPE
Definition: liblwgeom.h:89
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
unsigned char uint8_t
Definition: uthash.h:79
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
#define WKB_GEOMETRYCOLLECTION_TYPE
Here is the call graph for this function:
Here is the caller graph for this function: