Skip to content

Commit bc58898

Browse files
committed
avoid duplication of points in rubberbands of point geometry
1 parent 63cf5d3 commit bc58898

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/gui/qgsrubberband.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ void QgsRubberBand::removePoint( int index, bool doUpdate/* = true*/, int geomet
190190
}
191191
}
192192

193-
void QgsRubberBand::removeLastPoint( int geometryIndex )
193+
void QgsRubberBand::removeLastPoint( int geometryIndex, bool doUpdate/* = true*/ )
194194
{
195-
removePoint( -1, true, geometryIndex );
195+
removePoint( -1, doUpdate, geometryIndex );
196196
}
197197

198198
/*!
@@ -272,6 +272,7 @@ void QgsRubberBand::addGeometry( QgsGeometry* geom, QgsVectorLayer* layer )
272272
pt = geom->asPoint();
273273
}
274274
addPoint( pt, false, idx );
275+
removeLastPoint( idx , false );
275276
}
276277
break;
277278

@@ -285,10 +286,12 @@ void QgsRubberBand::addGeometry( QgsGeometry* geom, QgsVectorLayer* layer )
285286
if ( layer )
286287
{
287288
addPoint( mr->layerToMapCoordinates( layer, pt ), false, idx );
289+
removeLastPoint( idx , false );
288290
}
289291
else
290292
{
291293
addPoint( pt, false, idx );
294+
removeLastPoint( idx , false );
292295
}
293296
}
294297
}

src/gui/qgsrubberband.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class GUI_EXPORT QgsRubberBand: public QgsMapCanvasItem
149149
/**
150150
* Removes the last point. Most useful in connection with undo operations
151151
*/
152-
void removeLastPoint( int geometryIndex = 0 );
152+
void removeLastPoint( int geometryIndex = 0 , bool doUpdate = true );
153153

154154
/**
155155
* Moves the rubber band point specified by index. Note that if the rubber band is

0 commit comments

Comments
 (0)