mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-12 00:02:25 -04:00
- added possibility not to update rubberband when adding point
- improved performance of GRASS digitizing - canvas is updated only once instead of [number of points]-times git-svn-id: http://svn.osgeo.org/qgis/trunk@5878 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
e642476c1c
commit
10f9dbc460
@ -65,12 +65,15 @@ void QgsRubberBand::reset(bool isPolygon)
|
||||
/*!
|
||||
Add a point to the shape being created.
|
||||
*/
|
||||
void QgsRubberBand::addPoint(const QgsPoint & p)
|
||||
void QgsRubberBand::addPoint(const QgsPoint & p, bool update /* = true */)
|
||||
{
|
||||
mPoints[mPoints.size()-1] = p; // Current mouse position becomes added point
|
||||
mPoints.push_back(p); // Allocate new point to continue tracking current mouse position
|
||||
updateRect();
|
||||
updateCanvas();
|
||||
if (update)
|
||||
{
|
||||
updateRect();
|
||||
updateCanvas();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -132,4 +135,5 @@ void QgsRubberBand::updateRect()
|
||||
}
|
||||
|
||||
setVisible(mPoints.size() > 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,11 @@ class QgsRubberBand: public QgsMapCanvasItem
|
||||
void setWidth(int width);
|
||||
|
||||
void reset(bool isPolygon = false);
|
||||
void addPoint(const QgsPoint & p);
|
||||
|
||||
//! Add point to rubberband and update canvas
|
||||
//! If adding more points consider using update=false for better performance
|
||||
void addPoint(const QgsPoint & p, bool update = true);
|
||||
|
||||
void movePoint(const QgsPoint & p);
|
||||
void movePoint(int index, const QgsPoint& p);
|
||||
|
||||
|
@ -1692,8 +1692,12 @@ void QgsGrassEdit::displayDynamic ( struct line_pnts *Points, double x, double y
|
||||
point.setX(Points->x[i]);
|
||||
point.setY(Points->y[i]);
|
||||
point = transformLayerToMap ( point );
|
||||
mRubberBandLine->addPoint(point);
|
||||
mRubberBandLine->addPoint(point, false); // false = don't update now
|
||||
}
|
||||
// Now add the last point again and force update of rubberband.
|
||||
// This should improve the performance as canvas is updated only once
|
||||
// and not with every added point to rubberband.
|
||||
mRubberBandLine->addPoint(point, true);
|
||||
}
|
||||
|
||||
mRubberBandIcon->setIconType(type);
|
||||
|
Loading…
x
Reference in New Issue
Block a user