Skip to content

Commit

Permalink
fix when 3D and M
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Jan 28, 2016
1 parent 86e6771 commit 84e8b10
Showing 1 changed file with 29 additions and 16 deletions.
45 changes: 29 additions & 16 deletions src/core/geometry/qgslinestringv2.cpp
Expand Up @@ -454,31 +454,44 @@ void QgsLineStringV2::append( const QgsLineStringV2* line )
{
mX.pop_back();
mY.pop_back();
mZ.pop_back();
mM.pop_back();

if ( is3D() )
{
mZ.pop_back();
}
if ( isMeasure() )
{
mM.pop_back();
}
}

mX += line->mX;
mY += line->mY;

if ( line->is3D() )
{
mZ += line->mZ;
}
else
if ( is3D() )
{
// if append line does not have z coordinates, fill with 0 to match number of points in final line
mZ.insert( mZ.count(), mX.size() - mZ.size(), 0 );
if ( line->is3D() )
{
mZ += line->mZ;
}
else
{
// if append line does not have z coordinates, fill with 0 to match number of points in final line
mZ.insert( mZ.count(), mX.size() - mZ.size(), 0 );
}
}

if ( line->is3D() )
{
mM += line->mM;
}
else
if ( isMeasure() )
{
// if append line does not have m values, fill with 0 to match number of points in final line
mM.insert( mM.count(), mX.size() - mM.size(), 0 );
if ( line->isMeasure() )
{
mM += line->mM;
}
else
{
// if append line does not have m values, fill with 0 to match number of points in final line
mM.insert( mM.count(), mX.size() - mM.size(), 0 );
}
}

mBoundingBox = QgsRectangle(); //set bounding box invalid
Expand Down

0 comments on commit 84e8b10

Please sign in to comment.