PostGIS  2.5.7dev-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.

548 {
549  uint32_t 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 }
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 asgml2_point_size(const LWPOINT *point, const char *srs, int precision, const char *prefix)
Definition: lwout_gml.c:271
static size_t asgml2_collection_size(const LWCOLLECTION *col, const char *srs, int precision, const char *prefix)
Definition: lwout_gml.c:546
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
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 asgml2_line_size(), asgml2_point_size(), asgml2_poly_size(), LWCOLLECTION::geoms, LINETYPE, lwerror(), lwgeom_is_collection(), LWCOLLECTION::ngeoms, POINTTYPE, POLYGONTYPE, precision, and LWGEOM::type.

Referenced by asgml2_collection().

Here is the call graph for this function:
Here is the caller graph for this function: