PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ gserialized_from_lwcollection()

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

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

1038 {
1039  size_t subsize = 0;
1040  uint8_t *loc;
1041  int i;
1042  int type;
1043 
1044  assert(coll);
1045  assert(buf);
1046 
1047  type = coll->type;
1048  loc = buf;
1049 
1050  /* Write in the type. */
1051  memcpy(loc, &type, sizeof(uint32_t));
1052  loc += sizeof(uint32_t);
1053 
1054  /* Write in the number of subgeoms. */
1055  memcpy(loc, &coll->ngeoms, sizeof(uint32_t));
1056  loc += sizeof(uint32_t);
1057 
1058  /* Serialize subgeoms. */
1059  for ( i=0; i<coll->ngeoms; i++ )
1060  {
1061  if (FLAGS_GET_ZM(coll->flags) != FLAGS_GET_ZM(coll->geoms[i]->flags))
1062  lwerror("Dimensions mismatch in lwcollection");
1063  subsize = gserialized_from_lwgeom_any(coll->geoms[i], loc);
1064  loc += subsize;
1065  }
1066 
1067  return (size_t)(loc - buf);
1068 }
uint8_t type
Definition: liblwgeom.h:503
uint8_t flags
Definition: liblwgeom.h:397
#define FLAGS_GET_ZM(flags)
Definition: liblwgeom.h:153
unsigned int uint32_t
Definition: uthash.h:78
uint8_t flags
Definition: liblwgeom.h:504
LWGEOM ** geoms
Definition: liblwgeom.h:509
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: