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

431 {
432  int i;
433  size_t size;
434  size_t prefixlen = strlen(prefix);
435  LWGEOM *subgeom;
436 
437  /* the longest possible multi version */
438  size = sizeof("<MultiLineString></MultiLineString>");
439  size += 2*prefixlen;
440 
441  if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
442 
443  for (i=0; i<col->ngeoms; i++)
444  {
445  subgeom = col->geoms[i];
446  if (subgeom->type == POINTTYPE)
447  {
448  size += ( sizeof("<pointMember>/") + prefixlen ) * 2;
449  size += asgml2_point_size((LWPOINT*)subgeom, 0, precision, prefix);
450  }
451  else if (subgeom->type == LINETYPE)
452  {
453  size += ( sizeof("<lineStringMember>/") + prefixlen ) * 2;
454  size += asgml2_line_size((LWLINE*)subgeom, 0, precision, prefix);
455  }
456  else if (subgeom->type == POLYGONTYPE)
457  {
458  size += ( sizeof("<polygonMember>/") + prefixlen ) * 2;
459  size += asgml2_poly_size((LWPOLY*)subgeom, 0, precision, prefix);
460  }
461  }
462 
463  return size;
464 }
#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
#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
Here is the call graph for this function:
Here is the caller graph for this function: