PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ gserialized1_from_lwpoly_size()

static size_t gserialized1_from_lwpoly_size ( const LWPOLY poly)
static

Definition at line 629 of file gserialized1.c.

630 {
631  size_t size = 4; /* Type number. */
632  uint32_t i = 0;
633 
634  assert(poly);
635 
636  size += 4; /* Number of rings (zero => empty). */
637  if ( poly->nrings % 2 )
638  size += 4; /* Padding to double alignment. */
639 
640  for ( i = 0; i < poly->nrings; i++ )
641  {
642  size += 4; /* Number of points in ring. */
643  size += poly->rings[i]->npoints * FLAGS_NDIMS(poly->flags) * sizeof(double);
644  }
645 
646  LWDEBUGF(3, "polygon size = %d", size);
647 
648  return size;
649 }
#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 gserialized1_from_any_size().

Here is the caller graph for this function: