PostGIS  2.1.10dev-r@@SVN_REVISION@@
static uint8_t * lwgeom_to_wkb_buf ( const LWGEOM geom,
uint8_t *  buf,
uint8_t  variant 
)
static

Definition at line 636 of file lwout_wkb.c.

References CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, empty_to_wkb_buf(), LINETYPE, lwcollection_to_wkb_buf(), lwerror(), lwgeom_is_empty(), lwline_to_wkb_buf(), lwpoint_to_wkb_buf(), lwpoly_to_wkb_buf(), lwtriangle_to_wkb_buf(), lwtype_name(), MULTICURVETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, MULTISURFACETYPE, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, TINTYPE, TRIANGLETYPE, and LWGEOM::type.

Referenced by lwcollection_to_wkb_buf(), and lwgeom_to_wkb().

637 {
638 
639  if ( lwgeom_is_empty(geom) )
640  return empty_to_wkb_buf(geom, buf, variant);
641 
642  switch ( geom->type )
643  {
644  case POINTTYPE:
645  return lwpoint_to_wkb_buf((LWPOINT*)geom, buf, variant);
646 
647  /* LineString and CircularString both have 'points' elements */
648  case CIRCSTRINGTYPE:
649  case LINETYPE:
650  return lwline_to_wkb_buf((LWLINE*)geom, buf, variant);
651 
652  /* Polygon has 'nrings' and 'rings' elements */
653  case POLYGONTYPE:
654  return lwpoly_to_wkb_buf((LWPOLY*)geom, buf, variant);
655 
656  /* Triangle has one ring of three points */
657  case TRIANGLETYPE:
658  return lwtriangle_to_wkb_buf((LWTRIANGLE*)geom, buf, variant);
659 
660  /* All these Collection types have 'ngeoms' and 'geoms' elements */
661  case MULTIPOINTTYPE:
662  case MULTILINETYPE:
663  case MULTIPOLYGONTYPE:
664  case COMPOUNDTYPE:
665  case CURVEPOLYTYPE:
666  case MULTICURVETYPE:
667  case MULTISURFACETYPE:
668  case COLLECTIONTYPE:
670  case TINTYPE:
671  return lwcollection_to_wkb_buf((LWCOLLECTION*)geom, buf, variant);
672 
673  /* Unknown type! */
674  default:
675  lwerror("Unsupported geometry type: %s [%d]", lwtype_name(geom->type), geom->type);
676  }
677  /* Return value to keep compiler happy. */
678  return 0;
679 }
#define LINETYPE
Definition: liblwgeom.h:61
static uint8_t * empty_to_wkb_buf(const LWGEOM *geom, uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:285
#define MULTICURVETYPE
Definition: liblwgeom.h:70
static uint8_t * lwline_to_wkb_buf(const LWLINE *line, uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:428
static uint8_t * lwpoly_to_wkb_buf(const LWPOLY *poly, uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:503
#define POLYGONTYPE
Definition: liblwgeom.h:62
#define CURVEPOLYTYPE
Definition: liblwgeom.h:69
#define COMPOUNDTYPE
Definition: liblwgeom.h:68
#define MULTIPOINTTYPE
Definition: liblwgeom.h:63
static uint8_t * lwpoint_to_wkb_buf(const LWPOINT *pt, uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:390
#define TRIANGLETYPE
Definition: liblwgeom.h:73
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:72
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:164
#define TINTYPE
Definition: liblwgeom.h:74
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:65
#define MULTISURFACETYPE
Definition: liblwgeom.h:71
static uint8_t * lwcollection_to_wkb_buf(const LWCOLLECTION *col, uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:550
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
uint8_t type
Definition: liblwgeom.h:352
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:67
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
Definition: lwgeom.c:1229
#define MULTILINETYPE
Definition: liblwgeom.h:64
#define COLLECTIONTYPE
Definition: liblwgeom.h:66
static uint8_t * lwtriangle_to_wkb_buf(const LWTRIANGLE *tri, uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:460

Here is the call graph for this function:

Here is the caller graph for this function: