PostGIS  2.1.10dev-r@@SVN_REVISION@@
static size_t asgml2_collection_size ( const LWCOLLECTION col,
const char *  srs,
int  precision,
const char *  prefix 
)
static

Definition at line 522 of file lwout_gml.c.

References asgml2_line_size(), asgml2_point_size(), asgml2_poly_size(), LWCOLLECTION::geoms, LINETYPE, lwerror(), lwgeom_is_collection(), LWCOLLECTION::ngeoms, POINTTYPE, POLYGONTYPE, and LWGEOM::type.

Referenced by asgml2_collection().

524 {
525  int i;
526  size_t size;
527  size_t prefixlen = strlen(prefix);
528  LWGEOM *subgeom;
529 
530  size = sizeof("<MultiGeometry></MultiGeometry>");
531  size += (prefixlen * 2);
532 
533  if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
534 
535  for (i=0; i<col->ngeoms; i++)
536  {
537  subgeom = col->geoms[i];
538 
539  size += ( sizeof("<geometryMember>/") + prefixlen ) * 2;
540  if ( subgeom->type == POINTTYPE)
541  {
542  size += asgml2_point_size((LWPOINT*)subgeom, 0, precision, prefix);
543  }
544  else if ( subgeom->type == LINETYPE)
545  {
546  size += asgml2_line_size((LWLINE*)subgeom, 0, precision, prefix);
547  }
548  else if ( subgeom->type == POLYGONTYPE)
549  {
550  size += asgml2_poly_size((LWPOLY*)subgeom, 0, precision, prefix);
551  }
552  else if ( lwgeom_is_collection(subgeom) )
553  {
554  size += asgml2_collection_size((LWCOLLECTION*)subgeom, 0, precision, prefix);
555  }
556  else
557  lwerror("asgml2_collection_size: Unable to process geometry type!");
558  }
559 
560 
561  return size;
562 }
#define LINETYPE
Definition: liblwgeom.h:61
static size_t asgml2_point_size(const LWPOINT *point, const char *srs, int precision, const char *prefix)
Definition: lwout_gml.c:251
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 asgml2_line_size(const LWLINE *line, const char *srs, int precision, const char *prefix)
Definition: lwout_gml.c:294
static size_t asgml2_poly_size(const LWPOLY *poly, const char *srs, int precision, const char *prefix)
Definition: lwout_gml.c:340
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
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 asgml2_collection_size(const LWCOLLECTION *col, const char *srs, int precision, const char *prefix)
Definition: lwout_gml.c:522

Here is the call graph for this function:

Here is the caller graph for this function: