PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwgeom_to_twkb_buf()

static int lwgeom_to_twkb_buf ( const LWGEOM geom,
TWKB_GLOBALS globals,
TWKB_STATE ts 
)
static

Definition at line 366 of file lwout_twkb.c.

References COLLECTIONTYPE, LINETYPE, lwcollection_to_twkb_buf(), LWDEBUGF, lwerror(), lwline_to_twkb_buf(), lwmulti_to_twkb_buf(), lwpoint_to_twkb_buf(), lwpoly_to_twkb_buf(), lwtype_name(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, POINTTYPE, POLYGONTYPE, ovdump::type, and LWGEOM::type.

Referenced by lwgeom_write_to_buffer(), and lwmulti_to_twkb_buf().

367 {
368  LWDEBUGF(2, "Entered %s", __func__);
369 
370  switch ( geom->type )
371  {
372  case POINTTYPE:
373  {
374  LWDEBUGF(4,"Type found is Point, %d", geom->type);
375  return lwpoint_to_twkb_buf((LWPOINT*) geom, globals, ts);
376  }
377  case LINETYPE:
378  {
379  LWDEBUGF(4,"Type found is Linestring, %d", geom->type);
380  return lwline_to_twkb_buf((LWLINE*) geom, globals, ts);
381  }
382  /* Polygon has 'nrings' and 'rings' elements */
383  case POLYGONTYPE:
384  {
385  LWDEBUGF(4,"Type found is Polygon, %d", geom->type);
386  return lwpoly_to_twkb_buf((LWPOLY*)geom, globals, ts);
387  }
388 
389  /* All these Collection types have 'ngeoms' and 'geoms' elements */
390  case MULTIPOINTTYPE:
391  case MULTILINETYPE:
392  case MULTIPOLYGONTYPE:
393  {
394  LWDEBUGF(4,"Type found is Multi, %d", geom->type);
395  return lwmulti_to_twkb_buf((LWCOLLECTION*)geom, globals, ts);
396  }
397  case COLLECTIONTYPE:
398  {
399  LWDEBUGF(4,"Type found is collection, %d", geom->type);
400  return lwcollection_to_twkb_buf((LWCOLLECTION*) geom, globals, ts);
401  }
402  /* Unknown type! */
403  default:
404  lwerror("Unsupported geometry type: %s [%d]", lwtype_name((geom)->type), (geom)->type);
405  }
406 
407  return 0;
408 }
static int lwmulti_to_twkb_buf(const LWCOLLECTION *col, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition: lwout_twkb.c:283
#define LINETYPE
Definition: liblwgeom.h:86
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
static int lwpoly_to_twkb_buf(const LWPOLY *poly, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition: lwout_twkb.c:261
static int lwline_to_twkb_buf(const LWLINE *line, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition: lwout_twkb.c:248
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
static int lwpoint_to_twkb_buf(const LWPOINT *pt, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition: lwout_twkb.c:235
uint8_t type
Definition: liblwgeom.h:396
type
Definition: ovdump.py:41
#define MULTILINETYPE
Definition: liblwgeom.h:89
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
static int lwcollection_to_twkb_buf(const LWCOLLECTION *col, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition: lwout_twkb.c:333
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
Here is the call graph for this function:
Here is the caller graph for this function: