PostGIS  2.1.10dev-r@@SVN_REVISION@@
static size_t lwpoly_to_wkb_size ( const LWPOLY poly,
uint8_t  variant 
)
static

Definition at line 484 of file lwout_wkb.c.

References lwgeom_wkb_needs_srid(), LWPOLY::nrings, ptarray_to_wkb_size(), LWPOLY::rings, WKB_BYTE_SIZE, and WKB_INT_SIZE.

Referenced by lwgeom_to_wkb_size().

485 {
486  /* endian flag + type number + number of rings */
487  size_t size = WKB_BYTE_SIZE + WKB_INT_SIZE + WKB_INT_SIZE;
488  int i = 0;
489 
490  /* Extended WKB needs space for optional SRID integer */
491  if ( lwgeom_wkb_needs_srid((LWGEOM*)poly, variant) )
492  size += WKB_INT_SIZE;
493 
494  for ( i = 0; i < poly->nrings; i++ )
495  {
496  /* Size of ring point array */
497  size += ptarray_to_wkb_size(poly->rings[i], variant);
498  }
499 
500  return size;
501 }
static int lwgeom_wkb_needs_srid(const LWGEOM *geom, uint8_t variant)
Definition: lwout_wkb.c:47
#define WKB_INT_SIZE
#define WKB_BYTE_SIZE
static size_t ptarray_to_wkb_size(const POINTARRAY *pa, uint8_t variant)
Definition: lwout_wkb.c:314
POINTARRAY ** rings
Definition: liblwgeom.h:413
int nrings
Definition: liblwgeom.h:411

Here is the call graph for this function:

Here is the caller graph for this function: