PostGIS  2.1.10dev-r@@SVN_REVISION@@
static size_t asgml3_collection_buf ( const LWCOLLECTION col,
const char *  srs,
char *  output,
int  precision,
int  opts,
const char *  prefix,
const char *  id 
)
static

Definition at line 1319 of file lwout_gml.c.

References asgml3_line_buf(), asgml3_multi_buf(), asgml3_point_buf(), asgml3_poly_buf(), COLLECTIONTYPE, LWCOLLECTION::geoms, LINETYPE, lwerror(), lwgeom_is_collection(), LWCOLLECTION::ngeoms, POINTTYPE, POLYGONTYPE, and LWGEOM::type.

Referenced by asgml3_collection().

1320 {
1321  char *ptr;
1322  int i;
1323  LWGEOM *subgeom;
1324 
1325  ptr = output;
1326 
1327  /* Open outmost tag */
1328  ptr += sprintf(ptr, "<%sMultiGeometry", prefix);
1329  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
1330  if (id) ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
1331 
1332  if (!col->ngeoms) {
1333  ptr += sprintf(ptr, "/>");
1334  return (ptr-output);
1335  }
1336  ptr += sprintf(ptr, ">");
1337 
1338  for (i=0; i<col->ngeoms; i++)
1339  {
1340  subgeom = col->geoms[i];
1341  ptr += sprintf(ptr, "<%sgeometryMember>", prefix);
1342  if ( subgeom->type == POINTTYPE )
1343  {
1344  ptr += asgml3_point_buf((LWPOINT*)subgeom, 0, ptr, precision, opts, prefix, id);
1345  }
1346  else if ( subgeom->type == LINETYPE )
1347  {
1348  ptr += asgml3_line_buf((LWLINE*)subgeom, 0, ptr, precision, opts, prefix, id);
1349  }
1350  else if ( subgeom->type == POLYGONTYPE )
1351  {
1352  ptr += asgml3_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, opts, 0, prefix, id);
1353  }
1354  else if ( lwgeom_is_collection(subgeom) )
1355  {
1356  if ( subgeom->type == COLLECTIONTYPE )
1357  ptr += asgml3_collection_buf((LWCOLLECTION*)subgeom, 0, ptr, precision, opts, prefix, id);
1358  else
1359  ptr += asgml3_multi_buf((LWCOLLECTION*)subgeom, 0, ptr, precision, opts, prefix, id);
1360  }
1361  else
1362  lwerror("asgml3_collection_buf: unknown geometry type");
1363 
1364  ptr += sprintf(ptr, "</%sgeometryMember>", prefix);
1365  }
1366 
1367  /* Close outmost tag */
1368  ptr += sprintf(ptr, "</%sMultiGeometry>", prefix);
1369 
1370  return (ptr-output);
1371 }
#define LINETYPE
Definition: liblwgeom.h:61
static size_t asgml3_collection_buf(const LWCOLLECTION *col, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:1319
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:947
#define POLYGONTYPE
Definition: liblwgeom.h:62
static size_t asgml3_point_buf(const LWPOINT *point, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:768
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
LWGEOM ** geoms
Definition: liblwgeom.h:465
static size_t asgml3_poly_buf(const LWPOLY *poly, const char *srs, char *output, int precision, int opts, int is_patch, const char *prefix, const char *id)
Definition: lwout_gml.c:917
static size_t asgml3_multi_buf(const LWCOLLECTION *col, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:1079
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
uint8_t type
Definition: liblwgeom.h:352
static size_t asgml3_line_buf(const LWLINE *line, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:833
#define COLLECTIONTYPE
Definition: liblwgeom.h:66

Here is the call graph for this function:

Here is the caller graph for this function: