PostGIS  2.2.7dev-r@@SVN_REVISION@@
static uint8_t lwgeom_twkb_type ( const LWGEOM geom)
static

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

18 {
19  uint8_t twkb_type = 0;
20 
21  LWDEBUGF(2, "Entered lwgeom_twkb_type",0);
22 
23  switch ( geom->type )
24  {
25  case POINTTYPE:
26  twkb_type = WKB_POINT_TYPE;
27  break;
28  case LINETYPE:
29  twkb_type = WKB_LINESTRING_TYPE;
30  break;
31  case POLYGONTYPE:
32  twkb_type = WKB_POLYGON_TYPE;
33  break;
34  case MULTIPOINTTYPE:
35  twkb_type = WKB_MULTIPOINT_TYPE;
36  break;
37  case MULTILINETYPE:
38  twkb_type = WKB_MULTILINESTRING_TYPE;
39  break;
40  case MULTIPOLYGONTYPE:
41  twkb_type = WKB_MULTIPOLYGON_TYPE;
42  break;
43  case COLLECTIONTYPE:
44  twkb_type = WKB_GEOMETRYCOLLECTION_TYPE;
45  break;
46  default:
47  lwerror("Unsupported geometry type: %s [%d]",
48  lwtype_name(geom->type), geom->type);
49  }
50  return twkb_type;
51 }
#define LINETYPE
Definition: liblwgeom.h:71
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define MULTIPOINTTYPE
Definition: liblwgeom.h:73
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
#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:75
#define WKB_MULTIPOINT_TYPE
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
uint8_t type
Definition: liblwgeom.h:380
#define MULTILINETYPE
Definition: liblwgeom.h:74
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
#define COLLECTIONTYPE
Definition: liblwgeom.h:76
#define WKB_GEOMETRYCOLLECTION_TYPE

Here is the call graph for this function:

Here is the caller graph for this function: