PostGIS  2.4.9dev-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.

References POINTARRAY::flags, FLAGS_NDIMS, lwgeom_wkb_needs_srid(), LWPOINT::point, POINTTYPE, LWGEOM::type, 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().

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 int lwgeom_wkb_needs_srid(const LWGEOM *geom, uint8_t variant)
Definition: lwout_wkb.c:63
#define WKB_INT_SIZE
#define WKB_BYTE_SIZE
uint8_t variant
Definition: cu_in_twkb.c:26
#define WKB_DOUBLE_SIZE
Well-Known Binary (WKB) Output Variant Types.
POINTARRAY * point
Definition: liblwgeom.h:411
uint8_t flags
Definition: liblwgeom.h:369
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
uint8_t type
Definition: liblwgeom.h:396
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:152
Here is the call graph for this function:
Here is the caller graph for this function: