PostGIS  3.1.6dev-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 565 of file lwout_gml.c.

567 {
568  uint32_t i;
569  size_t size;
570  size_t prefixlen = strlen(prefix);
571  LWGEOM *subgeom;
572 
573  size = sizeof("<MultiGeometry></MultiGeometry>");
574  size += (prefixlen * 2);
575 
576  if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
577 
578  for (i=0; i<col->ngeoms; i++)
579  {
580  subgeom = col->geoms[i];
581 
582  size += ( sizeof("<geometryMember>/") + prefixlen ) * 2;
583  if ( subgeom->type == POINTTYPE)
584  {
585  size += asgml2_point_size((LWPOINT*)subgeom, 0, precision, prefix);
586  }
587  else if ( subgeom->type == LINETYPE)
588  {
589  size += asgml2_line_size((LWLINE*)subgeom, 0, precision, prefix);
590  }
591  else if ( subgeom->type == POLYGONTYPE)
592  {
593  size += asgml2_poly_size((LWPOLY*)subgeom, 0, precision, prefix);
594  }
595  else if ( lwgeom_is_collection(subgeom) )
596  {
597  size += asgml2_collection_size((LWCOLLECTION*)subgeom, 0, precision, prefix);
598  }
599  else
600  lwerror("asgml2_collection_size: Unable to process geometry type!");
601  }
602 
603 
604  return size;
605 }
static uint8_t precision
Definition: cu_in_twkb.c:25
#define LINETYPE
Definition: liblwgeom.h:117
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:116
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1080
#define POLYGONTYPE
Definition: liblwgeom.h:118
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:299
static size_t asgml2_collection_size(const LWCOLLECTION *col, const char *srs, int precision, const char *prefix)
Definition: lwout_gml.c:565
static size_t asgml2_line_size(const LWLINE *line, const char *srs, int precision, const char *prefix)
Definition: lwout_gml.c:341
static size_t asgml2_poly_size(const LWPOLY *poly, const char *srs, int precision, const char *prefix)
Definition: lwout_gml.c:386
uint32_t ngeoms
Definition: liblwgeom.h:594
LWGEOM ** geoms
Definition: liblwgeom.h:589
uint8_t type
Definition: liblwgeom.h:476

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: