PostGIS  3.0.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 1671 of file lwout_gml.c.

1672 {
1673  char *ptr;
1674  uint32_t i;
1675  LWGEOM *subgeom;
1676 
1677  ptr = output;
1678 
1679  /* Open outmost tag */
1680  ptr += sprintf(ptr, "<%sMultiGeometry", prefix);
1681  if (srs) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
1682  if (id) ptr += sprintf(ptr, " %sid=\"%s\"", prefix, id);
1683 
1684  if (!col->ngeoms)
1685  {
1686  ptr += sprintf(ptr, "/>");
1687  return (ptr-output);
1688  }
1689  ptr += sprintf(ptr, ">");
1690 
1691  for (i=0; i<col->ngeoms; i++)
1692  {
1693  subgeom = col->geoms[i];
1694  ptr += sprintf(ptr, "<%sgeometryMember>", prefix);
1695  if ( subgeom->type == POINTTYPE )
1696  {
1697  ptr += asgml3_point_buf((LWPOINT*)subgeom, 0, ptr, precision, opts, prefix, id);
1698  }
1699  else if ( subgeom->type == LINETYPE )
1700  {
1701  ptr += asgml3_line_buf((LWLINE*)subgeom, 0, ptr, precision, opts, prefix, id);
1702  }
1703  else if ( subgeom->type == POLYGONTYPE )
1704  {
1705  ptr += asgml3_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, opts, 0, prefix, id);
1706  }
1707  else if ( lwgeom_is_collection(subgeom) )
1708  {
1709  if ( subgeom->type == COLLECTIONTYPE )
1710  ptr += asgml3_collection_buf((LWCOLLECTION*)subgeom, 0, ptr, precision, opts, prefix, id);
1711  else
1712  ptr += asgml3_multi_buf((LWCOLLECTION*)subgeom, 0, ptr, precision, opts, prefix, id);
1713  }
1714  else
1715  lwerror("asgml3_collection_buf: unknown geometry type");
1716 
1717  ptr += sprintf(ptr, "</%sgeometryMember>", prefix);
1718  }
1719 
1720  /* Close outmost tag */
1721  ptr += sprintf(ptr, "</%sMultiGeometry>", prefix);
1722 
1723  return (ptr-output);
1724 }
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:1079
#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:1430
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:1671
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:854
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:788
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:1014
opts
Definition: ovdump.py:45
uint32_t ngeoms
Definition: liblwgeom.h:566
LWGEOM ** geoms
Definition: liblwgeom.h:561
uint8_t type
Definition: liblwgeom.h:448

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: