PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ asgml3_collection_buf()

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 1691 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().

1692 {
1693  char *ptr;
1694  int i;
1695  LWGEOM *subgeom;
1696 
1697  ptr = output;
1698 
1699  /* Open outmost tag */
1700  ptr += sprintf(ptr, "<%sMultiGeometry", prefix);
1701  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
1702  if (id) ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
1703 
1704  if (!col->ngeoms)
1705  {
1706  ptr += sprintf(ptr, "/>");
1707  return (ptr-output);
1708  }
1709  ptr += sprintf(ptr, ">");
1710 
1711  for (i=0; i<col->ngeoms; i++)
1712  {
1713  subgeom = col->geoms[i];
1714  ptr += sprintf(ptr, "<%sgeometryMember>", prefix);
1715  if ( subgeom->type == POINTTYPE )
1716  {
1717  ptr += asgml3_point_buf((LWPOINT*)subgeom, 0, ptr, precision, opts, prefix, id);
1718  }
1719  else if ( subgeom->type == LINETYPE )
1720  {
1721  ptr += asgml3_line_buf((LWLINE*)subgeom, 0, ptr, precision, opts, prefix, id);
1722  }
1723  else if ( subgeom->type == POLYGONTYPE )
1724  {
1725  ptr += asgml3_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, opts, 0, prefix, id);
1726  }
1727  else if ( lwgeom_is_collection(subgeom) )
1728  {
1729  if ( subgeom->type == COLLECTIONTYPE )
1730  ptr += asgml3_collection_buf((LWCOLLECTION*)subgeom, 0, ptr, precision, opts, prefix, id);
1731  else
1732  ptr += asgml3_multi_buf((LWCOLLECTION*)subgeom, 0, ptr, precision, opts, prefix, id);
1733  }
1734  else
1735  lwerror("asgml3_collection_buf: unknown geometry type");
1736 
1737  ptr += sprintf(ptr, "</%sgeometryMember>", prefix);
1738  }
1739 
1740  /* Close outmost tag */
1741  ptr += sprintf(ptr, "</%sMultiGeometry>", prefix);
1742 
1743  return (ptr-output);
1744 }
#define LINETYPE
Definition: liblwgeom.h:86
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:1691
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1040
#define POLYGONTYPE
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: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
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:1450
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
uint8_t type
Definition: liblwgeom.h:396
opts
Definition: ovdump.py:44
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
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
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
Here is the call graph for this function:
Here is the caller graph for this function: