PostGIS  2.1.10dev-r@@SVN_REVISION@@
static size_t gserialized_from_lwpoly_size ( const LWPOLY poly)
static

Definition at line 449 of file g_serialized.c.

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

Referenced by gserialized_from_any_size().

450 {
451  size_t size = 4; /* Type number. */
452  int i = 0;
453 
454  assert(poly);
455 
456  size += 4; /* Number of rings (zero => empty). */
457  if ( poly->nrings % 2 )
458  size += 4; /* Padding to double alignment. */
459 
460  for ( i = 0; i < poly->nrings; i++ )
461  {
462  size += 4; /* Number of points in ring. */
463  size += poly->rings[i]->npoints * FLAGS_NDIMS(poly->flags) * sizeof(double);
464  }
465 
466  LWDEBUGF(3, "polygon size = %d", size);
467 
468  return size;
469 }
int npoints
Definition: liblwgeom.h:327
POINTARRAY ** rings
Definition: liblwgeom.h:413
int nrings
Definition: liblwgeom.h:411
uint8_t flags
Definition: liblwgeom.h:408
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
#define FLAGS_NDIMS(flags)
Definition: liblwgeom.h:118

Here is the caller graph for this function: