PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ gserialized_from_lwpoly_size()

static size_t gserialized_from_lwpoly_size ( const LWPOLY poly)
static

Definition at line 716 of file g_serialized.c.

717 {
718  size_t size = 4; /* Type number. */
719  uint32_t i = 0;
720 
721  assert(poly);
722 
723  size += 4; /* Number of rings (zero => empty). */
724  if ( poly->nrings % 2 )
725  size += 4; /* Padding to double alignment. */
726 
727  for ( i = 0; i < poly->nrings; i++ )
728  {
729  size += 4; /* Number of points in ring. */
730  size += poly->rings[i]->npoints * FLAGS_NDIMS(poly->flags) * sizeof(double);
731  }
732 
733  LWDEBUGF(3, "polygon size = %d", size);
734 
735  return size;
736 }
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:152
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
POINTARRAY ** rings
Definition: liblwgeom.h:460
uint32_t nrings
Definition: liblwgeom.h:458
uint8_t flags
Definition: liblwgeom.h:455
uint32_t npoints
Definition: liblwgeom.h:374
unsigned int uint32_t
Definition: uthash.h:78

References LWPOLY::flags, FLAGS_NDIMS, LWDEBUGF, POINTARRAY::npoints, LWPOLY::nrings, and LWPOLY::rings.

Referenced by gserialized_from_any_size().

Here is the caller graph for this function: