PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ gserialized_from_lwpoly_size()

static size_t gserialized_from_lwpoly_size ( const LWPOLY poly)
static

Definition at line 474 of file g_serialized.c.

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

Referenced by gserialized_from_any_size().

475 {
476  size_t size = 4; /* Type number. */
477  int i = 0;
478 
479  assert(poly);
480 
481  size += 4; /* Number of rings (zero => empty). */
482  if ( poly->nrings % 2 )
483  size += 4; /* Padding to double alignment. */
484 
485  for ( i = 0; i < poly->nrings; i++ )
486  {
487  size += 4; /* Number of points in ring. */
488  size += poly->rings[i]->npoints * FLAGS_NDIMS(poly->flags) * sizeof(double);
489  }
490 
491  LWDEBUGF(3, "polygon size = %d", size);
492 
493  return size;
494 }
int npoints
Definition: liblwgeom.h:370
POINTARRAY ** rings
Definition: liblwgeom.h:456
int nrings
Definition: liblwgeom.h:454
uint8_t flags
Definition: liblwgeom.h:451
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:151
Here is the caller graph for this function: