26 #include <QJsonObject>    27 #include <nlohmann/json.hpp>    36   return QStringLiteral( 
"MultiSurface" );
    47   auto result = qgis::make_unique< QgsMultiSurface >();
    49   return result.release();
    66                             QStringLiteral( 
"Polygon" ) );
    72   QDomElement elemMultiPolygon = doc.createElementNS( ns, QStringLiteral( 
"MultiPolygon" ) );
    75     return elemMultiPolygon;
    79     if ( qgsgeometry_cast<const QgsSurface *>( geom ) )
    81       std::unique_ptr< QgsPolygon > polygon( static_cast<const QgsSurface *>( geom )->surfaceToPolygon() );
    83       QDomElement elemPolygonMember = doc.createElementNS( ns, QStringLiteral( 
"polygonMember" ) );
    84       elemPolygonMember.appendChild( polygon->asGml2( doc, precision, ns, axisOrder ) );
    85       elemMultiPolygon.appendChild( elemPolygonMember );
    89   return elemMultiPolygon;
    94   QDomElement elemMultiSurface = doc.createElementNS( ns, QStringLiteral( 
"MultiSurface" ) );
    97     return elemMultiSurface;
   101     if ( qgsgeometry_cast<const QgsSurface *>( geom ) )
   103       QDomElement elemSurfaceMember = doc.createElementNS( ns, QStringLiteral( 
"surfaceMember" ) );
   104       elemSurfaceMember.appendChild( geom->asGml3( doc, precision, ns, axisOrder ) );
   105       elemMultiSurface.appendChild( elemSurfaceMember );
   109   return elemMultiSurface;
   115   json polygons( json::array( ) );
   118     if ( qgsgeometry_cast<const QgsSurface *>( geom ) )
   120       json coordinates( json::array( ) );
   121       std::unique_ptr< QgsPolygon >polygon( static_cast<const QgsSurface *>( geom )->surfaceToPolygon() );
   122       std::unique_ptr< QgsLineString > exteriorLineString( polygon->exteriorRing()->curveToLine() );
   124       exteriorLineString->points( exteriorPts );
   127       std::unique_ptr< QgsLineString > interiorLineString;
   128       for ( 
int i = 0, n = polygon->numInteriorRings(); i < n; ++i )
   130         interiorLineString.reset( polygon->interiorRing( i )->curveToLine() );
   132         interiorLineString->points( interiorPts );
   135       polygons.push_back( coordinates );
   140     {  
"type",  
"MultiPolygon" },
   141     {  
"coordinates", polygons }
   147   if ( !qgsgeometry_cast<QgsSurface *>( g ) )
   171   if ( !g || !qgsgeometry_cast< QgsSurface * >( g ) )
   182   std::unique_ptr< QgsMultiCurve > multiCurve( 
new QgsMultiCurve() );
   188       multiCurve->addGeometry( surface->boundary() );
   191   if ( multiCurve->numGeometries() == 0 )
   195   return multiCurve.release();
 bool isMeasure() const
Returns true if the geometry contains m values. 
 
QDomElement 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. 
 
QgsMultiSurface * toCurveType() const override
Returns the geometry converted to the more generic curve type. 
 
void clear() override
Clears the geometry, ie reset it to a null geometry. 
 
QgsMultiSurface * createEmptyWithSameType() const override
Creates a new geometry with the same class and same WKB type as the original and transfers ownership...
 
Curve polygon geometry type. 
 
virtual bool addMValue(double mValue=0)=0
Adds a measure to the geometry, initialized to a preset value. 
 
void clear() override
Clears the geometry, ie reset it to a null geometry. 
 
QDomElement 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. 
 
Multi surface geometry collection. 
 
QgsWkbTypes::Type mWkbType
 
virtual bool insertGeometry(QgsAbstractGeometry *g, int index)
Inserts a geometry before a specified index and takes ownership. 
 
bool isEmpty() const override
Returns true if the geometry is empty. 
 
bool addGeometry(QgsAbstractGeometry *g) override
Adds a geometry and takes ownership. Returns true in case of success. 
 
bool insertGeometry(QgsAbstractGeometry *g, int index) override
Inserts a geometry before a specified index and takes ownership. 
 
void setZMTypeFromSubGeometry(const QgsAbstractGeometry *subggeom, QgsWkbTypes::Type baseGeomType)
Updates the geometry type based on whether sub geometries contain z or m values. 
 
Multi curve geometry collection. 
 
Abstract base class for all geometries. 
 
bool fromCollectionWkt(const QString &wkt, const QVector< QgsAbstractGeometry *> &subtypes, const QString &defaultChildWkbType=QString())
Reads a collection from a WKT string. 
 
AxisOrder
Axis order for GML generation. 
 
static json pointsToJson(const QgsPointSequence &points, int precision)
Returns coordinates as json object. 
 
bool fromWkt(const QString &wkt) override
Sets the geometry from a WKT string. 
 
QVector< QgsPoint > QgsPointSequence
 
QVector< QgsAbstractGeometry *> mGeometries
 
json asJsonObject(int precision=17) const override
Returns a json object representation of the geometry. 
 
virtual bool addZValue(double zValue=0)=0
Adds a z-dimension to the geometry, initialized to a preset value. 
 
QString geometryType() const override
Returns a unique string representing the geometry type. 
 
virtual bool dropMValue()=0
Drops any measure values which exist in the geometry. 
 
QgsMultiSurface * clone() const override
Clones the geometry by performing a deep copy. 
 
bool is3D() const
Returns true if the geometry is 3D and contains a z-value. 
 
virtual bool dropZValue()=0
Drops any z-dimensions which exist in the geometry. 
 
virtual bool addGeometry(QgsAbstractGeometry *g)
Adds a geometry and takes ownership. Returns true in case of success. 
 
QgsAbstractGeometry * boundary() const override
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the...