Skip to content
Permalink
Browse files

[quick] do not refresh map on click

Whenever user would click on the map (e.g. to identify a feature),
the freeze and subsequent unfreeze would force map refresh even though
it is not needed. A new internal flag is introduced to avoid
the unnecessary map refresh in cases when map has not been moved nor zoomed.
  • Loading branch information
wonder-sk committed Feb 21, 2019
1 parent 0a0d2e9 commit 057b225daec3a9a3990fcdfded8f9ef256b34d6b
Showing with 9 additions and 1 deletion.
  1. +8 −1 src/quickgui/qgsquickmapcanvasmap.cpp
  2. +1 −0 src/quickgui/qgsquickmapcanvasmap.h
@@ -67,6 +67,7 @@ void QgsQuickMapCanvasMap::zoom( QPointF center, qreal scale )
// same as zoomWithCenter (no coordinate transformations are needed)
extent.scale( scale, &newCenter );
mMapSettings->setExtent( extent );
mNeedsRefresh = true;
}

void QgsQuickMapCanvasMap::pan( QPointF oldPos, QPointF newPos )
@@ -86,6 +87,7 @@ void QgsQuickMapCanvasMap::pan( QPointF oldPos, QPointF newPos )
extent.setYMinimum( extent.yMinimum() + dy );

mMapSettings->setExtent( extent );
mNeedsRefresh = true;
}

void QgsQuickMapCanvasMap::refreshMap()
@@ -257,8 +259,13 @@ void QgsQuickMapCanvasMap::setFreeze( bool freeze )

mFreeze = freeze;

if ( !mFreeze )
if ( !mFreeze && mNeedsRefresh )
{
refresh();
}

// we are freezing or unfreezing - either way we can reset "needs refresh"
mNeedsRefresh = false;

emit freezeChanged();
}
@@ -196,6 +196,7 @@ class QUICK_EXPORT QgsQuickMapCanvasMap : public QQuickItem
QTimer mRefreshTimer;
bool mDirty = false;
bool mFreeze = false;
bool mNeedsRefresh = false; //!< Whether refresh is needed after unfreezing
QList<QMetaObject::Connection> mLayerConnections;
QTimer mMapUpdateTimer;
bool mIncrementalRendering = false;

0 comments on commit 057b225

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