PostGIS  2.5.1dev-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 362 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().

363 {
364  LWDEBUGF(2, "Entered %s", __func__);
365 
366  switch ( geom->type )
367  {
368  case POINTTYPE:
369  {
370  LWDEBUGF(4,"Type found is Point, %d", geom->type);
371  return lwpoint_to_twkb_buf((LWPOINT*) geom, globals, ts);
372  }
373  case LINETYPE:
374  {
375  LWDEBUGF(4,"Type found is Linestring, %d", geom->type);
376  return lwline_to_twkb_buf((LWLINE*) geom, globals, ts);
377  }
378  /* Polygon has 'nrings' and 'rings' elements */
379  case POLYGONTYPE:
380  {
381  LWDEBUGF(4,"Type found is Polygon, %d", geom->type);
382  return lwpoly_to_twkb_buf((LWPOLY*)geom, globals, ts);
383  }
384 
385  /* All these Collection types have 'ngeoms' and 'geoms' elements */
386  case MULTIPOINTTYPE:
387  case MULTILINETYPE:
388  case MULTIPOLYGONTYPE:
389  {
390  LWDEBUGF(4,"Type found is Multi, %d", geom->type);
391  return lwmulti_to_twkb_buf((LWCOLLECTION*)geom, globals, ts);
392  }
393  case COLLECTIONTYPE:
394  {
395  LWDEBUGF(4,"Type found is collection, %d", geom->type);
396  return lwcollection_to_twkb_buf((LWCOLLECTION*) geom, globals, ts);
397  }
398  /* Unknown type! */
399  default:
400  lwerror("Unsupported geometry type: %s [%d]", lwtype_name((geom)->type), (geom)->type);
401  }
402 
403  return 0;
404 }
static int lwmulti_to_twkb_buf(const LWCOLLECTION *col, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition: lwout_twkb.c:279
#define LINETYPE
Definition: liblwgeom.h:85
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define MULTIPOINTTYPE
Definition: liblwgeom.h:87
static int lwpoly_to_twkb_buf(const LWPOLY *poly, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition: lwout_twkb.c:257
static int lwline_to_twkb_buf(const LWLINE *line, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition: lwout_twkb.c:244
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:89
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
static int lwpoint_to_twkb_buf(const LWPOINT *pt, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition: lwout_twkb.c:231
uint8_t type
Definition: liblwgeom.h:398
type
Definition: ovdump.py:41
#define MULTILINETYPE
Definition: liblwgeom.h:88
#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:329
#define COLLECTIONTYPE
Definition: liblwgeom.h:90
Here is the call graph for this function:
Here is the caller graph for this function: