PostGIS  2.4.9dev-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 546 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().

548 {
549  int i;
550  size_t size;
551  size_t prefixlen = strlen(prefix);
552  LWGEOM *subgeom;
553 
554  size = sizeof("<MultiGeometry></MultiGeometry>");
555  size += (prefixlen * 2);
556 
557  if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
558 
559  for (i=0; i<col->ngeoms; i++)
560  {
561  subgeom = col->geoms[i];
562 
563  size += ( sizeof("<geometryMember>/") + prefixlen ) * 2;
564  if ( subgeom->type == POINTTYPE)
565  {
566  size += asgml2_point_size((LWPOINT*)subgeom, 0, precision, prefix);
567  }
568  else if ( subgeom->type == LINETYPE)
569  {
570  size += asgml2_line_size((LWLINE*)subgeom, 0, precision, prefix);
571  }
572  else if ( subgeom->type == POLYGONTYPE)
573  {
574  size += asgml2_poly_size((LWPOLY*)subgeom, 0, precision, prefix);
575  }
576  else if ( lwgeom_is_collection(subgeom) )
577  {
578  size += asgml2_collection_size((LWCOLLECTION*)subgeom, 0, precision, prefix);
579  }
580  else
581  lwerror("asgml2_collection_size: Unable to process geometry type!");
582  }
583 
584 
585  return size;
586 }
#define LINETYPE
Definition: liblwgeom.h:86
static size_t asgml2_point_size(const LWPOINT *point, const char *srs, int precision, const char *prefix)
Definition: lwout_gml.c:271
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1040
#define POLYGONTYPE
Definition: liblwgeom.h:87
static size_t asgml2_line_size(const LWLINE *line, const char *srs, int precision, const char *prefix)
Definition: lwout_gml.c:315
static size_t asgml2_poly_size(const LWPOLY *poly, const char *srs, int precision, const char *prefix)
Definition: lwout_gml.c:362
LWGEOM ** geoms
Definition: liblwgeom.h:509
uint8_t precision
Definition: cu_in_twkb.c:25
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
uint8_t type
Definition: liblwgeom.h:396
static size_t asgml2_collection_size(const LWCOLLECTION *col, const char *srs, int precision, const char *prefix)
Definition: lwout_gml.c:546
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
Here is the call graph for this function:
Here is the caller graph for this function: