PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ gserialized_from_lwcollection()

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

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

1034 {
1035  size_t subsize = 0;
1036  uint8_t *loc;
1037  uint32_t i;
1038  int type;
1039 
1040  assert(coll);
1041  assert(buf);
1042 
1043  type = coll->type;
1044  loc = buf;
1045 
1046  /* Write in the type. */
1047  memcpy(loc, &type, sizeof(uint32_t));
1048  loc += sizeof(uint32_t);
1049 
1050  /* Write in the number of subgeoms. */
1051  memcpy(loc, &coll->ngeoms, sizeof(uint32_t));
1052  loc += sizeof(uint32_t);
1053 
1054  /* Serialize subgeoms. */
1055  for ( i=0; i<coll->ngeoms; i++ )
1056  {
1057  if (FLAGS_GET_ZM(coll->flags) != FLAGS_GET_ZM(coll->geoms[i]->flags))
1058  lwerror("Dimensions mismatch in lwcollection");
1059  subsize = gserialized_from_lwgeom_any(coll->geoms[i], loc);
1060  loc += subsize;
1061  }
1062 
1063  return (size_t)(loc - buf);
1064 }
uint8_t type
Definition: liblwgeom.h:505
uint8_t flags
Definition: liblwgeom.h:399
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:152
uint32_t ngeoms
Definition: liblwgeom.h:509
unsigned int uint32_t
Definition: uthash.h:78
uint8_t flags
Definition: liblwgeom.h:506
LWGEOM ** geoms
Definition: liblwgeom.h:511
type
Definition: ovdump.py:41
static size_t gserialized_from_lwgeom_any(const LWGEOM *geom, uint8_t *buf)
unsigned char uint8_t
Definition: uthash.h:79
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
Here is the call graph for this function:
Here is the caller graph for this function: