PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ gserialized1_from_lwpoly_size()

static size_t gserialized1_from_lwpoly_size ( const LWPOLY poly)
static

Definition at line 630 of file gserialized1.c.

631 {
632  size_t size = 4; /* Type number. */
633  uint32_t i = 0;
634 
635  assert(poly);
636 
637  size += 4; /* Number of rings (zero => empty). */
638  if ( poly->nrings % 2 )
639  size += 4; /* Padding to double alignment. */
640 
641  for ( i = 0; i < poly->nrings; i++ )
642  {
643  size += 4; /* Number of points in ring. */
644  size += poly->rings[i]->npoints * FLAGS_NDIMS(poly->flags) * sizeof(double);
645  }
646 
647  LWDEBUGF(3, "polygon size = %d", size);
648 
649  return size;
650 }
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:179
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
POINTARRAY ** rings
Definition: liblwgeom.h:519
uint32_t nrings
Definition: liblwgeom.h:524
lwflags_t flags
Definition: liblwgeom.h:521
uint32_t npoints
Definition: liblwgeom.h:427

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

Referenced by gserialized1_from_any_size().

Here is the caller graph for this function: