PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ asgml2_collection_buf()

static size_t asgml2_collection_buf ( const LWCOLLECTION col,
const char *  srs,
char *  output,
int  precision,
const char *  prefix 
)
static

Definition at line 611 of file lwout_gml.c.

612 {
613  char *ptr;
614  uint32_t i;
615  LWGEOM *subgeom;
616 
617  ptr = output;
618 
619  /* Open outmost tag */
620  ptr += sprintf(ptr, "<%sMultiGeometry", prefix);
621  if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
622 
623  if (!col->ngeoms)
624  {
625  ptr += sprintf(ptr, "/>");
626  return (ptr-output);
627  }
628  ptr += sprintf(ptr, ">");
629 
630  for (i=0; i<col->ngeoms; i++)
631  {
632  subgeom = col->geoms[i];
633 
634  ptr += sprintf(ptr, "<%sgeometryMember>", prefix);
635  if (subgeom->type == POINTTYPE)
636  {
637  ptr += asgml2_point_buf((LWPOINT*)subgeom, 0, ptr, precision, prefix);
638  }
639  else if (subgeom->type == LINETYPE)
640  {
641  ptr += asgml2_line_buf((LWLINE*)subgeom, 0, ptr, precision, prefix);
642  }
643  else if (subgeom->type == POLYGONTYPE)
644  {
645  ptr += asgml2_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, prefix);
646  }
647  else if (lwgeom_is_collection(subgeom))
648  {
649  if (subgeom->type == COLLECTIONTYPE)
650  ptr += asgml2_collection_buf((LWCOLLECTION*)subgeom, 0, ptr, precision, prefix);
651  else
652  ptr += asgml2_multi_buf((LWCOLLECTION*)subgeom, 0, ptr, precision, prefix);
653  }
654  ptr += sprintf(ptr, "</%sgeometryMember>", prefix);
655  }
656 
657  /* Close outmost tag */
658  ptr += sprintf(ptr, "</%sMultiGeometry>", prefix);
659 
660  return (ptr-output);
661 }
static uint8_t precision
Definition: cu_in_twkb.c:25
#define COLLECTIONTYPE
Definition: liblwgeom.h:122
#define LINETYPE
Definition: liblwgeom.h:117
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:116
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
Definition: lwgeom.c:1080
#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_multi_buf(const LWCOLLECTION *col, const char *srs, char *output, int precision, const char *prefix)
Definition: lwout_gml.c:492
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
static size_t asgml2_collection_buf(const LWCOLLECTION *col, const char *srs, char *output, int precision, const char *prefix)
Definition: lwout_gml.c:611
uint32_t ngeoms
Definition: liblwgeom.h:594
LWGEOM ** geoms
Definition: liblwgeom.h:589
uint8_t type
Definition: liblwgeom.h:476

References asgml2_line_buf(), asgml2_multi_buf(), asgml2_point_buf(), asgml2_poly_buf(), COLLECTIONTYPE, LWCOLLECTION::geoms, LINETYPE, lwgeom_is_collection(), LWCOLLECTION::ngeoms, POINTTYPE, POLYGONTYPE, precision, and LWGEOM::type.

Referenced by asgml2_collection().

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