PostGIS  2.5.7dev-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 1672 of file lwout_gml.c.

1673 {
1674  char *ptr;
1675  uint32_t i;
1676  LWGEOM *subgeom;
1677 
1678  ptr = output;
1679 
1680  /* Open outmost tag */
1681  ptr += sprintf(ptr, "<%sMultiGeometry", prefix);
1682  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
1683  if (id) ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
1684 
1685  if (!col->ngeoms)
1686  {
1687  ptr += sprintf(ptr, "/>");
1688  return (ptr-output);
1689  }
1690  ptr += sprintf(ptr, ">");
1691 
1692  for (i=0; i<col->ngeoms; i++)
1693  {
1694  subgeom = col->geoms[i];
1695  ptr += sprintf(ptr, "<%sgeometryMember>", prefix);
1696  if ( subgeom->type == POINTTYPE )
1697  {
1698  ptr += asgml3_point_buf((LWPOINT*)subgeom, 0, ptr, precision, opts, prefix, id);
1699  }
1700  else if ( subgeom->type == LINETYPE )
1701  {
1702  ptr += asgml3_line_buf((LWLINE*)subgeom, 0, ptr, precision, opts, prefix, id);
1703  }
1704  else if ( subgeom->type == POLYGONTYPE )
1705  {
1706  ptr += asgml3_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, opts, 0, prefix, id);
1707  }
1708  else if ( lwgeom_is_collection(subgeom) )
1709  {
1710  if ( subgeom->type == COLLECTIONTYPE )
1711  ptr += asgml3_collection_buf((LWCOLLECTION*)subgeom, 0, ptr, precision, opts, prefix, id);
1712  else
1713  ptr += asgml3_multi_buf((LWCOLLECTION*)subgeom, 0, ptr, precision, opts, prefix, id);
1714  }
1715  else
1716  lwerror("asgml3_collection_buf: unknown geometry type");
1717 
1718  ptr += sprintf(ptr, "</%sgeometryMember>", prefix);
1719  }
1720 
1721  /* Close outmost tag */
1722  ptr += sprintf(ptr, "</%sMultiGeometry>", prefix);
1723 
1724  return (ptr-output);
1725 }
static uint8_t precision
Definition: cu_in_twkb.c:25
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
#define LINETYPE
Definition: liblwgeom.h:86
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1085
#define POLYGONTYPE
Definition: liblwgeom.h:87
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:1431
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:1672
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
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
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
opts
Definition: ovdump.py:44
uint32_t ngeoms
Definition: liblwgeom.h:510
LWGEOM ** geoms
Definition: liblwgeom.h:512
uint8_t type
Definition: liblwgeom.h:399
unsigned int uint32_t
Definition: uthash.h:78

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: