Skip to content
Permalink
Browse files

Ensure main canvas is refreshed when atlas preview feature changes

  • Loading branch information
nyalldawson committed Jan 1, 2018
1 parent 3332118 commit 2281dc0dcb3db49849eacc9cb658149c5ef7b5a1
Showing with 7 additions and 33 deletions.
  1. +6 −30 src/app/layout/qgslayoutdesignerdialog.cpp
  2. +0 −3 src/app/qgisapp.cpp
  3. +1 −0 src/gui/qgsmapcanvas.cpp
@@ -1938,9 +1938,6 @@ void QgsLayoutDesignerDialog::atlasPreviewTriggered( bool checked )
{
QgisApp::instance()->mapCanvas()->stopRendering();
atlas->first();
#if 0 //TODO
emit atlasPreviewFeatureChanged();
#endif
}
}
else
@@ -1981,9 +1978,6 @@ void QgsLayoutDesignerDialog::atlasPageComboEditingFinished()
QgisApp::instance()->mapCanvas()->stopRendering();
loadAtlasPredefinedScalesFromProject();
atlas->seekTo( page - 1 );
#if 0 //TODO
emit atlasPreviewFeatureChanged();
#endif
}
}

@@ -1996,12 +1990,7 @@ void QgsLayoutDesignerDialog::atlasNext()
QgisApp::instance()->mapCanvas()->stopRendering();

loadAtlasPredefinedScalesFromProject();
if ( printAtlas->next() )
{
#if 0 //TODO
emit atlasPreviewFeatureChanged();
#endif
}
printAtlas->next();
}

void QgsLayoutDesignerDialog::atlasPrevious()
@@ -2013,12 +2002,7 @@ void QgsLayoutDesignerDialog::atlasPrevious()
QgisApp::instance()->mapCanvas()->stopRendering();

loadAtlasPredefinedScalesFromProject();
if ( printAtlas->previous() )
{
#if 0 //TODO
emit atlasPreviewFeatureChanged();
#endif
}
printAtlas->previous();
}

void QgsLayoutDesignerDialog::atlasFirst()
@@ -2030,12 +2014,7 @@ void QgsLayoutDesignerDialog::atlasFirst()
QgisApp::instance()->mapCanvas()->stopRendering();

loadAtlasPredefinedScalesFromProject();
if ( printAtlas->first() )
{
#if 0 //TODO
emit atlasPreviewFeatureChanged();
#endif
}
printAtlas->first();
}

void QgsLayoutDesignerDialog::atlasLast()
@@ -2047,12 +2026,7 @@ void QgsLayoutDesignerDialog::atlasLast()
QgisApp::instance()->mapCanvas()->stopRendering();

loadAtlasPredefinedScalesFromProject();
if ( printAtlas->last() )
{
#if 0 //TODO
emit atlasPreviewFeatureChanged();
#endif
}
printAtlas->last();
}

void QgsLayoutDesignerDialog::printAtlas()
@@ -3478,6 +3452,8 @@ void QgsLayoutDesignerDialog::atlasFeatureChanged( const QgsFeature &feature )
mapCanvas->expressionContextScope().addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_feature" ), QVariant::fromValue( feature ), true ) );
mapCanvas->expressionContextScope().addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_featureid" ), feature.id(), true ) );
mapCanvas->expressionContextScope().addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "atlas_geometry" ), QVariant::fromValue( feature.geometry() ), true ) );
mapCanvas->stopRendering();
mapCanvas->refreshAllLayers();
}

void QgsLayoutDesignerDialog::loadAtlasPredefinedScalesFromProject()
@@ -7487,9 +7487,6 @@ QgsLayoutDesignerDialog *QgisApp::openLayoutDesignerDialog( QgsMasterLayoutInter

newDesigner->open();
emit layoutDesignerOpened( newDesigner->iface() );
#if 0 //TODO
connect( newDesigner, &QgsLayoutDesignerDialog::atlasPreviewFeatureChanged, this, &QgisApp::refreshMapCanvas );
#endif

return newDesigner;
}
@@ -696,6 +696,7 @@ void QgsMapCanvas::stopRendering()
mJob->cancelWithoutBlocking();
mJob = nullptr;
}
stopPreviewJobs();
}

//the format defaults to "PNG" if not specified

0 comments on commit 2281dc0

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