QgsMultiPolygon class

Multi polygon geometry collection.

Base classes

class QgsMultiSurface
Multi surface geometry collection.

Public functions

auto addGeometry(QgsAbstractGeometry* g) -> bool override
Adds a geometry and takes ownership. Returns true in case of success.
auto asGml2(QDomDocument& doc, int precision = 17, const QString& ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY) const -> QDomElement override
Returns a GML2 representation of the geometry.
auto asGml3(QDomDocument& doc, int precision = 17, const QString& ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY) const -> QDomElement override
Returns a GML3 representation of the geometry.
auto asJson(int precision = 17) const -> QString override
Returns a GeoJSON representation of the geometry.
auto boundary() const -> QgsAbstractGeometry* override
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the geometry).
auto cast(const QgsAbstractGeometry* geom) const -> const QgsMultiPolygon*
Cast the geom to a QgsMultiPolygonV2.
void clear() override
Clears the geometry, ie reset it to a null geometry.
auto clone() const -> QgsMultiPolygon* override
Clones the geometry by performing a deep copy.
auto createEmptyWithSameType() const -> QgsMultiPolygon* override
Creates a new geometry with the same class and same WKB type as the original and transfers ownership.
auto fromWkt(const QString& wkt) -> bool override
Sets the geometry from a WKT string.
auto geometryType() const -> QString override
Returns a unique string representing the geometry type.
auto insertGeometry(QgsAbstractGeometry* g, int index) -> bool override
Inserts a geometry before a specified index and takes ownership.
auto toCurveType() const -> QgsMultiSurface* override
Returns the geometry converted to the more generic curve type QgsMultiSurface.

Protected functions

auto wktOmitChildType() const -> bool override
Returns whether child type names are omitted from Wkt representations of the collection.

Function documentation

QDomElement QgsMultiPolygon::asGml2(QDomDocument& doc, int precision = 17, const QString& ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY) const override

Returns a GML2 representation of the geometry.

Parameters
doc DOM document
precision number of decimal places for coordinates
ns XML namespace
axisOrder Axis order for generated GML

QDomElement QgsMultiPolygon::asGml3(QDomDocument& doc, int precision = 17, const QString& ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY) const override

Returns a GML3 representation of the geometry.

Parameters
doc DOM document
precision number of decimal places for coordinates
ns XML namespace
axisOrder Axis order for generated GML

QString QgsMultiPolygon::asJson(int precision = 17) const override

Returns a GeoJSON representation of the geometry.

Parameters
precision number of decimal places for coordinates

QgsAbstractGeometry* QgsMultiPolygon::boundary() const override

Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the geometry).

Returns boundary for geometry. May be null for some geometry types.

For instance, a polygon geometry will have a boundary consisting of the linestrings for each ring in the polygon.

const QgsMultiPolygon* QgsMultiPolygon::cast(const QgsAbstractGeometry* geom) const

Cast the geom to a QgsMultiPolygonV2.

Should be used by qgsgeometry_cast<QgsMultiPolygon *>( geometry ).

QgsMultiPolygon* QgsMultiPolygon::createEmptyWithSameType() const override

Creates a new geometry with the same class and same WKB type as the original and transfers ownership.

To create it, the geometry is default constructed and then the WKB is changed.

bool QgsMultiPolygon::fromWkt(const QString& wkt) override

Sets the geometry from a WKT string.

QString QgsMultiPolygon::geometryType() const override

Returns a unique string representing the geometry type.

bool QgsMultiPolygon::insertGeometry(QgsAbstractGeometry* g, int index) override

Inserts a geometry before a specified index and takes ownership.

Parameters
g geometry to insert. Ownership is transferred to the collection.
index position to insert geometry before

Returns true in case of success.

QgsMultiSurface* QgsMultiPolygon::toCurveType() const override

Returns the geometry converted to the more generic curve type QgsMultiSurface.

Returns the converted geometry. Caller takes ownership

bool QgsMultiPolygon::wktOmitChildType() const override protected

Returns whether child type names are omitted from Wkt representations of the collection.