PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ asgml3_collection()

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

Definition at line 798 of file lwout_gml.c.

799{
800 uint32_t i;
801 LWGEOM *subgeom;
802
803 /* Subgeoms don't get an SRS */
804 GML_Options subopts = *opts;
805 subopts.srs = 0;
806
807 /* Open outmost tag */
808 stringbuffer_aprintf(sb, "<%sMultiGeometry", opts->prefix);
809 if (opts->srs) stringbuffer_aprintf(sb, " srsName=\"%s\"", opts->srs);
810 if (opts->id) stringbuffer_aprintf(sb, " %sid=\"%s\"", opts->prefix, opts->id);
811
812 if (!col->ngeoms)
813 {
814 stringbuffer_append(sb, "/>");
815 return;
816 }
817 stringbuffer_append(sb, ">");
818
819 for (i=0; i<col->ngeoms; i++)
820 {
821 subgeom = col->geoms[i];
822 stringbuffer_aprintf(sb, "<%sgeometryMember>", opts->prefix);
823
824 switch (subgeom->type)
825 {
826 case POINTTYPE:
827 asgml3_point(sb, (LWPOINT*)subgeom, &subopts);
828 break;
829 case LINETYPE:
830 asgml3_line(sb, (LWLINE*)subgeom, &subopts);
831 break;
832 case POLYGONTYPE:
833 asgml3_poly(sb, (LWPOLY*)subgeom, &subopts);
834 break;
835 case MULTIPOINTTYPE:
836 case MULTILINETYPE:
837 case MULTIPOLYGONTYPE:
838 asgml3_multi(sb, (LWCOLLECTION*)subgeom, &subopts);
839 break;
840 case COLLECTIONTYPE:
841 asgml3_collection(sb, (LWCOLLECTION*)subgeom, &subopts);
842 break;
843 default:
844 lwerror("asgml3_collection: unknown geometry type");
845 }
846 stringbuffer_aprintf(sb, "</%sgeometryMember>", opts->prefix);
847 }
848
849 /* Close outmost tag */
850 stringbuffer_aprintf(sb, "</%sMultiGeometry>", opts->prefix);
851}
#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
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static void asgml3_multi(stringbuffer_t *sb, const LWCOLLECTION *col, const GML_Options *opts)
Definition lwout_gml.c:682
static void asgml3_poly(stringbuffer_t *sb, const LWPOLY *poly, const GML_Options *opts)
Definition lwout_gml.c:456
static void asgml3_collection(stringbuffer_t *sb, const LWCOLLECTION *col, const GML_Options *opts)
Definition lwout_gml.c:798
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
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.
static void stringbuffer_append(stringbuffer_t *s, const char *a)
Append the specified string to the stringbuffer_t.
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 asgml3_collection(), asgml3_line(), asgml3_multi(), asgml3_point(), asgml3_poly(), COLLECTIONTYPE, LWCOLLECTION::geoms, LINETYPE, lwerror(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, LWCOLLECTION::ngeoms, POINTTYPE, POLYGONTYPE, GML_Options::srs, stringbuffer_append(), stringbuffer_aprintf(), and LWGEOM::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: