PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ gserialized2_from_lwpoly_size()

static size_t gserialized2_from_lwpoly_size ( const LWPOLY poly)
static

Definition at line 682 of file gserialized2.c.

683 {
684  size_t size = 4; /* Type number. */
685  uint32_t i = 0;
686 
687  assert(poly);
688 
689  size += 4; /* Number of rings (zero => empty). */
690  if (poly->nrings % 2)
691  size += 4; /* Padding to double alignment. */
692 
693  for (i = 0; i < poly->nrings; i++)
694  {
695  size += 4; /* Number of points in ring. */
696  size += poly->rings[i]->npoints * FLAGS_NDIMS(poly->flags) * sizeof(double);
697  }
698 
699  LWDEBUGF(3, "polygon size = %d", size);
700 
701  return size;
702 }
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:193
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
POINTARRAY ** rings
Definition: liblwgeom.h:505
uint32_t nrings
Definition: liblwgeom.h:510
lwflags_t flags
Definition: liblwgeom.h:507
uint32_t npoints
Definition: liblwgeom.h:413

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: