PostGIS  2.5.0dev-r@@SVN_REVISION@@
static size_t gserialized_from_lwpoly_size ( const LWPOLY poly)
static

Definition at line 715 of file g_serialized.c.

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

Referenced by gserialized_from_any_size().

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

Here is the caller graph for this function: