PostGIS  2.2.8dev-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 1678 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().

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