Skip to content

Commit

Permalink
avoid duplication of points in rubberbands of point geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Aug 14, 2013
1 parent 63cf5d3 commit bc58898
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/gui/qgsrubberband.cpp
Expand Up @@ -190,9 +190,9 @@ void QgsRubberBand::removePoint( int index, bool doUpdate/* = true*/, int geomet
}
}

void QgsRubberBand::removeLastPoint( int geometryIndex )
void QgsRubberBand::removeLastPoint( int geometryIndex, bool doUpdate/* = true*/ )
{
removePoint( -1, true, geometryIndex );
removePoint( -1, doUpdate, geometryIndex );
}

/*!
Expand Down Expand Up @@ -272,6 +272,7 @@ void QgsRubberBand::addGeometry( QgsGeometry* geom, QgsVectorLayer* layer )
pt = geom->asPoint();
}
addPoint( pt, false, idx );
removeLastPoint( idx , false );
}
break;

Expand All @@ -285,10 +286,12 @@ void QgsRubberBand::addGeometry( QgsGeometry* geom, QgsVectorLayer* layer )
if ( layer )
{
addPoint( mr->layerToMapCoordinates( layer, pt ), false, idx );
removeLastPoint( idx , false );
}
else
{
addPoint( pt, false, idx );
removeLastPoint( idx , false );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsrubberband.h
Expand Up @@ -149,7 +149,7 @@ class GUI_EXPORT QgsRubberBand: public QgsMapCanvasItem
/**
* Removes the last point. Most useful in connection with undo operations
*/
void removeLastPoint( int geometryIndex = 0 );
void removeLastPoint( int geometryIndex = 0 , bool doUpdate = true );

/**
* Moves the rubber band point specified by index. Note that if the rubber band is
Expand Down

0 comments on commit bc58898

Please sign in to comment.