PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ empty_to_wkb_size()

static size_t empty_to_wkb_size ( const LWGEOM geom,
uint8_t  variant 
)
static

Definition at line 291 of file lwout_wkb.c.

292 {
293  /* endian byte + type integer */
294  size_t size = WKB_BYTE_SIZE + WKB_INT_SIZE;
295 
296  /* optional srid integer */
297  if ( lwgeom_wkb_needs_srid(geom, variant) )
298  size += WKB_INT_SIZE;
299 
300  /* Represent POINT EMPTY as POINT(NaN NaN) */
301  if ( geom->type == POINTTYPE )
302  {
303  const LWPOINT *pt = (LWPOINT*)geom;
304  size += WKB_DOUBLE_SIZE * FLAGS_NDIMS(pt->point->flags);
305  }
306  /* num-elements */
307  else
308  {
309  size += WKB_INT_SIZE;
310  }
311 
312  return size;
313 }
static uint8_t variant
Definition: cu_in_twkb.c:26
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:152
#define WKB_BYTE_SIZE
#define WKB_INT_SIZE
#define WKB_DOUBLE_SIZE
Well-Known Binary (WKB) Output Variant Types.
static int lwgeom_wkb_needs_srid(const LWGEOM *geom, uint8_t variant)
Definition: lwout_wkb.c:63
uint8_t type
Definition: liblwgeom.h:399
POINTARRAY * point
Definition: liblwgeom.h:414
uint8_t flags
Definition: liblwgeom.h:372

References POINTARRAY::flags, FLAGS_NDIMS, lwgeom_wkb_needs_srid(), LWPOINT::point, POINTTYPE, LWGEOM::type, variant, WKB_BYTE_SIZE, WKB_DOUBLE_SIZE, and WKB_INT_SIZE.

Referenced by lwgeom_to_wkb_size(), lwline_to_wkb_size(), lwpoint_to_wkb_size(), lwpoly_to_wkb_size(), and lwtriangle_to_wkb_size().

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