PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ gserialized_from_lwcollection()

static size_t gserialized_from_lwcollection ( const LWCOLLECTION coll,
uint8_t *  buf 
)
static

Definition at line 792 of file g_serialized.c.

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

Referenced by gserialized_from_lwgeom_any().

793 {
794  size_t subsize = 0;
795  uint8_t *loc;
796  int i;
797  int type;
798 
799  assert(coll);
800  assert(buf);
801 
802  type = coll->type;
803  loc = buf;
804 
805  /* Write in the type. */
806  memcpy(loc, &type, sizeof(uint32_t));
807  loc += sizeof(uint32_t);
808 
809  /* Write in the number of subgeoms. */
810  memcpy(loc, &coll->ngeoms, sizeof(uint32_t));
811  loc += sizeof(uint32_t);
812 
813  /* Serialize subgeoms. */
814  for ( i=0; i<coll->ngeoms; i++ )
815  {
816  if (FLAGS_GET_ZM(coll->flags) != FLAGS_GET_ZM(coll->geoms[i]->flags))
817  lwerror("Dimensions mismatch in lwcollection");
818  subsize = gserialized_from_lwgeom_any(coll->geoms[i], loc);
819  loc += subsize;
820  }
821 
822  return (size_t)(loc - buf);
823 }
uint8_t type
Definition: liblwgeom.h:502
uint8_t flags
Definition: liblwgeom.h:396
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:152
uint8_t flags
Definition: liblwgeom.h:503
LWGEOM ** geoms
Definition: liblwgeom.h:508
type
Definition: ovdump.py:41
static size_t gserialized_from_lwgeom_any(const LWGEOM *geom, uint8_t *buf)
Definition: g_serialized.c:825
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:102
Here is the call graph for this function:
Here is the caller graph for this function: