mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
[composer] Don't redraw map if layers change and map is set to cached
Previously map was being redrawn every time a layer was added or removed from the registry, which blocked the ui until the map redraw is complete. Now the map will only be redrawn as a result of layer changes if it's set to Render mode. Possible fix for 12234 and 12125. (refs #12234, #12125)
This commit is contained in:
parent
012ee0b414
commit
837c7ee8d3
@ -757,9 +757,12 @@ class QgsComposerMap : QgsComposerItem
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
/**Called if map canvas has changed*/
|
/**Forces an update of the cached map image*/
|
||||||
void updateCachedImage();
|
void updateCachedImage();
|
||||||
/**Call updateCachedImage if item is in render mode*/
|
|
||||||
|
/**Updates the cached map image if the map is set to Render mode
|
||||||
|
* @see updateCachedImage
|
||||||
|
*/
|
||||||
void renderModeUpdateCachedImage();
|
void renderModeUpdateCachedImage();
|
||||||
|
|
||||||
/**Updates the bounding rect of this item. Call this function before doing any changes related to annotation out of the map rectangle */
|
/**Updates the bounding rect of this item. Call this function before doing any changes related to annotation out of the map rectangle */
|
||||||
@ -769,4 +772,13 @@ class QgsComposerMap : QgsComposerItem
|
|||||||
void overviewExtentChanged();
|
void overviewExtentChanged();
|
||||||
|
|
||||||
virtual void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties );
|
virtual void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties );
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
|
||||||
|
/**Called when layers are added or removed from the layer registry. Updates the maps
|
||||||
|
* layer set and redraws the map if required.
|
||||||
|
* @note added in QGIS 2.9
|
||||||
|
*/
|
||||||
|
void layersChanged();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -486,9 +486,8 @@ bool QgsComposerMap::shouldDrawPart( PartType part ) const
|
|||||||
return true; // for Layer
|
return true; // for Layer
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsComposerMap::updateCachedImage( void )
|
void QgsComposerMap::updateCachedImage()
|
||||||
{
|
{
|
||||||
syncLayerSet(); //layer list may have changed
|
|
||||||
mCacheUpdated = false;
|
mCacheUpdated = false;
|
||||||
cache();
|
cache();
|
||||||
QGraphicsRectItem::update();
|
QGraphicsRectItem::update();
|
||||||
@ -502,6 +501,12 @@ void QgsComposerMap::renderModeUpdateCachedImage()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsComposerMap::layersChanged()
|
||||||
|
{
|
||||||
|
syncLayerSet();
|
||||||
|
renderModeUpdateCachedImage();
|
||||||
|
}
|
||||||
|
|
||||||
void QgsComposerMap::setCacheUpdated( bool u )
|
void QgsComposerMap::setCacheUpdated( bool u )
|
||||||
{
|
{
|
||||||
mCacheUpdated = u;
|
mCacheUpdated = u;
|
||||||
@ -1169,8 +1174,8 @@ void QgsComposerMap::connectUpdateSlot()
|
|||||||
QgsMapLayerRegistry* layerRegistry = QgsMapLayerRegistry::instance();
|
QgsMapLayerRegistry* layerRegistry = QgsMapLayerRegistry::instance();
|
||||||
if ( layerRegistry )
|
if ( layerRegistry )
|
||||||
{
|
{
|
||||||
connect( layerRegistry, SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( updateCachedImage() ) );
|
connect( layerRegistry, SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( layersChanged() ) );
|
||||||
connect( layerRegistry, SIGNAL( layerWasAdded( QgsMapLayer* ) ), this, SLOT( updateCachedImage() ) );
|
connect( layerRegistry, SIGNAL( layerWasAdded( QgsMapLayer* ) ), this, SLOT( layersChanged() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -796,9 +796,12 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
/**Called if map canvas has changed*/
|
/**Forces an update of the cached map image*/
|
||||||
void updateCachedImage();
|
void updateCachedImage();
|
||||||
/**Call updateCachedImage if item is in render mode*/
|
|
||||||
|
/**Updates the cached map image if the map is set to Render mode
|
||||||
|
* @see updateCachedImage
|
||||||
|
*/
|
||||||
void renderModeUpdateCachedImage();
|
void renderModeUpdateCachedImage();
|
||||||
|
|
||||||
/**Updates the bounding rect of this item. Call this function before doing any changes related to annotation out of the map rectangle */
|
/**Updates the bounding rect of this item. Call this function before doing any changes related to annotation out of the map rectangle */
|
||||||
@ -809,6 +812,14 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
|
|||||||
|
|
||||||
virtual void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties ) override;
|
virtual void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties ) override;
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
|
||||||
|
/**Called when layers are added or removed from the layer registry. Updates the maps
|
||||||
|
* layer set and redraws the map if required.
|
||||||
|
* @note added in QGIS 2.9
|
||||||
|
*/
|
||||||
|
void layersChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/**Unique identifier*/
|
/**Unique identifier*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user