PostGIS  3.1.6dev-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 1679 of file lwout_gml.c.

1680 {
1681  char *ptr;
1682  uint32_t i;
1683  LWGEOM *subgeom;
1684 
1685  ptr = output;
1686 
1687  /* Open outmost tag */
1688  ptr += sprintf(ptr, "<%sMultiGeometry", prefix);
1689  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
1690  if (id) ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
1691 
1692  if (!col->ngeoms)
1693  {
1694  ptr += sprintf(ptr, "/>");
1695  return (ptr-output);
1696  }
1697  ptr += sprintf(ptr, ">");
1698 
1699  for (i=0; i<col->ngeoms; i++)
1700  {
1701  subgeom = col->geoms[i];
1702  ptr += sprintf(ptr, "<%sgeometryMember>", prefix);
1703  if ( subgeom->type == POINTTYPE )
1704  {
1705  ptr += asgml3_point_buf((LWPOINT*)subgeom, 0, ptr, precision, opts, prefix, id);
1706  }
1707  else if ( subgeom->type == LINETYPE )
1708  {
1709  ptr += asgml3_line_buf((LWLINE*)subgeom, 0, ptr, precision, opts, prefix, id);
1710  }
1711  else if ( subgeom->type == POLYGONTYPE )
1712  {
1713  ptr += asgml3_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, opts, 0, prefix, id);
1714  }
1715  else if ( lwgeom_is_collection(subgeom) )
1716  {
1717  if ( subgeom->type == COLLECTIONTYPE )
1718  ptr += asgml3_collection_buf((LWCOLLECTION*)subgeom, 0, ptr, precision, opts, prefix, id);
1719  else
1720  ptr += asgml3_multi_buf((LWCOLLECTION*)subgeom, 0, ptr, precision, opts, prefix, id);
1721  }
1722  else
1723  lwerror("asgml3_collection_buf: unknown geometry type");
1724 
1725  ptr += sprintf(ptr, "</%sgeometryMember>", prefix);
1726  }
1727 
1728  /* Close outmost tag */
1729  ptr += sprintf(ptr, "</%sMultiGeometry>", prefix);
1730 
1731  return (ptr-output);
1732 }
static uint8_t precision
Definition: cu_in_twkb.c:25
#define COLLECTIONTYPE
Definition: liblwgeom.h:122
#define LINETYPE
Definition: liblwgeom.h:117
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:116
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1080
#define POLYGONTYPE
Definition: liblwgeom.h:118
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
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:1444
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:1679
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:863
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:799
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:1024
opts
Definition: ovdump.py:45
uint32_t ngeoms
Definition: liblwgeom.h:594
LWGEOM ** geoms
Definition: liblwgeom.h:589
uint8_t type
Definition: liblwgeom.h:476

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

Referenced by asgml3_collection().

Here is the call graph for this function:
Here is the caller graph for this function: