PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ gserialized_from_lwpoly_size()

static size_t gserialized_from_lwpoly_size ( const LWPOLY poly)
static

Definition at line 718 of file g_serialized.c.

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

Referenced by gserialized_from_any_size().

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