PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ gserialized2_from_lwpoly_size()

static size_t gserialized2_from_lwpoly_size ( const LWPOLY poly)
static

Definition at line 684 of file gserialized2.c.

685 {
686  size_t size = 4; /* Type number. */
687  uint32_t i = 0;
688  const size_t point_size = FLAGS_NDIMS(poly->flags) * sizeof(double);
689 
690  assert(poly);
691 
692  size += 4; /* Number of rings (zero => empty). */
693  if (poly->nrings % 2)
694  size += 4; /* Padding to double alignment. */
695 
696  for (i = 0; i < poly->nrings; i++)
697  {
698  size += 4; /* Number of points in ring. */
699  size += poly->rings[i]->npoints * point_size;
700  }
701 
702  LWDEBUGF(3, "polygon size = %zu", size);
703 
704  return size;
705 }
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:179
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:106
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 gserialized2_from_any_size().

Here is the caller graph for this function: