PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ empty_to_wkb_size()

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

Definition at line 319 of file lwout_wkb.c.

320 {
321  /* endian byte + type integer */
322  size_t size = WKB_BYTE_SIZE + WKB_INT_SIZE;
323 
324  /* optional srid integer */
325  if ( lwgeom_wkb_needs_srid(geom, variant) )
326  size += WKB_INT_SIZE;
327 
328  /* Represent POINT EMPTY as POINT(NaN NaN) */
329  if ( geom->type == POINTTYPE )
330  {
331  const LWPOINT *pt = (LWPOINT*)geom;
332  size += WKB_DOUBLE_SIZE * FLAGS_NDIMS(pt->point->flags);
333  }
334  /* num-elements */
335  else
336  {
337  size += WKB_INT_SIZE;
338  }
339 
340  return size;
341 }
static uint8_t variant
Definition: cu_in_twkb.c:26
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:116
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:193
#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:448
POINTARRAY * point
Definition: liblwgeom.h:457
lwflags_t flags
Definition: liblwgeom.h:417

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: