PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ asgml3_collection_size()

static size_t asgml3_collection_size ( const LWCOLLECTION col,
const char *  srs,
int  precision,
int  opts,
const char *  prefix,
const char *  id 
)
static

Definition at line 1632 of file lwout_gml.c.

1633 {
1634  uint32_t i;
1635  size_t size;
1636  size_t prefixlen = strlen(prefix);
1637  LWGEOM *subgeom;
1638 
1639  size = sizeof("<MultiGeometry></MultiGeometry>") + prefixlen*2;
1640 
1641  if (srs) size += strlen(srs) + sizeof(" srsName=..");
1642  if (id) size += strlen(id) + strlen(prefix) + sizeof(" id=..");
1643 
1644  for (i=0; i<col->ngeoms; i++)
1645  {
1646  subgeom = col->geoms[i];
1647  size += ( sizeof("<geometryMember>/") + prefixlen ) * 2;
1648  if ( subgeom->type == POINTTYPE )
1649  {
1650  size += asgml3_point_size((LWPOINT*)subgeom, 0, precision, opts, prefix, id);
1651  }
1652  else if ( subgeom->type == LINETYPE )
1653  {
1654  size += asgml3_line_size((LWLINE*)subgeom, 0, precision, opts, prefix, id);
1655  }
1656  else if ( subgeom->type == POLYGONTYPE )
1657  {
1658  size += asgml3_poly_size((LWPOLY*)subgeom, 0, precision, opts, prefix, id);
1659  }
1660  else if ( lwgeom_is_collection(subgeom) )
1661  {
1662  size += asgml3_multi_size((LWCOLLECTION*)subgeom, 0, precision, opts, prefix, id);
1663  }
1664  else
1665  lwerror("asgml3_collection_size: unknown geometry type");
1666  }
1667 
1668  return size;
1669 }
static uint8_t precision
Definition: cu_in_twkb.c:25
#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_poly_size(const LWPOLY *poly, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:995
static size_t asgml3_point_size(const LWPOINT *point, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:775
static size_t asgml3_line_size(const LWLINE *line, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:828
static size_t asgml3_multi_size(const LWCOLLECTION *col, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition: lwout_gml.c:1391
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_size(), asgml3_multi_size(), asgml3_point_size(), asgml3_poly_size(), 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: