PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ lwgeom_to_twkb_buf()

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

Definition at line 378 of file lwout_twkb.c.

379{
380 LWDEBUGF(2, "Entered %s", __func__);
381
382 switch ( geom->type )
383 {
384 case POINTTYPE:
385 {
386 LWDEBUGF(4,"Type found is Point, %d", geom->type);
387 return lwpoint_to_twkb_buf((LWPOINT*) geom, globals, ts);
388 }
389 case LINETYPE:
390 {
391 LWDEBUGF(4,"Type found is Linestring, %d", geom->type);
392 return lwline_to_twkb_buf((LWLINE*) geom, globals, ts);
393 }
394 case TRIANGLETYPE:
395 {
396 LWDEBUGF(4, "Type found is Triangle, %d", geom->type);
397 return lwtriangle_to_twkb_buf((LWTRIANGLE *)geom, globals, ts);
398 }
399 /* Polygon has 'nrings' and 'rings' elements */
400 case POLYGONTYPE:
401 {
402 LWDEBUGF(4,"Type found is Polygon, %d", geom->type);
403 return lwpoly_to_twkb_buf((LWPOLY*)geom, globals, ts);
404 }
405
406 /* All these Collection types have 'ngeoms' and 'geoms' elements */
407 case MULTIPOINTTYPE:
408 case MULTILINETYPE:
409 case MULTIPOLYGONTYPE:
410 {
411 LWDEBUGF(4,"Type found is Multi, %d", geom->type);
412 return lwmulti_to_twkb_buf((LWCOLLECTION*)geom, globals, ts);
413 }
414 case COLLECTIONTYPE:
415 case TINTYPE:
416 {
417 LWDEBUGF(4,"Type found is collection, %d", geom->type);
418 return lwcollection_to_twkb_buf((LWCOLLECTION*) geom, globals, ts);
419 }
420 /* Unknown type! */
421 default:
422 lwerror("%s: Unsupported geometry type: %s", __func__, lwtype_name(geom->type));
423 }
424
425 return 0;
426}
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition lwutil.c:216
#define COLLECTIONTYPE
Definition liblwgeom.h:108
#define MULTILINETYPE
Definition liblwgeom.h:106
#define LINETYPE
Definition liblwgeom.h:103
#define MULTIPOINTTYPE
Definition liblwgeom.h:105
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:102
#define TINTYPE
Definition liblwgeom.h:116
#define MULTIPOLYGONTYPE
Definition liblwgeom.h:107
#define POLYGONTYPE
Definition liblwgeom.h:104
#define TRIANGLETYPE
Definition liblwgeom.h:115
#define LWDEBUGF(level, msg,...)
Definition lwgeom_log.h:106
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static int lwtriangle_to_twkb_buf(const LWTRIANGLE *tri, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition lwout_twkb.c:259
static int lwpoint_to_twkb_buf(const LWPOINT *pt, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition lwout_twkb.c:236
static int lwline_to_twkb_buf(const LWLINE *line, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition lwout_twkb.c:249
static int lwpoly_to_twkb_buf(const LWPOLY *poly, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition lwout_twkb.c:273
static int lwmulti_to_twkb_buf(const LWCOLLECTION *col, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition lwout_twkb.c:295
static int lwcollection_to_twkb_buf(const LWCOLLECTION *col, TWKB_GLOBALS *globals, TWKB_STATE *ts)
Definition lwout_twkb.c:345
uint8_t type
Definition liblwgeom.h:462

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(), lwtriangle_to_twkb_buf(), lwtype_name(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, POINTTYPE, POLYGONTYPE, TINTYPE, TRIANGLETYPE, and LWGEOM::type.

Referenced by lwgeom_write_to_buffer(), and lwmulti_to_twkb_buf().

Here is the call graph for this function:
Here is the caller graph for this function: