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

Definition at line 765 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().

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

Here is the call graph for this function:

Here is the caller graph for this function: