Skip to content

Commit 84e8b10

Browse files
committedJan 28, 2016
fix when 3D and M
1 parent 86e6771 commit 84e8b10

File tree

1 file changed

+29
-16
lines changed

1 file changed

+29
-16
lines changed
 

‎src/core/geometry/qgslinestringv2.cpp

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -454,31 +454,44 @@ void QgsLineStringV2::append( const QgsLineStringV2* line )
454454
{
455455
mX.pop_back();
456456
mY.pop_back();
457-
mZ.pop_back();
458-
mM.pop_back();
457+
458+
if ( is3D() )
459+
{
460+
mZ.pop_back();
461+
}
462+
if ( isMeasure() )
463+
{
464+
mM.pop_back();
465+
}
459466
}
460467

461468
mX += line->mX;
462469
mY += line->mY;
463470

464-
if ( line->is3D() )
465-
{
466-
mZ += line->mZ;
467-
}
468-
else
471+
if ( is3D() )
469472
{
470-
// if append line does not have z coordinates, fill with 0 to match number of points in final line
471-
mZ.insert( mZ.count(), mX.size() - mZ.size(), 0 );
473+
if ( line->is3D() )
474+
{
475+
mZ += line->mZ;
476+
}
477+
else
478+
{
479+
// if append line does not have z coordinates, fill with 0 to match number of points in final line
480+
mZ.insert( mZ.count(), mX.size() - mZ.size(), 0 );
481+
}
472482
}
473483

474-
if ( line->is3D() )
475-
{
476-
mM += line->mM;
477-
}
478-
else
484+
if ( isMeasure() )
479485
{
480-
// if append line does not have m values, fill with 0 to match number of points in final line
481-
mM.insert( mM.count(), mX.size() - mM.size(), 0 );
486+
if ( line->isMeasure() )
487+
{
488+
mM += line->mM;
489+
}
490+
else
491+
{
492+
// if append line does not have m values, fill with 0 to match number of points in final line
493+
mM.insert( mM.count(), mX.size() - mM.size(), 0 );
494+
}
482495
}
483496

484497
mBoundingBox = QgsRectangle(); //set bounding box invalid

0 commit comments

Comments
 (0)
Please sign in to comment.