PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ asgml3_multi_buf()

static size_t asgml3_multi_buf ( const LWCOLLECTION col,
const char *  srs,
char *  output,
int  precision,
int  opts,
const char *  prefix,
const char *  id 
)
static

Definition at line 1431 of file lwout_gml.c.

References asgml3_line_buf(), asgml3_point_buf(), asgml3_poly_buf(), LWCOLLECTION::geoms, LINETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, LWCOLLECTION::ngeoms, POINTTYPE, POLYGONTYPE, ovdump::type, LWGEOM::type, and LWCOLLECTION::type.

Referenced by asgml3_collection_buf(), and asgml3_multi().

1432 {
1433  int type = col->type;
1434  char *ptr, *gmltype;
1435  uint32_t i;
1436  LWGEOM *subgeom;
1437 
1438  ptr = output;
1439  gmltype="";
1440 
1441  if (type == MULTIPOINTTYPE) gmltype = "MultiPoint";
1442  else if (type == MULTILINETYPE) gmltype = "MultiCurve";
1443  else if (type == MULTIPOLYGONTYPE) gmltype = "MultiSurface";
1444 
1445  /* Open outmost tag */
1446  ptr += sprintf(ptr, "<%s%s", prefix, gmltype);
1447  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
1448  if (id) ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
1449 
1450  if (!col->ngeoms)
1451  {
1452  ptr += sprintf(ptr, "/>");
1453  return (ptr-output);
1454  }
1455  ptr += sprintf(ptr, ">");
1456 
1457  for (i=0; i<col->ngeoms; i++)
1458  {
1459  subgeom = col->geoms[i];
1460  if (subgeom->type == POINTTYPE)
1461  {
1462  ptr += sprintf(ptr, "<%spointMember>", prefix);
1463  ptr += asgml3_point_buf((LWPOINT*)subgeom, 0, ptr, precision, opts, prefix, id);
1464  ptr += sprintf(ptr, "</%spointMember>", prefix);
1465  }
1466  else if (subgeom->type == LINETYPE)
1467  {
1468  ptr += sprintf(ptr, "<%scurveMember>", prefix);
1469  ptr += asgml3_line_buf((LWLINE*)subgeom, 0, ptr, precision, opts, prefix, id);
1470  ptr += sprintf(ptr, "</%scurveMember>", prefix);
1471  }
1472  else if (subgeom->type == POLYGONTYPE)
1473  {
1474  ptr += sprintf(ptr, "<%ssurfaceMember>", prefix);
1475  ptr += asgml3_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, opts, 0, prefix, id);
1476  ptr += sprintf(ptr, "</%ssurfaceMember>", prefix);
1477  }
1478  }
1479 
1480  /* Close outmost tag */
1481  ptr += sprintf(ptr, "</%s%s>", prefix, gmltype);
1482 
1483  return (ptr-output);
1484 }
#define LINETYPE
Definition: liblwgeom.h:85
uint8_t type
Definition: liblwgeom.h:505
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define MULTIPOINTTYPE
Definition: liblwgeom.h:87
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:789
uint32_t ngeoms
Definition: liblwgeom.h:509
unsigned int uint32_t
Definition: uthash.h:78
LWGEOM ** geoms
Definition: liblwgeom.h:511
uint8_t precision
Definition: cu_in_twkb.c:25
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:1015
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:89
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
uint8_t type
Definition: liblwgeom.h:398
type
Definition: ovdump.py:41
#define MULTILINETYPE
Definition: liblwgeom.h:88
opts
Definition: ovdump.py:44
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:855
Here is the call graph for this function:
Here is the caller graph for this function: