PostGIS  2.1.10dev-r@@SVN_REVISION@@
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 1279 of file lwout_gml.c.

References asgml3_line_size(), asgml3_multi_size(), asgml3_point_size(), asgml3_poly_size(), LWCOLLECTION::geoms, LINETYPE, lwerror(), lwgeom_is_collection(), LWCOLLECTION::ngeoms, POINTTYPE, POLYGONTYPE, and LWGEOM::type.

Referenced by asgml3_collection().

1280 {
1281  int i;
1282  size_t size;
1283  size_t prefixlen = strlen(prefix);
1284  LWGEOM *subgeom;
1285 
1286  size = sizeof("<MultiGeometry></MultiGeometry>") + prefixlen*2;
1287 
1288  if (srs) size += strlen(srs) + sizeof(" srsName=..");
1289  if (id) size += strlen(id) + strlen(prefix) + sizeof(" id=..");
1290 
1291  for (i=0; i<col->ngeoms; i++)
1292  {
1293  subgeom = col->geoms[i];
1294  size += ( sizeof("<geometryMember>/") + prefixlen ) * 2;
1295  if ( subgeom->type == POINTTYPE )
1296  {
1297  size += asgml3_point_size((LWPOINT*)subgeom, 0, precision, opts, prefix, id);
1298  }
1299  else if ( subgeom->type == LINETYPE )
1300  {
1301  size += asgml3_line_size((LWLINE*)subgeom, 0, precision, opts, prefix, id);
1302  }
1303  else if ( subgeom->type == POLYGONTYPE )
1304  {
1305  size += asgml3_poly_size((LWPOLY*)subgeom, 0, precision, opts, prefix, id);
1306  }
1307  else if ( lwgeom_is_collection(subgeom) )
1308  {
1309  size += asgml3_multi_size((LWCOLLECTION*)subgeom, 0, precision, opts, prefix, id);
1310  }
1311  else
1312  lwerror("asgml3_collection_size: unknown geometry type");
1313  }
1314 
1315  return size;
1316 }
#define LINETYPE
Definition: liblwgeom.h:61
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:947
#define POLYGONTYPE
Definition: liblwgeom.h:62
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:897
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:806
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
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:754
LWGEOM ** geoms
Definition: liblwgeom.h:465
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
uint8_t type
Definition: liblwgeom.h:352
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:1039

Here is the call graph for this function:

Here is the caller graph for this function: