PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ asgml2_multi_size()

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

Definition at line 416 of file lwout_gml.c.

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

Referenced by asgml2_multi().

418 {
419  int i;
420  size_t size;
421  size_t prefixlen = strlen(prefix);
422  LWGEOM *subgeom;
423 
424  /* the longest possible multi version */
425  size = sizeof("<MultiLineString></MultiLineString>");
426  size += 2*prefixlen;
427 
428  if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
429 
430  for (i=0; i<col->ngeoms; i++)
431  {
432  subgeom = col->geoms[i];
433  if (subgeom->type == POINTTYPE)
434  {
435  size += ( sizeof("<pointMember>/") + prefixlen ) * 2;
436  size += asgml2_point_size((LWPOINT*)subgeom, 0, precision, prefix);
437  }
438  else if (subgeom->type == LINETYPE)
439  {
440  size += ( sizeof("<lineStringMember>/") + prefixlen ) * 2;
441  size += asgml2_line_size((LWLINE*)subgeom, 0, precision, prefix);
442  }
443  else if (subgeom->type == POLYGONTYPE)
444  {
445  size += ( sizeof("<polygonMember>/") + prefixlen ) * 2;
446  size += asgml2_poly_size((LWPOLY*)subgeom, 0, precision, prefix);
447  }
448  }
449 
450  return size;
451 }
#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
#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
Here is the call graph for this function:
Here is the caller graph for this function: