PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ gserialized_from_lwpoly_size()

static size_t gserialized_from_lwpoly_size ( const LWPOLY poly)
static

Definition at line 447 of file g_serialized.c.

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

Referenced by gserialized_from_any_size().

448 {
449  size_t size = 4; /* Type number. */
450  int i = 0;
451 
452  assert(poly);
453 
454  size += 4; /* Number of rings (zero => empty). */
455  if ( poly->nrings % 2 )
456  size += 4; /* Padding to double alignment. */
457 
458  for ( i = 0; i < poly->nrings; i++ )
459  {
460  size += 4; /* Number of points in ring. */
461  size += poly->rings[i]->npoints * FLAGS_NDIMS(poly->flags) * sizeof(double);
462  }
463 
464  LWDEBUGF(3, "polygon size = %d", size);
465 
466  return size;
467 }
int npoints
Definition: liblwgeom.h:355
POINTARRAY ** rings
Definition: liblwgeom.h:441
int nrings
Definition: liblwgeom.h:439
uint8_t flags
Definition: liblwgeom.h:436
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:136
Here is the caller graph for this function: