PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ asgml2_collection()

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

Definition at line 326 of file lwout_gml.c.

327 {
328  uint32_t i;
329  LWGEOM *subgeom;
330 
331  /* Subgeoms don't get an SRS */
332  GML_Options subopts = *opts;
333  subopts.srs = 0;
334 
335  /* Open outmost tag */
336  stringbuffer_aprintf(sb, "<%sMultiGeometry", opts->prefix);
337  if (opts->srs) stringbuffer_aprintf(sb, " srsName=\"%s\"", opts->srs);
338 
339  if (!col->ngeoms)
340  {
341  stringbuffer_append(sb, "/>");
342  return;
343  }
344  stringbuffer_append(sb, ">");
345 
346  for (i=0; i<col->ngeoms; i++)
347  {
348  subgeom = col->geoms[i];
349  stringbuffer_aprintf(sb, "<%sgeometryMember>", opts->prefix);
350  switch (subgeom->type)
351  {
352  case POINTTYPE:
353  asgml2_point(sb, (LWPOINT*)subgeom, &subopts);
354  break;
355  case LINETYPE:
356  asgml2_line(sb, (LWLINE*)subgeom, &subopts);;
357  break;
358  case POLYGONTYPE:
359  asgml2_poly(sb, (LWPOLY*)subgeom, &subopts);
360  break;
361  case MULTIPOINTTYPE:
362  case MULTILINETYPE:
363  case MULTIPOLYGONTYPE:
364  asgml2_multi(sb, (LWCOLLECTION*)subgeom, &subopts);
365  break;
366  case COLLECTIONTYPE:
367  asgml2_collection(sb, (LWCOLLECTION*)subgeom, &subopts);
368  break;
369  }
370  stringbuffer_aprintf(sb, "</%sgeometryMember>", opts->prefix);
371  }
372  stringbuffer_aprintf(sb, "</%sMultiGeometry>", opts->prefix);
373 }
#define COLLECTIONTYPE
Definition: liblwgeom.h:108
#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_collection(stringbuffer_t *sb, const LWCOLLECTION *col, const GML_Options *opts)
Definition: lwout_gml.c:326
static void asgml2_line(stringbuffer_t *sb, const LWLINE *line, const GML_Options *opts)
Definition: lwout_gml.c:221
static void asgml2_multi(stringbuffer_t *sb, const LWCOLLECTION *col, const GML_Options *opts)
Definition: lwout_gml.c:273
opts
Definition: ovdump.py:45
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
LWGEOM ** geoms
Definition: liblwgeom.h:575
uint8_t type
Definition: liblwgeom.h:462

References asgml2_line(), asgml2_multi(), asgml2_point(), asgml2_poly(), COLLECTIONTYPE, LWCOLLECTION::geoms, LINETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, LWCOLLECTION::ngeoms, ovdump::opts, POINTTYPE, POLYGONTYPE, GML_Options::srs, stringbuffer_append(), stringbuffer_aprintf(), and LWGEOM::type.

Referenced by lwgeom_to_gml2().

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