PostGIS  2.4.9dev-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 1450 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().

1451 {
1452  int type = col->type;
1453  char *ptr, *gmltype;
1454  int i;
1455  LWGEOM *subgeom;
1456 
1457  ptr = output;
1458  gmltype="";
1459 
1460  if (type == MULTIPOINTTYPE) gmltype = "MultiPoint";
1461  else if (type == MULTILINETYPE) gmltype = "MultiCurve";
1462  else if (type == MULTIPOLYGONTYPE) gmltype = "MultiSurface";
1463 
1464  /* Open outmost tag */
1465  ptr += sprintf(ptr, "<%s%s", prefix, gmltype);
1466  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
1467  if (id) ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
1468 
1469  if (!col->ngeoms)
1470  {
1471  ptr += sprintf(ptr, "/>");
1472  return (ptr-output);
1473  }
1474  ptr += sprintf(ptr, ">");
1475 
1476  for (i=0; i<col->ngeoms; i++)
1477  {
1478  subgeom = col->geoms[i];
1479  if (subgeom->type == POINTTYPE)
1480  {
1481  ptr += sprintf(ptr, "<%spointMember>", prefix);
1482  ptr += asgml3_point_buf((LWPOINT*)subgeom, 0, ptr, precision, opts, prefix, id);
1483  ptr += sprintf(ptr, "</%spointMember>", prefix);
1484  }
1485  else if (subgeom->type == LINETYPE)
1486  {
1487  ptr += sprintf(ptr, "<%scurveMember>", prefix);
1488  ptr += asgml3_line_buf((LWLINE*)subgeom, 0, ptr, precision, opts, prefix, id);
1489  ptr += sprintf(ptr, "</%scurveMember>", prefix);
1490  }
1491  else if (subgeom->type == POLYGONTYPE)
1492  {
1493  ptr += sprintf(ptr, "<%ssurfaceMember>", prefix);
1494  ptr += asgml3_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, opts, 0, prefix, id);
1495  ptr += sprintf(ptr, "</%ssurfaceMember>", prefix);
1496  }
1497  }
1498 
1499  /* Close outmost tag */
1500  ptr += sprintf(ptr, "</%s%s>", prefix, gmltype);
1501 
1502  return (ptr-output);
1503 }
#define LINETYPE
Definition: liblwgeom.h:86
uint8_t type
Definition: liblwgeom.h:503
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
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:808
LWGEOM ** geoms
Definition: liblwgeom.h:509
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:1034
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
uint8_t type
Definition: liblwgeom.h:396
type
Definition: ovdump.py:41
#define MULTILINETYPE
Definition: liblwgeom.h:89
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:874
Here is the call graph for this function:
Here is the caller graph for this function: