Skip to content
Permalink
Browse files
Some further small improvements to QgsRubberband
  • Loading branch information
m-kuhn committed Jul 18, 2013
1 parent ed1e19f commit 00e2b239597b870e70d843731fdca3eac9557f7f
Showing with 6 additions and 9 deletions.
  1. +6 −9 src/gui/qgsrubberband.cpp
@@ -399,20 +399,18 @@ void QgsRubberBand::setToCanvasRectangle( const QRect& rect )
*/
void QgsRubberBand::paint( QPainter* p )
{
QList<QgsPoint> currentList;
if ( mPoints.size() > 0 )
{
p->setBrush( mBrush );
mPen.setWidth( mWidth );
p->setPen( mPen );

for ( int i = 0; i < mPoints.size(); ++i )
Q_FOREACH( const QList<QgsPoint>& line, mPoints )
{
QVector<QPointF> pts;
QList<QgsPoint>::const_iterator it = mPoints.at( i ).constBegin();
for ( ; it != mPoints.at( i ).constEnd(); ++it )
Q_FOREACH( const QgsPoint& pt, line )
{
const QPointF cur = toCanvasCoordinates( QgsPoint( it->x() + mTranslationOffsetX, it->y() + mTranslationOffsetY ) ) - pos();
const QPointF cur = toCanvasCoordinates( QgsPoint( pt.x() + mTranslationOffsetX, pt.y() + mTranslationOffsetY ) ) - pos();
if ( pts.empty() || std::abs( pts.back().x() - cur.x() ) > 1 || std::abs( pts.back().y() - cur.y() ) > 1 )
pts.append( cur );
}
@@ -427,11 +425,10 @@ void QgsRubberBand::paint( QPainter* p )

case QGis::Point:
{
QVector<QPointF>::const_iterator ptIt = pts.constBegin();
for ( ; ptIt != pts.constEnd(); ++ptIt )
Q_FOREACH( const QPointF& pt, pts )
{
double x = ( *ptIt ).x();
double y = ( *ptIt ).y();
double x = pt.x();
double y = pt.y();

qreal s = ( mIconSize - 1 ) / 2;

0 comments on commit 00e2b23

Please sign in to comment.