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

◆ asgml3_collection_size()

static size_t asgml3_collection_size ( const LWCOLLECTION col,
const char *  srs,
int  precision,
int  opts,
const char *  prefix,
const char *  id 
)
static

Definition at line 1631 of file lwout_gml.c.

1632{
1633 uint32_t i;
1634 size_t size;
1635 size_t prefixlen = strlen(prefix);
1636 LWGEOM *subgeom;
1637
1638 size = sizeof("<MultiGeometry></MultiGeometry>") + prefixlen*2;
1639
1640 if (srs) size += strlen(srs) + sizeof(" srsName=..");
1641 if (id) size += strlen(id) + strlen(prefix) + sizeof(" id=..");
1642
1643 for (i=0; i<col->ngeoms; i++)
1644 {
1645 subgeom = col->geoms[i];
1646 size += ( sizeof("<geometryMember>/") + prefixlen ) * 2;
1647 if ( subgeom->type == POINTTYPE )
1648 {
1649 size += asgml3_point_size((LWPOINT*)subgeom, 0, precision, opts, prefix, id);
1650 }
1651 else if ( subgeom->type == LINETYPE )
1652 {
1653 size += asgml3_line_size((LWLINE*)subgeom, 0, precision, opts, prefix, id);
1654 }
1655 else if ( subgeom->type == POLYGONTYPE )
1656 {
1657 size += asgml3_poly_size((LWPOLY*)subgeom, 0, precision, opts, prefix, id);
1658 }
1659 else if ( lwgeom_is_collection(subgeom) )
1660 {
1661 size += asgml3_multi_size((LWCOLLECTION*)subgeom, 0, precision, opts, prefix, id);
1662 }
1663 else
1664 lwerror("asgml3_collection_size: unknown geometry type");
1665 }
1666
1667 return size;
1668}
static uint8_t precision
Definition cu_in_twkb.c:25
#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:1079
#define POLYGONTYPE
Definition liblwgeom.h:118
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition lwutil.c:190
static size_t asgml3_poly_size(const LWPOLY *poly, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition lwout_gml.c:994
static size_t asgml3_point_size(const LWPOINT *point, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition lwout_gml.c:774
static size_t asgml3_line_size(const LWLINE *line, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition lwout_gml.c:827
static size_t asgml3_multi_size(const LWCOLLECTION *col, const char *srs, int precision, int opts, const char *prefix, const char *id)
Definition lwout_gml.c:1390
uint32_t ngeoms
Definition liblwgeom.h:566
LWGEOM ** geoms
Definition liblwgeom.h:561
uint8_t type
Definition liblwgeom.h:448

References asgml3_line_size(), asgml3_multi_size(), asgml3_point_size(), asgml3_poly_size(), LWCOLLECTION::geoms, LINETYPE, lwerror(), lwgeom_is_collection(), LWCOLLECTION::ngeoms, POINTTYPE, POLYGONTYPE, precision, and LWGEOM::type.

Referenced by asgml3_collection().

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