diff --git a/src/core/geometry/qgsmultilinestring.cpp b/src/core/geometry/qgsmultilinestring.cpp index b0bc11aa440..009bbe173be 100644 --- a/src/core/geometry/qgsmultilinestring.cpp +++ b/src/core/geometry/qgsmultilinestring.cpp @@ -116,7 +116,18 @@ bool QgsMultiLineString::addGeometry( QgsAbstractGeometry *g ) return false; } - setZMTypeFromSubGeometry( g, QgsWkbTypes::MultiLineString ); + if ( mGeometries.empty() ) + { + setZMTypeFromSubGeometry( g, QgsWkbTypes::MultiLineString ); + } + if ( is3D() && !g->is3D() ) + g->addZValue(); + else if ( !is3D() && g->is3D() ) + g->dropZValue(); + if ( isMeasure() && !g->isMeasure() ) + g->addMValue(); + else if ( !isMeasure() && g->isMeasure() ) + g->dropMValue(); return QgsGeometryCollection::addGeometry( g ); }