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

◆ lwpoly_to_wkb_size()

static size_t lwpoly_to_wkb_size ( const LWPOLY poly,
uint8_t  variant 
)
static

Definition at line 573 of file lwout_wkb.c.

574{
575 /* endian flag + type number + number of rings */
576 size_t size = WKB_BYTE_SIZE + WKB_INT_SIZE + WKB_INT_SIZE;
577 uint32_t i = 0;
578
579 /* Only process empty at this level in the EXTENDED case */
580 if ( (variant & WKB_EXTENDED) && lwgeom_is_empty((LWGEOM*)poly) )
581 return empty_to_wkb_size((LWGEOM*)poly, variant);
582
583 /* Extended WKB needs space for optional SRID integer */
584 if ( lwgeom_wkb_needs_srid((LWGEOM*)poly, variant) )
585 size += WKB_INT_SIZE;
586
587 for ( i = 0; i < poly->nrings; i++ )
588 {
589 /* Size of ring point array */
590 size += ptarray_to_wkb_size(poly->rings[i], variant);
591 }
592
593 return size;
594}
static uint8_t variant
Definition cu_in_twkb.c:26
#define WKB_EXTENDED
Definition liblwgeom.h:2123
#define WKB_BYTE_SIZE
#define WKB_INT_SIZE
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition lwinline.h:193
static int lwgeom_wkb_needs_srid(const LWGEOM *geom, uint8_t variant)
Definition lwout_wkb.c:63
static size_t ptarray_to_wkb_size(const POINTARRAY *pa, uint8_t variant)
Definition lwout_wkb.c:379
static size_t empty_to_wkb_size(const LWGEOM *geom, uint8_t variant)
Definition lwout_wkb.c:319

References empty_to_wkb_size(), lwgeom_is_empty(), lwgeom_wkb_needs_srid(), LWPOLY::nrings, ptarray_to_wkb_size(), LWPOLY::rings, variant, WKB_BYTE_SIZE, WKB_EXTENDED, and WKB_INT_SIZE.

Referenced by lwgeom_to_wkb_size().

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