47 if ( dynamic_cast<const QgsPolygonV2*>( geom ) )
55 return elemMultiPolygon;
63 if ( dynamic_cast<const QgsPolygonV2*>( geom ) )
71 return elemMultiSurface;
77 QString json =
"{\"type\": \"MultiPolygon\", \"coordinates\": [";
80 if ( dynamic_cast<const QgsPolygonV2*>( geom ) )
88 exteriorLineString->
points( exteriorPts );
90 delete exteriorLineString;
96 interiorLineString->
points( interiorPts );
98 delete interiorLineString;
118 if ( !dynamic_cast<QgsPolygonV2*>( g ) )
147 if (
QgsLineStringV2* lineStringBoundary = dynamic_cast< QgsLineStringV2* >( polygonBoundary ) )
151 else if (
QgsMultiLineStringV2* multiLineStringBoundary = dynamic_cast< QgsMultiLineStringV2* >( polygonBoundary ) )
153 for (
int j = 0; j < multiLineStringBoundary->numGeometries(); ++j )
155 multiLine->
addGeometry( multiLineStringBoundary->geometryN( j )->clone() );
157 delete multiLineStringBoundary;
161 delete polygonBoundary;
const QgsCurveV2 * exteriorRing() const
int numGeometries() const
Returns the number of geometries within the collection.
const QgsCurveV2 * interiorRing(int i) const
QString asJSON(int precision=17) const override
Returns a GeoJSON representation of the geometry.
QDomNode appendChild(const QDomNode &newChild)
void points(QgsPointSequenceV2 &pt) const override
Returns a list of points within the curve.
virtual bool addGeometry(QgsAbstractGeometryV2 *g) override
Adds a geometry and takes ownership.
bool fromWkt(const QString &wkt) override
Sets the geometry from a WKT string.
static QString pointsToJSON(const QgsPointSequenceV2 &points, int precision)
Returns a geoJSON coordinates string.
Abstract base class for all geometries.
QDomElement asGML2(QDomDocument &doc, int precision=17, const QString &ns="gml") const override
Returns a GML2 representation of the geometry.
QgsAbstractGeometryV2 * toCurveType() const override
Returns the geometry converted to the more generic curve type QgsMultiSurfaceV2.
QDomElement createElementNS(const QString &nsURI, const QString &qName)
virtual bool addGeometry(QgsAbstractGeometryV2 *g) override
Adds a geometry and takes ownership.
Multi line string geometry collection.
QDomElement asGML3(QDomDocument &doc, int precision=17, const QString &ns="gml") const override
Returns a GML3 representation of the geometry.
virtual QgsAbstractGeometryV2 * boundary() const override
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the...
QgsMultiPolygonV2 * clone() const override
Clones the geometry by performing a deep copy.
Line string geometry type, with support for z-dimension and m-values.
virtual bool addGeometry(QgsAbstractGeometryV2 *g) override
Adds a geometry and takes ownership.
QgsWKBTypes::Type mWkbType
Multi surface geometry collection.
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
void setZMTypeFromSubGeometry(const QgsAbstractGeometryV2 *subggeom, QgsWKBTypes::Type baseGeomType)
Updates the geometry type based on whether sub geometries contain z or m values.
virtual QDomElement asGML3(QDomDocument &doc, int precision=17, const QString &ns="gml") const =0
Returns a GML3 representation of the geometry.
virtual QgsAbstractGeometryV2 * boundary() const =0
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the...
QVector< QgsAbstractGeometryV2 *> mGeometries
const T & at(int i) const
bool fromCollectionWkt(const QString &wkt, const QList< QgsAbstractGeometryV2 *> &subtypes, const QString &defaultChildWkbType=QString())
Reads a collection from a WKT string.
virtual bool addGeometry(QgsAbstractGeometryV2 *g)
Adds a geometry and takes ownership.
virtual QgsLineStringV2 * curveToLine(double tolerance=M_PI_2/90, SegmentationToleranceType toleranceType=MaximumAngle) const =0
Returns a new line string geometry corresponding to a segmentized approximation of the curve...
Multi polygon geometry collection.
virtual QDomElement asGML2(QDomDocument &doc, int precision=17, const QString &ns="gml") const =0
Returns a GML2 representation of the geometry.
int numInteriorRings() const