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

◆ asgml2_multi_buf()

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

Definition at line 470 of file lwout_gml.c.

472{
473 int type = col->type;
474 char *ptr, *gmltype;
475 uint32_t i;
476 LWGEOM *subgeom;
477
478 ptr = output;
479 gmltype="";
480
481 if (type == MULTIPOINTTYPE) gmltype = "MultiPoint";
482 else if (type == MULTILINETYPE) gmltype = "MultiLineString";
483 else if (type == MULTIPOLYGONTYPE) gmltype = "MultiPolygon";
484
485 /* Open outmost tag */
486 ptr += sprintf(ptr, "<%s%s", prefix, gmltype);
487 if ( srs ) ptr += sprintf(ptr, " srsName=\"%s\"", srs);
488
489 if (!col->ngeoms)
490 {
491 ptr += sprintf(ptr, "/>");
492 return (ptr-output);
493 }
494 ptr += sprintf(ptr, ">");
495
496 for (i=0; i<col->ngeoms; i++)
497 {
498 subgeom = col->geoms[i];
499 if (subgeom->type == POINTTYPE)
500 {
501 ptr += sprintf(ptr, "<%spointMember>", prefix);
502 ptr += asgml2_point_buf((LWPOINT*)subgeom, 0, ptr, precision, prefix);
503 ptr += sprintf(ptr, "</%spointMember>", prefix);
504 }
505 else if (subgeom->type == LINETYPE)
506 {
507 ptr += sprintf(ptr, "<%slineStringMember>", prefix);
508 ptr += asgml2_line_buf((LWLINE*)subgeom, 0, ptr, precision, prefix);
509 ptr += sprintf(ptr, "</%slineStringMember>", prefix);
510 }
511 else if (subgeom->type == POLYGONTYPE)
512 {
513 ptr += sprintf(ptr, "<%spolygonMember>", prefix);
514 ptr += asgml2_poly_buf((LWPOLY*)subgeom, 0, ptr, precision, prefix);
515 ptr += sprintf(ptr, "</%spolygonMember>", prefix);
516 }
517 }
518
519 /* Close outmost tag */
520 ptr += sprintf(ptr, "</%s%s>", prefix, gmltype);
521
522 return (ptr-output);
523}
static uint8_t precision
Definition cu_in_twkb.c:25
#define MULTILINETYPE
Definition liblwgeom.h:120
#define LINETYPE
Definition liblwgeom.h:117
#define MULTIPOINTTYPE
Definition liblwgeom.h:119
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:116
#define MULTIPOLYGONTYPE
Definition liblwgeom.h:121
#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:382
static size_t asgml2_point_buf(const LWPOINT *point, const char *srs, char *output, int precision, const char *prefix)
Definition lwout_gml.c:283
static size_t asgml2_line_buf(const LWLINE *line, const char *srs, char *output, int precision, const char *prefix)
Definition lwout_gml.c:327
uint32_t ngeoms
Definition liblwgeom.h:566
uint8_t type
Definition liblwgeom.h:564
LWGEOM ** geoms
Definition liblwgeom.h:561
uint8_t type
Definition liblwgeom.h:448

References asgml2_line_buf(), asgml2_point_buf(), asgml2_poly_buf(), LWCOLLECTION::geoms, LINETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, LWCOLLECTION::ngeoms, POINTTYPE, POLYGONTYPE, precision, LWGEOM::type, and LWCOLLECTION::type.

Referenced by asgml2_collection_buf(), and asgml2_multi().

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