PostGIS  2.3.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 470 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().

472 {
473  int type = col->type;
474  char *ptr, *gmltype;
475  int i;
476  LWGEOM *subgeom;
477 
478  ptr = output;
479  gmltype="";
480 
481  if (type == MULTIPOINTTYPE) gmltype = "MultiPoint";
482  else if (type == MULTILINETYPE) gmltype = "MultiLineString";
483  else if (type == MULTIPOLYGONTYPE) gmltype = "MultiPolygon";
484 
485  /* Open outmost tag */
486  ptr += sprintf(ptr, "<%s%s", prefix, gmltype);
487  if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
488 
489  if (!col->ngeoms)
490  {
491  ptr += sprintf(ptr, "/>");
492  return (ptr-output);
493  }
494  ptr += sprintf(ptr, ">");
495 
496  for (i=0; i<col->ngeoms; i++)
497  {
498  subgeom = col->geoms[i];
499  if (subgeom->type == POINTTYPE)
500  {
501  ptr += sprintf(ptr, "<%spointMember>", prefix);
502  ptr += asgml2_point_buf((LWPOINT*)subgeom, 0, ptr, precision, prefix);
503  ptr += sprintf(ptr, "</%spointMember>", prefix);
504  }
505  else if (subgeom->type == LINETYPE)
506  {
507  ptr += sprintf(ptr, "<%slineStringMember>", prefix);
508  ptr += asgml2_line_buf((LWLINE*)subgeom, 0, ptr, precision, prefix);
509  ptr += sprintf(ptr, "</%slineStringMember>", prefix);
510  }
511  else if (subgeom->type == POLYGONTYPE)
512  {
513  ptr += sprintf(ptr, "<%spolygonMember>", prefix);
514  ptr += asgml2_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, prefix);
515  ptr += sprintf(ptr, "</%spolygonMember>", prefix);
516  }
517  }
518 
519  /* Close outmost tag */
520  ptr += sprintf(ptr, "</%s%s>", prefix, gmltype);
521 
522  return (ptr-output);
523 }
#define LINETYPE
Definition: liblwgeom.h:85
uint8_t type
Definition: liblwgeom.h:502
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define MULTIPOINTTYPE
Definition: liblwgeom.h:87
LWGEOM ** geoms
Definition: liblwgeom.h:508
uint8_t precision
Definition: cu_in_twkb.c:25
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:89
static size_t asgml2_point_buf(const LWPOINT *point, const char *srs, char *output, int precision, const char *prefix)
Definition: lwout_gml.c:283
static size_t asgml2_poly_buf(const LWPOLY *poly, const char *srs, char *output, int precision, const char *prefix)
Definition: lwout_gml.c:382
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
uint8_t type
Definition: liblwgeom.h:395
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:327
#define MULTILINETYPE
Definition: liblwgeom.h:88
Here is the call graph for this function:
Here is the caller graph for this function: