Skip to content
Permalink
Browse files

Merge pull request #811 from 3nids/fixrubber

fix appearance of point rubber bands at small scales
  • Loading branch information
NathanW2 committed Aug 15, 2013
2 parents 58b7910 + 93a5879 commit 25e79f9f3bb09b02477f0037b884ec2348536a9c
Showing with 10 additions and 5 deletions.
  1. +9 −4 src/gui/qgsrubberband.cpp
  2. +1 −1 src/gui/qgsrubberband.h
@@ -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 );
}

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

@@ -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 );
}
}
}
@@ -499,8 +502,10 @@ void QgsRubberBand::updateRect()
{
return;
}
qreal s = ( mIconSize - 1 ) / 2;
qreal p = mPen.width();

qreal scale = mMapCanvas->mapUnitsPerPixel();
qreal s = ( mIconSize - 1 ) / 2 * scale;
qreal p = mPen.width() * scale;

QgsRectangle r( it->x() + mTranslationOffsetX - s - p, it->y() + mTranslationOffsetY - s - p,
it->x() + mTranslationOffsetX + s + p, it->y() + mTranslationOffsetY + s + p );
@@ -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

0 comments on commit 25e79f9

Please sign in to comment.
You can’t perform that action at this time.