PostGIS  3.1.6dev-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 492 of file lwout_gml.c.

494 {
495  int type = col->type;
496  char *ptr, *gmltype;
497  uint32_t i;
498  LWGEOM *subgeom;
499 
500  ptr = output;
501  gmltype="";
502 
503  if (type == MULTIPOINTTYPE) gmltype = "MultiPoint";
504  else if (type == MULTILINETYPE) gmltype = "MultiLineString";
505  else if (type == MULTIPOLYGONTYPE) gmltype = "MultiPolygon";
506 
507  /* Open outmost tag */
508  ptr += sprintf(ptr, "<%s%s", prefix, gmltype);
509  if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
510 
511  if (!col->ngeoms)
512  {
513  ptr += sprintf(ptr, "/>");
514  return (ptr-output);
515  }
516  ptr += sprintf(ptr, ">");
517 
518  for (i=0; i<col->ngeoms; i++)
519  {
520  subgeom = col->geoms[i];
521  if (subgeom->type == POINTTYPE)
522  {
523  ptr += sprintf(ptr, "<%spointMember>", prefix);
524  ptr += asgml2_point_buf((LWPOINT*)subgeom, 0, ptr, precision, prefix);
525  ptr += sprintf(ptr, "</%spointMember>", prefix);
526  }
527  else if (subgeom->type == LINETYPE)
528  {
529  ptr += sprintf(ptr, "<%slineStringMember>", prefix);
530  ptr += asgml2_line_buf((LWLINE*)subgeom, 0, ptr, precision, prefix);
531  ptr += sprintf(ptr, "</%slineStringMember>", prefix);
532  }
533  else if (subgeom->type == POLYGONTYPE)
534  {
535  ptr += sprintf(ptr, "<%spolygonMember>", prefix);
536  ptr += asgml2_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, prefix);
537  ptr += sprintf(ptr, "</%spolygonMember>", prefix);
538  }
539  }
540 
541  /* Close outmost tag */
542  ptr += sprintf(ptr, "</%s%s>", prefix, gmltype);
543 
544  return (ptr-output);
545 }
static uint8_t precision
Definition: cu_in_twkb.c:25
#define MULTILINETYPE
Definition: liblwgeom.h:120
#define LINETYPE
Definition: liblwgeom.h:117
#define MULTIPOINTTYPE
Definition: liblwgeom.h:119
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:116
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:121
#define POLYGONTYPE
Definition: liblwgeom.h:118
static size_t asgml2_poly_buf(const LWPOLY *poly, const char *srs, char *output, int precision, const char *prefix)
Definition: lwout_gml.c:406
static size_t asgml2_point_buf(const LWPOINT *point, const char *srs, char *output, int precision, const char *prefix)
Definition: lwout_gml.c:311
static size_t asgml2_line_buf(const LWLINE *line, const char *srs, char *output, int precision, const char *prefix)
Definition: lwout_gml.c:353
type
Definition: ovdump.py:42
uint32_t ngeoms
Definition: liblwgeom.h:594
uint8_t type
Definition: liblwgeom.h:592
LWGEOM ** geoms
Definition: liblwgeom.h:589
uint8_t type
Definition: liblwgeom.h:476

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

Referenced by asgml2_collection_buf(), and asgml2_multi().

Here is the call graph for this function:
Here is the caller graph for this function: