From 1de7b42588aa530f926cb64f78b12fbe06f39bbf Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 26 Sep 2017 06:30:08 +1000 Subject: [PATCH] Ensure multilinestring dimensionality is respected when adding new lines --- src/core/geometry/qgsmultilinestring.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 ); }