32 return QStringLiteral(
"MultiLineString" );
37 auto result = qgis::make_unique< QgsMultiLineString >();
39 return result.release();
60 QDomElement elemMultiLineString = doc.createElementNS( ns, QStringLiteral(
"MultiLineString" ) );
63 return elemMultiLineString;
67 if (
const QgsLineString *lineString = qgsgeometry_cast<const QgsLineString *>( geom ) )
69 QDomElement elemLineStringMember = doc.createElementNS( ns, QStringLiteral(
"lineStringMember" ) );
70 elemLineStringMember.appendChild( lineString->asGml2( doc, precision, ns, axisOrder ) );
71 elemMultiLineString.appendChild( elemLineStringMember );
75 return elemMultiLineString;
80 QDomElement elemMultiCurve = doc.createElementNS( ns, QStringLiteral(
"MultiCurve" ) );
83 return elemMultiCurve;
87 if (
const QgsLineString *lineString = qgsgeometry_cast<const QgsLineString *>( geom ) )
89 QDomElement elemCurveMember = doc.createElementNS( ns, QStringLiteral(
"curveMember" ) );
90 elemCurveMember.appendChild( lineString->asGml3( doc, precision, ns, axisOrder ) );
91 elemMultiCurve.appendChild( elemCurveMember );
95 return elemMultiCurve;
100 QString json = QStringLiteral(
"{\"type\": \"MultiLineString\", \"coordinates\": [" );
103 if ( qgsgeometry_cast<const QgsCurve *>( geom ) )
107 lineString->
points( pts );
111 if ( json.endsWith( QLatin1String(
", " ) ) )
115 json += QLatin1String(
"] }" );
121 if ( !dynamic_cast<QgsLineString *>( g ) )
bool isMeasure() const
Returns true if the geometry contains m values.
QgsMultiLineString * createEmptyWithSameType() const override
Creates a new geometry with the same class and same WKB type as the original and transfers ownership...
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.
static QString pointsToJSON(const QgsPointSequence &points, int precision)
Returns a geoJSON coordinates string.
void points(QgsPointSequence &pt) const override
Returns a list of points within the curve.
QgsMultiCurve * toCurveType() const override
Returns the geometry converted to the more generic curve type QgsMultiCurve.
bool insertGeometry(QgsAbstractGeometry *g, int index) override
Inserts a geometry before a specified index and takes ownership.
QgsMultiLineString * clone() const override
Clones the geometry by performing a deep copy.
Multi line string geometry collection.
void clear() override
Clears the geometry, ie reset it to a null geometry.
virtual bool addMValue(double mValue=0)=0
Adds a measure to the geometry, initialized to a preset value.
QgsWkbTypes::Type mWkbType
bool isEmpty() const override
Returns true if the geometry is empty.
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.
bool fromWkt(const QString &wkt) override
Sets the geometry from a WKT string.
Abstract base class for all geometries.
QgsWkbTypes::Type wkbType() const
Returns the WKB type of the geometry.
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.
bool addGeometry(QgsAbstractGeometry *g) override
Adds a geometry and takes ownership. Returns true in case of success.
QVector< QgsPoint > QgsPointSequence
QVector< QgsAbstractGeometry *> mGeometries
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.
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.
Line string geometry type, with support for z-dimension and m-values.
bool wktOmitChildType() const override
Returns whether child type names are omitted from Wkt representations of the collection.
void clear() override
Clears the geometry, ie reset it to a null geometry.
QString asJson(int precision=17) const override
Returns a GeoJSON representation of the geometry.
virtual bool dropMValue()=0
Drops any measure values which exist in the geometry.
static Type flatType(Type type)
Returns the flat type for a WKB type.
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
QString geometryType() const override
Returns a unique string representing the geometry type.
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.