PostGIS  2.2.7dev-r@@SVN_REVISION@@
static size_t empty_to_wkb_size ( const LWGEOM geom,
uint8_t  variant 
)
static

Definition at line 277 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().

278 {
279  /* endian byte + type integer */
280  size_t size = WKB_BYTE_SIZE + WKB_INT_SIZE;
281 
282  /* optional srid integer */
283  if ( lwgeom_wkb_needs_srid(geom, variant) )
284  size += WKB_INT_SIZE;
285 
286  /* Represent POINT EMPTY as POINT(NaN NaN) */
287  if ( geom->type == POINTTYPE )
288  {
289  const LWPOINT *pt = (LWPOINT*)geom;
290  size += WKB_DOUBLE_SIZE * FLAGS_NDIMS(pt->point->flags);
291  }
292  /* num-elements */
293  else
294  {
295  size += WKB_INT_SIZE;
296  }
297 
298  return size;
299 }
static int lwgeom_wkb_needs_srid(const LWGEOM *geom, uint8_t variant)
Definition: lwout_wkb.c:49
#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:395
uint8_t flags
Definition: liblwgeom.h:353
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
uint8_t type
Definition: liblwgeom.h:380
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:136

Here is the call graph for this function:

Here is the caller graph for this function: