PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ asgml2_multi()

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

Definition at line 273 of file lwout_gml.c.

274 {
275  uint32_t i;
276  const char* gmltype = "";
277  int type = col->type;
278 
279  /* Subgeoms don't get an SRS */
280  GML_Options subopts = *opts;
281  subopts.srs = 0;
282 
283  if (type == MULTIPOINTTYPE) gmltype = "MultiPoint";
284  else if (type == MULTILINETYPE) gmltype = "MultiLineString";
285  else if (type == MULTIPOLYGONTYPE) gmltype = "MultiPolygon";
286 
287  /* Open outmost tag */
288  stringbuffer_aprintf(sb, "<%s%s", opts->prefix, gmltype);
289  if (opts->srs) stringbuffer_aprintf(sb, " srsName=\"%s\"", opts->srs);
290 
291  if (!col->ngeoms)
292  {
293  stringbuffer_append(sb, "/>");
294  return;
295  }
296  stringbuffer_append(sb, ">");
297 
298  for (i=0; i<col->ngeoms; i++)
299  {
300  LWGEOM* subgeom = col->geoms[i];
301  if (subgeom->type == POINTTYPE)
302  {
303  stringbuffer_aprintf(sb, "<%spointMember>", opts->prefix);
304  asgml2_point(sb, (LWPOINT*)subgeom, &subopts);
305  stringbuffer_aprintf(sb, "</%spointMember>", opts->prefix);
306  }
307  else if (subgeom->type == LINETYPE)
308  {
309  stringbuffer_aprintf(sb, "<%slineStringMember>", opts->prefix);
310  asgml2_line(sb, (LWLINE*)subgeom, &subopts);
311  stringbuffer_aprintf(sb, "</%slineStringMember>", opts->prefix);
312  }
313  else if (subgeom->type == POLYGONTYPE)
314  {
315  stringbuffer_aprintf(sb, "<%spolygonMember>", opts->prefix);
316  asgml2_poly(sb, (LWPOLY*)subgeom, &subopts);
317  stringbuffer_aprintf(sb, "</%spolygonMember>", opts->prefix);
318  }
319  }
320 
321  /* Close outmost tag */
322  stringbuffer_aprintf(sb, "</%s%s>", opts->prefix, gmltype);
323 }
#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 asgml2_point(stringbuffer_t *sb, const LWPOINT *point, const GML_Options *opts)
Definition: lwout_gml.c:203
static void asgml2_poly(stringbuffer_t *sb, const LWPOLY *poly, const GML_Options *opts)
Definition: lwout_gml.c:240
static void asgml2_line(stringbuffer_t *sb, const LWLINE *line, const GML_Options *opts)
Definition: lwout_gml.c:221
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 asgml2_line(), asgml2_point(), asgml2_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 asgml2_collection(), and lwgeom_to_gml2().

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