PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ gserialized2_from_lwpoly_size()

static size_t gserialized2_from_lwpoly_size ( const LWPOLY poly)
static

Definition at line 683 of file gserialized2.c.

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

Here is the caller graph for this function: