PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwtriangle_to_wkb_size()

static size_t lwtriangle_to_wkb_size ( const LWTRIANGLE tri,
uint8_t  variant 
)
static

Definition at line 500 of file lwout_wkb.c.

501 {
502  /* endian flag + type number + number of rings */
503  size_t size = WKB_BYTE_SIZE + WKB_INT_SIZE + WKB_INT_SIZE;
504 
505  /* Only process empty at this level in the EXTENDED case */
506  if ( (variant & WKB_EXTENDED) && lwgeom_is_empty((LWGEOM*)tri) )
507  return empty_to_wkb_size((LWGEOM*)tri, variant);
508 
509  /* Extended WKB needs space for optional SRID integer */
510  if ( lwgeom_wkb_needs_srid((LWGEOM*)tri, variant) )
511  size += WKB_INT_SIZE;
512 
513  /* How big is this point array? */
514  size += ptarray_to_wkb_size(tri->points, variant);
515 
516  return size;
517 }
static uint8_t variant
Definition: cu_in_twkb.c:26
#define WKB_EXTENDED
Definition: liblwgeom.h:2068
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:1393
#define WKB_BYTE_SIZE
#define WKB_INT_SIZE
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:353
static size_t empty_to_wkb_size(const LWGEOM *geom, uint8_t variant)
Definition: lwout_wkb.c:291

References empty_to_wkb_size(), lwgeom_is_empty(), lwgeom_wkb_needs_srid(), LWTRIANGLE::points, ptarray_to_wkb_size(), 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: