PostGIS  2.5.2dev-r@@SVN_REVISION@@

◆ gserialized_from_lwcollection()

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

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

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