PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ asgml2_multi_buf()

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

Definition at line 457 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, ovdump::type, LWGEOM::type, and LWCOLLECTION::type.

Referenced by asgml2_collection_buf(), and asgml2_multi().

459 {
460  int type = col->type;
461  char *ptr, *gmltype;
462  int i;
463  LWGEOM *subgeom;
464 
465  ptr = output;
466  gmltype="";
467 
468  if (type == MULTIPOINTTYPE) gmltype = "MultiPoint";
469  else if (type == MULTILINETYPE) gmltype = "MultiLineString";
470  else if (type == MULTIPOLYGONTYPE) gmltype = "MultiPolygon";
471 
472  /* Open outmost tag */
473  ptr += sprintf(ptr, "<%s%s", prefix, gmltype);
474  if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
475 
476  if (!col->ngeoms)
477  {
478  ptr += sprintf(ptr, "/>");
479  return (ptr-output);
480  }
481  ptr += sprintf(ptr, ">");
482 
483  for (i=0; i<col->ngeoms; i++)
484  {
485  subgeom = col->geoms[i];
486  if (subgeom->type == POINTTYPE)
487  {
488  ptr += sprintf(ptr, "<%spointMember>", prefix);
489  ptr += asgml2_point_buf((LWPOINT*)subgeom, 0, ptr, precision, prefix);
490  ptr += sprintf(ptr, "</%spointMember>", prefix);
491  }
492  else if (subgeom->type == LINETYPE)
493  {
494  ptr += sprintf(ptr, "<%slineStringMember>", prefix);
495  ptr += asgml2_line_buf((LWLINE*)subgeom, 0, ptr, precision, prefix);
496  ptr += sprintf(ptr, "</%slineStringMember>", prefix);
497  }
498  else if (subgeom->type == POLYGONTYPE)
499  {
500  ptr += sprintf(ptr, "<%spolygonMember>", prefix);
501  ptr += asgml2_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, prefix);
502  ptr += sprintf(ptr, "</%spolygonMember>", prefix);
503  }
504  }
505 
506  /* Close outmost tag */
507  ptr += sprintf(ptr, "</%s%s>", prefix, gmltype);
508 
509  return (ptr-output);
510 }
#define LINETYPE
Definition: liblwgeom.h:71
uint8_t type
Definition: liblwgeom.h:487
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define MULTIPOINTTYPE
Definition: liblwgeom.h:73
LWGEOM ** geoms
Definition: liblwgeom.h:493
uint8_t precision
Definition: cu_in_twkb.c:25
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:75
static size_t asgml2_point_buf(const LWPOINT *point, const char *srs, char *output, int precision, const char *prefix)
Definition: lwout_gml.c:270
static size_t asgml2_poly_buf(const LWPOLY *poly, const char *srs, char *output, int precision, const char *prefix)
Definition: lwout_gml.c:369
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
uint8_t type
Definition: liblwgeom.h:380
type
Definition: ovdump.py:41
static size_t asgml2_line_buf(const LWLINE *line, const char *srs, char *output, int precision, const char *prefix)
Definition: lwout_gml.c:314
#define MULTILINETYPE
Definition: liblwgeom.h:74
Here is the call graph for this function:
Here is the caller graph for this function: