PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ empty_to_wkb_size()

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

Definition at line 320 of file lwout_wkb.c.

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

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: