PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ ptarray_to_wkb_size()

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

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

354 {
355  int dims = 2;
356  size_t size = 0;
357 
358  if ( variant & (WKB_ISO | WKB_EXTENDED) )
359  dims = FLAGS_NDIMS(pa->flags);
360 
361  /* Include the npoints if it's not a POINT type) */
362  if ( ! ( variant & WKB_NO_NPOINTS ) )
363  size += WKB_INT_SIZE;
364 
365  /* size of the double list */
366  size += pa->npoints * dims * WKB_DOUBLE_SIZE;
367 
368  return size;
369 }
#define WKB_INT_SIZE
uint8_t variant
Definition: cu_in_twkb.c:26
int npoints
Definition: liblwgeom.h:371
#define WKB_DOUBLE_SIZE
Well-Known Binary (WKB) Output Variant Types.
uint8_t flags
Definition: liblwgeom.h:369
#define WKB_ISO
Definition: liblwgeom.h:2074
#define WKB_EXTENDED
Definition: liblwgeom.h:2076
#define WKB_NO_NPOINTS
Definition: liblwgeom.h:2080
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:152
Here is the caller graph for this function: