PostGIS  2.2.7dev-r@@SVN_REVISION@@
static int lwgeom_to_twkb_buf ( const LWGEOM geom,
TWKB_GLOBALS globals,
TWKB_STATE ts 
)
static

Definition at line 348 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, and LWGEOM::type.

Referenced by lwgeom_write_to_buffer(), and lwmulti_to_twkb_buf().

349 {
350  LWDEBUGF(2, "Entered %s", __func__);
351 
352  switch ( geom->type )
353  {
354  case POINTTYPE:
355  {
356  LWDEBUGF(4,"Type found is Point, %d", geom->type);
357  return lwpoint_to_twkb_buf((LWPOINT*) geom, globals, ts);
358  }
359  case LINETYPE:
360  {
361  LWDEBUGF(4,"Type found is Linestring, %d", geom->type);
362  return lwline_to_twkb_buf((LWLINE*) geom, globals, ts);
363  }
364  /* Polygon has 'nrings' and 'rings' elements */
365  case POLYGONTYPE:
366  {
367  LWDEBUGF(4,"Type found is Polygon, %d", geom->type);
368  return lwpoly_to_twkb_buf((LWPOLY*)geom, globals, ts);
369  }
370 
371  /* All these Collection types have 'ngeoms' and 'geoms' elements */
372  case MULTIPOINTTYPE:
373  case MULTILINETYPE:
374  case MULTIPOLYGONTYPE:
375  {
376  LWDEBUGF(4,"Type found is Multi, %d", geom->type);
377  return lwmulti_to_twkb_buf((LWCOLLECTION*)geom, globals, ts);
378  }
379  case COLLECTIONTYPE:
380  {
381  LWDEBUGF(4,"Type found is collection, %d", geom->type);
382  return lwcollection_to_twkb_buf((LWCOLLECTION*) geom, globals, ts);
383  }
384  /* Unknown type! */
385  default:
386  lwerror("Unsupported geometry type: %s [%d]", lwtype_name((geom)->type), (geom)->type);
387  }
388 
389  return 0;
390 }
static int lwmulti_to_twkb_buf(const LWCOLLECTION *col, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition: lwout_twkb.c:265
#define LINETYPE
Definition: liblwgeom.h:71
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define MULTIPOINTTYPE
Definition: liblwgeom.h:73
static int lwpoly_to_twkb_buf(const LWPOLY *poly, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition: lwout_twkb.c:243
static int lwline_to_twkb_buf(const LWLINE *line, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition: lwout_twkb.c:230
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:75
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
static int lwpoint_to_twkb_buf(const LWPOINT *pt, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition: lwout_twkb.c:217
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
static int lwcollection_to_twkb_buf(const LWCOLLECTION *col, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition: lwout_twkb.c:315
#define COLLECTIONTYPE
Definition: liblwgeom.h:76

Here is the call graph for this function:

Here is the caller graph for this function: