PostGIS  2.1.10dev-r@@SVN_REVISION@@
static size_t asgml2_multi_buf ( const LWCOLLECTION col,
const char *  srs,
char *  output,
int  precision,
const char *  prefix 
)
static

Definition at line 447 of file lwout_gml.c.

References asgml2_line_buf(), asgml2_point_buf(), asgml2_poly_buf(), LWCOLLECTION::geoms, LINETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, LWCOLLECTION::ngeoms, POINTTYPE, POLYGONTYPE, LWGEOM::type, and LWCOLLECTION::type.

Referenced by asgml2_collection_buf(), and asgml2_multi().

449 {
450  int type = col->type;
451  char *ptr, *gmltype;
452  int i;
453  LWGEOM *subgeom;
454 
455  ptr = output;
456  gmltype="";
457 
458  if (type == MULTIPOINTTYPE) gmltype = "MultiPoint";
459  else if (type == MULTILINETYPE) gmltype = "MultiLineString";
460  else if (type == MULTIPOLYGONTYPE) gmltype = "MultiPolygon";
461 
462  /* Open outmost tag */
463  ptr += sprintf(ptr, "<%s%s", prefix, gmltype);
464  if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
465 
466  if (!col->ngeoms) {
467  ptr += sprintf(ptr, "/>");
468  return (ptr-output);
469  }
470  ptr += sprintf(ptr, ">");
471 
472  for (i=0; i<col->ngeoms; i++)
473  {
474  subgeom = col->geoms[i];
475  if (subgeom->type == POINTTYPE)
476  {
477  ptr += sprintf(ptr, "<%spointMember>", prefix);
478  ptr += asgml2_point_buf((LWPOINT*)subgeom, 0, ptr, precision, prefix);
479  ptr += sprintf(ptr, "</%spointMember>", prefix);
480  }
481  else if (subgeom->type == LINETYPE)
482  {
483  ptr += sprintf(ptr, "<%slineStringMember>", prefix);
484  ptr += asgml2_line_buf((LWLINE*)subgeom, 0, ptr, precision, prefix);
485  ptr += sprintf(ptr, "</%slineStringMember>", prefix);
486  }
487  else if (subgeom->type == POLYGONTYPE)
488  {
489  ptr += sprintf(ptr, "<%spolygonMember>", prefix);
490  ptr += asgml2_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, prefix);
491  ptr += sprintf(ptr, "</%spolygonMember>", prefix);
492  }
493  }
494 
495  /* Close outmost tag */
496  ptr += sprintf(ptr, "</%s%s>", prefix, gmltype);
497 
498  return (ptr-output);
499 }
#define LINETYPE
Definition: liblwgeom.h:61
uint8_t type
Definition: liblwgeom.h:459
#define POLYGONTYPE
Definition: liblwgeom.h:62
#define MULTIPOINTTYPE
Definition: liblwgeom.h:63
LWGEOM ** geoms
Definition: liblwgeom.h:465
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:65
static size_t asgml2_point_buf(const LWPOINT *point, const char *srs, char *output, int precision, const char *prefix)
Definition: lwout_gml.c:263
static size_t asgml2_poly_buf(const LWPOLY *poly, const char *srs, char *output, int precision, const char *prefix)
Definition: lwout_gml.c:360
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
uint8_t type
Definition: liblwgeom.h:352
static size_t asgml2_line_buf(const LWLINE *line, const char *srs, char *output, int precision, const char *prefix)
Definition: lwout_gml.c:306
#define MULTILINETYPE
Definition: liblwgeom.h:64

Here is the call graph for this function:

Here is the caller graph for this function: