33 return QStringLiteral(
"MultiCurve" );
38 auto result = qgis::make_unique< QgsMultiCurve >();
40 return result.release();
63 QStringLiteral(
"LineString" ) );
69 QDomElement elemMultiLineString = doc.createElementNS( ns, QStringLiteral(
"MultiLineString" ) );
72 return elemMultiLineString;
76 if ( qgsgeometry_cast<const QgsCurve *>( geom ) )
78 std::unique_ptr< QgsLineString > lineString( static_cast<const QgsCurve *>( geom )->curveToLine() );
80 QDomElement elemLineStringMember = doc.createElementNS( ns, QStringLiteral(
"lineStringMember" ) );
81 elemLineStringMember.appendChild( lineString->asGml2( doc, precision, ns, axisOrder ) );
82 elemMultiLineString.appendChild( elemLineStringMember );
86 return elemMultiLineString;
91 QDomElement elemMultiCurve = doc.createElementNS( ns, QStringLiteral(
"MultiCurve" ) );
94 return elemMultiCurve;
98 if ( qgsgeometry_cast<const QgsCurve *>( geom ) )
102 QDomElement elemCurveMember = doc.createElementNS( ns, QStringLiteral(
"curveMember" ) );
103 elemCurveMember.appendChild( curve->
asGml3( doc, precision, ns, axisOrder ) );
104 elemMultiCurve.appendChild( elemCurveMember );
108 return elemMultiCurve;
114 QString json = QStringLiteral(
"{\"type\": \"MultiLineString\", \"coordinates\": [" );
117 if ( qgsgeometry_cast<const QgsCurve *>( geom ) )
119 std::unique_ptr< QgsLineString > lineString( static_cast<const QgsCurve *>( geom )->curveToLine() );
121 lineString->points( pts );
125 if ( json.endsWith( QLatin1String(
", " ) ) )
129 json += QLatin1String(
"] }" );
135 if ( !qgsgeometry_cast<QgsCurve *>( g ) )
159 if ( !g || !qgsgeometry_cast<QgsCurve *>( g ) )
173 if ( qgsgeometry_cast<const QgsCurve *>( geom ) )
178 return reversedMultiCurve;
183 std::unique_ptr< QgsMultiPoint > multiPoint(
new QgsMultiPoint() );
188 if ( !curve->isClosed() )
190 multiPoint->addGeometry(
new QgsPoint( curve->startPoint() ) );
191 multiPoint->addGeometry(
new QgsPoint( curve->endPoint() ) );
195 if ( multiPoint->numGeometries() == 0 )
199 return multiPoint.release();
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.
static QString pointsToJSON(const QgsPointSequence &points, int precision)
Returns a geoJSON coordinates string.
QgsMultiCurve * 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.
bool insertGeometry(QgsAbstractGeometry *g, int index) override
Inserts a geometry before a specified index and takes ownership.
Multi point geometry collection.
virtual bool addMValue(double mValue=0)=0
Adds a measure to the geometry, initialized to a preset value.
QString asJson(int precision=17) const override
Returns a GeoJSON representation of the geometry.
QgsWkbTypes::Type mWkbType
virtual bool insertGeometry(QgsAbstractGeometry *g, int index)
Inserts a geometry before a specified index and takes ownership.
QgsMultiCurve * createEmptyWithSameType() const override
Creates a new geometry with the same class and same WKB type as the original and transfers ownership...
bool isEmpty() const override
Returns true if the geometry is empty.
bool isMeasure() const
Returns true if the geometry contains m values.
QgsMultiCurve * reversed() const
Returns a copy of the multi curve, where each component curve has had its line direction reversed...
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 curved geometry type.
Abstract base class for all geometries.
QgsAbstractGeometry * boundary() const override
Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the...
QString geometryType() const override
Returns a unique string representing the geometry type.
bool fromWkt(const QString &wkt) override
Sets the geometry from a WKT string.
Point geometry type, with support for z-dimension and m-values.
AxisOrder
Axis order for GML generation.
QVector< QgsPoint > QgsPointSequence
QVector< QgsAbstractGeometry * > mGeometries
QgsMultiCurve * clone() const override
Clones the geometry by performing a deep copy.
bool addGeometry(QgsAbstractGeometry *g) override
Adds a geometry and takes ownership. Returns true in case of success.
virtual bool addZValue(double zValue=0)=0
Adds a z-dimension to the geometry, initialized to a preset value.
Line string geometry type, with support for z-dimension and m-values.
void clear() override
Clears the geometry, ie reset it to a null geometry.
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
Compound curve geometry type.
Circular string geometry type.
virtual bool dropMValue()=0
Drops any measure values which exist in the 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.
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.
virtual QDomElement asGml3(QDomDocument &doc, int precision=17, const QString &ns="gml", AxisOrder axisOrder=QgsAbstractGeometry::AxisOrder::XY) const =0
Returns a GML3 representation of the geometry.
bool fromCollectionWkt(const QString &wkt, const QVector< QgsAbstractGeometry * > &subtypes, const QString &defaultChildWkbType=QString())
Reads a collection from a WKT string.