PostGIS  2.1.10dev-r@@SVN_REVISION@@
static size_t gserialized_from_lwcollection ( const LWCOLLECTION coll,
uint8_t *  buf 
)
static

Definition at line 767 of file g_serialized.c.

References LWGEOM::flags, LWCOLLECTION::flags, FLAGS_GET_ZM, LWCOLLECTION::geoms, gserialized_from_lwgeom_any(), lwerror(), LWCOLLECTION::ngeoms, and LWCOLLECTION::type.

Referenced by gserialized_from_lwgeom_any().

768 {
769  size_t subsize = 0;
770  uint8_t *loc;
771  int i;
772  int type;
773 
774  assert(coll);
775  assert(buf);
776 
777  type = coll->type;
778  loc = buf;
779 
780  /* Write in the type. */
781  memcpy(loc, &type, sizeof(uint32_t));
782  loc += sizeof(uint32_t);
783 
784  /* Write in the number of subgeoms. */
785  memcpy(loc, &coll->ngeoms, sizeof(uint32_t));
786  loc += sizeof(uint32_t);
787 
788  /* Serialize subgeoms. */
789  for ( i=0; i<coll->ngeoms; i++ )
790  {
791  if (FLAGS_GET_ZM(coll->flags) != FLAGS_GET_ZM(coll->geoms[i]->flags))
792  lwerror("Dimensions mismatch in lwcollection");
793  subsize = gserialized_from_lwgeom_any(coll->geoms[i], loc);
794  loc += subsize;
795  }
796 
797  return (size_t)(loc - buf);
798 }
uint8_t type
Definition: liblwgeom.h:459
uint8_t flags
Definition: liblwgeom.h:353
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:119
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
uint8_t flags
Definition: liblwgeom.h:460
LWGEOM ** geoms
Definition: liblwgeom.h:465
static size_t gserialized_from_lwgeom_any(const LWGEOM *geom, uint8_t *buf)
Definition: g_serialized.c:800

Here is the call graph for this function:

Here is the caller graph for this function: