PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ asgml3_multi()

static void asgml3_multi ( stringbuffer_t sb,
const LWCOLLECTION col,
const GML_Options opts 
)
static

Definition at line 682 of file lwout_gml.c.

683 {
684  int type = col->type;
685  uint32_t i;
686  LWGEOM *subgeom;
687  /* Subgeoms don't get an SRS */
688  GML_Options subopts = *opts;
689  subopts.srs = 0;
690 
691  const char* gmltype = "";
692 
693  if (type == MULTIPOINTTYPE) gmltype = "MultiPoint";
694  else if (type == MULTILINETYPE) gmltype = "MultiCurve";
695  else if (type == MULTIPOLYGONTYPE) gmltype = "MultiSurface";
696 
697  /* Open outmost tag */
698  stringbuffer_aprintf(sb, "<%s%s", opts->prefix, gmltype);
699  if (opts->srs) stringbuffer_aprintf(sb, " srsName=\"%s\"", opts->srs);
700  if (opts->id) stringbuffer_aprintf(sb, " %sid=\"%s\"", opts->prefix, opts->id);
701 
702  if (!col->ngeoms)
703  {
704  stringbuffer_append(sb, "/>");
705  return;
706  }
707  stringbuffer_append(sb, ">");
708 
709  for (i=0; i<col->ngeoms; i++)
710  {
711  subgeom = col->geoms[i];
712  if (subgeom->type == POINTTYPE)
713  {
714  stringbuffer_aprintf(sb, "<%spointMember>", opts->prefix);
715  asgml3_point(sb, (LWPOINT*)subgeom, &subopts);
716  stringbuffer_aprintf(sb, "</%spointMember>", opts->prefix);
717  }
718  else if (subgeom->type == LINETYPE)
719  {
720  stringbuffer_aprintf(sb, "<%scurveMember>", opts->prefix);
721  asgml3_line(sb, (LWLINE*)subgeom, &subopts);
722  stringbuffer_aprintf(sb, "</%scurveMember>", opts->prefix);
723  }
724  else if (subgeom->type == POLYGONTYPE)
725  {
726  stringbuffer_aprintf(sb, "<%ssurfaceMember>", opts->prefix);
727  asgml3_poly(sb, (LWPOLY*)subgeom, &subopts);
728  stringbuffer_aprintf(sb, "</%ssurfaceMember>", opts->prefix);
729  }
730  }
731 
732  /* Close outmost tag */
733  stringbuffer_aprintf(sb, "</%s%s>", opts->prefix, gmltype);
734 }
#define MULTILINETYPE
Definition: liblwgeom.h:106
#define LINETYPE
Definition: liblwgeom.h:103
#define MULTIPOINTTYPE
Definition: liblwgeom.h:105
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:102
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:107
#define POLYGONTYPE
Definition: liblwgeom.h:104
static void asgml3_poly(stringbuffer_t *sb, const LWPOLY *poly, const GML_Options *opts)
Definition: lwout_gml.c:456
static void asgml3_line(stringbuffer_t *sb, const LWLINE *line, const GML_Options *opts)
Definition: lwout_gml.c:401
static void asgml3_point(stringbuffer_t *sb, const LWPOINT *point, const GML_Options *opts)
Definition: lwout_gml.c:378
opts
Definition: ovdump.py:45
type
Definition: ovdump.py:42
int stringbuffer_aprintf(stringbuffer_t *s, const char *fmt,...)
Appends a formatted string to the current string buffer, using the format and argument list provided.
Definition: stringbuffer.c:247
static void stringbuffer_append(stringbuffer_t *s, const char *a)
Append the specified string to the stringbuffer_t.
Definition: stringbuffer.h:105
const char * srs
Definition: lwout_gml.c:41
uint32_t ngeoms
Definition: liblwgeom.h:580
uint8_t type
Definition: liblwgeom.h:578
LWGEOM ** geoms
Definition: liblwgeom.h:575
uint8_t type
Definition: liblwgeom.h:462

References asgml3_line(), asgml3_point(), asgml3_poly(), LWCOLLECTION::geoms, LINETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, LWCOLLECTION::ngeoms, ovdump::opts, POINTTYPE, POLYGONTYPE, GML_Options::srs, stringbuffer_append(), stringbuffer_aprintf(), LWGEOM::type, LWCOLLECTION::type, and ovdump::type.

Referenced by asgml3_collection(), and lwgeom_to_gml3().

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