PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ ptarray_to_wkb_size()

static size_t ptarray_to_wkb_size ( const POINTARRAY pa,
uint8_t  variant 
)
static

Definition at line 339 of file lwout_wkb.c.

References POINTARRAY::flags, FLAGS_NDIMS, POINTARRAY::npoints, WKB_DOUBLE_SIZE, WKB_EXTENDED, WKB_INT_SIZE, WKB_ISO, and WKB_NO_NPOINTS.

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

340 {
341  int dims = 2;
342  size_t size = 0;
343 
344  if ( variant & (WKB_ISO | WKB_EXTENDED) )
345  dims = FLAGS_NDIMS(pa->flags);
346 
347  /* Include the npoints if it's not a POINT type) */
348  if ( ! ( variant & WKB_NO_NPOINTS ) )
349  size += WKB_INT_SIZE;
350 
351  /* size of the double list */
352  size += pa->npoints * dims * WKB_DOUBLE_SIZE;
353 
354  return size;
355 }
#define WKB_INT_SIZE
uint8_t variant
Definition: cu_in_twkb.c:26
int npoints
Definition: liblwgeom.h:355
#define WKB_DOUBLE_SIZE
Well-Known Binary (WKB) Output Variant Types.
uint8_t flags
Definition: liblwgeom.h:353
#define WKB_ISO
Definition: liblwgeom.h:1930
#define WKB_EXTENDED
Definition: liblwgeom.h:1932
#define WKB_NO_NPOINTS
Definition: liblwgeom.h:1936
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:136
Here is the caller graph for this function: