PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwpoint_to_wkb_size()

static size_t lwpoint_to_wkb_size ( const LWPOINT pt,
uint8_t  variant 
)
static

Definition at line 415 of file lwout_wkb.c.

References empty_to_wkb_size(), lwgeom_is_empty(), lwgeom_wkb_needs_srid(), ptarray_to_wkb_size(), WKB_BYTE_SIZE, WKB_EXTENDED, WKB_INT_SIZE, and WKB_NO_NPOINTS.

Referenced by lwgeom_to_wkb_size().

416 {
417  /* Endian flag + type number */
418  size_t size = WKB_BYTE_SIZE + WKB_INT_SIZE;
419 
420  /* Only process empty at this level in the EXTENDED case */
421  if ( (variant & WKB_EXTENDED) && lwgeom_is_empty((LWGEOM*)pt) )
422  return empty_to_wkb_size((LWGEOM*)pt, variant);
423 
424  /* Extended WKB needs space for optional SRID integer */
425  if ( lwgeom_wkb_needs_srid((LWGEOM*)pt, variant) )
426  size += WKB_INT_SIZE;
427 
428  /* Points */
429  size += ptarray_to_wkb_size(pt->point, variant | WKB_NO_NPOINTS);
430  return size;
431 }
static int lwgeom_wkb_needs_srid(const LWGEOM *geom, uint8_t variant)
Definition: lwout_wkb.c:63
#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:353
uint8_t variant
Definition: cu_in_twkb.c:26
#define WKB_EXTENDED
Definition: liblwgeom.h:2076
static size_t empty_to_wkb_size(const LWGEOM *geom, uint8_t variant)
Definition: lwout_wkb.c:291
#define WKB_NO_NPOINTS
Definition: liblwgeom.h:2080
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:1346
Here is the call graph for this function:
Here is the caller graph for this function: