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

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

Referenced by lwcollection_to_wkb_buf(), and lwgeom_to_wkb().

694 {
695 
696  /* Do not simplify empties when outputting to canonical form */
697  if ( lwgeom_is_empty(geom) & ! (variant & WKB_EXTENDED) )
698  return empty_to_wkb_buf(geom, buf, variant);
699 
700  switch ( geom->type )
701  {
702  case POINTTYPE:
703  return lwpoint_to_wkb_buf((LWPOINT*)geom, buf, variant);
704 
705  /* LineString and CircularString both have 'points' elements */
706  case CIRCSTRINGTYPE:
707  case LINETYPE:
708  return lwline_to_wkb_buf((LWLINE*)geom, buf, variant);
709 
710  /* Polygon has 'nrings' and 'rings' elements */
711  case POLYGONTYPE:
712  return lwpoly_to_wkb_buf((LWPOLY*)geom, buf, variant);
713 
714  /* Triangle has one ring of three points */
715  case TRIANGLETYPE:
716  return lwtriangle_to_wkb_buf((LWTRIANGLE*)geom, buf, variant);
717 
718  /* All these Collection types have 'ngeoms' and 'geoms' elements */
719  case MULTIPOINTTYPE:
720  case MULTILINETYPE:
721  case MULTIPOLYGONTYPE:
722  case COMPOUNDTYPE:
723  case CURVEPOLYTYPE:
724  case MULTICURVETYPE:
725  case MULTISURFACETYPE:
726  case COLLECTIONTYPE:
728  case TINTYPE:
729  return lwcollection_to_wkb_buf((LWCOLLECTION*)geom, buf, variant);
730 
731  /* Unknown type! */
732  default:
733  lwerror("Unsupported geometry type: %s [%d]", lwtype_name(geom->type), geom->type);
734  }
735  /* Return value to keep compiler happy. */
736  return 0;
737 }
#define LINETYPE
Definition: liblwgeom.h:71
static uint8_t * empty_to_wkb_buf(const LWGEOM *geom, uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:301
#define MULTICURVETYPE
Definition: liblwgeom.h:80
uint8_t variant
Definition: cu_in_twkb.c:26
static uint8_t * lwline_to_wkb_buf(const LWLINE *line, uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:465
static uint8_t * lwpoly_to_wkb_buf(const LWPOLY *poly, uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:556
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define CURVEPOLYTYPE
Definition: liblwgeom.h:79
#define COMPOUNDTYPE
Definition: liblwgeom.h:78
#define MULTIPOINTTYPE
Definition: liblwgeom.h:73
static uint8_t * lwpoint_to_wkb_buf(const LWPOINT *pt, uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:419
#define TRIANGLETYPE
Definition: liblwgeom.h:83
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:82
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
#define TINTYPE
Definition: liblwgeom.h:84
#define WKB_EXTENDED
Definition: liblwgeom.h:1932
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:75
#define MULTISURFACETYPE
Definition: liblwgeom.h:81
static uint8_t * lwcollection_to_wkb_buf(const LWCOLLECTION *col, uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:607
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
uint8_t type
Definition: liblwgeom.h:380
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:77
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:1297
#define MULTILINETYPE
Definition: liblwgeom.h:74
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
#define COLLECTIONTYPE
Definition: liblwgeom.h:76
static uint8_t * lwtriangle_to_wkb_buf(const LWTRIANGLE *tri, uint8_t *buf, uint8_t variant)
Definition: lwout_wkb.c:505

Here is the call graph for this function:

Here is the caller graph for this function: