PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ asgml2_collection_size()

static size_t asgml2_collection_size ( const LWCOLLECTION col,
const char *  srs,
int  precision,
const char *  prefix 
)
static

Definition at line 533 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().

535 {
536  int i;
537  size_t size;
538  size_t prefixlen = strlen(prefix);
539  LWGEOM *subgeom;
540 
541  size = sizeof("<MultiGeometry></MultiGeometry>");
542  size += (prefixlen * 2);
543 
544  if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
545 
546  for (i=0; i<col->ngeoms; i++)
547  {
548  subgeom = col->geoms[i];
549 
550  size += ( sizeof("<geometryMember>/") + prefixlen ) * 2;
551  if ( subgeom->type == POINTTYPE)
552  {
553  size += asgml2_point_size((LWPOINT*)subgeom, 0, precision, prefix);
554  }
555  else if ( subgeom->type == LINETYPE)
556  {
557  size += asgml2_line_size((LWLINE*)subgeom, 0, precision, prefix);
558  }
559  else if ( subgeom->type == POLYGONTYPE)
560  {
561  size += asgml2_poly_size((LWPOLY*)subgeom, 0, precision, prefix);
562  }
563  else if ( lwgeom_is_collection(subgeom) )
564  {
565  size += asgml2_collection_size((LWCOLLECTION*)subgeom, 0, precision, prefix);
566  }
567  else
568  lwerror("asgml2_collection_size: Unable to process geometry type!");
569  }
570 
571 
572  return size;
573 }
#define LINETYPE
Definition: liblwgeom.h:71
static size_t asgml2_point_size(const LWPOINT *point, const char *srs, int precision, const char *prefix)
Definition: lwout_gml.c:258
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 asgml2_line_size(const LWLINE *line, const char *srs, int precision, const char *prefix)
Definition: lwout_gml.c:302
static size_t asgml2_poly_size(const LWPOLY *poly, const char *srs, int precision, const char *prefix)
Definition: lwout_gml.c:349
LWGEOM ** geoms
Definition: liblwgeom.h:493
uint8_t precision
Definition: cu_in_twkb.c:25
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
uint8_t type
Definition: liblwgeom.h:380
static size_t asgml2_collection_size(const LWCOLLECTION *col, const char *srs, int precision, const char *prefix)
Definition: lwout_gml.c:533
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
Here is the call graph for this function:
Here is the caller graph for this function: