Skip to content
Permalink
Browse files

[composer] Refresh main map canvas when atlas preview feature changes…

…, allows for easier customisation of maps styled using $atlasfeatureid expressions
  • Loading branch information
nyalldawson committed Jan 1, 2014
1 parent 8a11be8 commit 12eb44e7a00e02002616fd613556047c013c0fbc
Showing with 12 additions and 2 deletions.
  1. +7 −2 src/app/composer/qgscomposer.cpp
  2. +3 −0 src/app/composer/qgscomposer.h
  3. +2 −0 src/app/qgisapp.cpp
@@ -507,6 +507,8 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
mActionExportAtlasAsImage->setEnabled( false );
mActionExportAtlasAsSVG->setEnabled( false );
mActionExportAtlasAsPDF->setEnabled( false );
QgsAtlasComposition* atlasMap = &mComposition->atlasComposition();
connect( atlasMap, SIGNAL( toggled( bool ) ), this, SLOT( toggleAtlasControls( bool ) ) );

// Create size grip (needed by Mac OS X for QMainWindow if QStatusBar is not visible)
//should not be needed now that composer has a status bar?
@@ -857,6 +859,7 @@ void QgsComposer::on_mActionAtlasPreview_triggered( bool checked )
if ( checked )
{
atlasMap->firstFeature();
emit( atlasPreviewFeatureChanged() );
}
else
{
@@ -875,7 +878,7 @@ void QgsComposer::on_mActionAtlasNext_triggered()
}

atlasMap->nextFeature();

emit( atlasPreviewFeatureChanged() );
}

void QgsComposer::on_mActionAtlasPrev_triggered()
@@ -887,7 +890,7 @@ void QgsComposer::on_mActionAtlasPrev_triggered()
}

atlasMap->prevFeature();

emit( atlasPreviewFeatureChanged() );
}

void QgsComposer::on_mActionAtlasFirst_triggered()
@@ -899,6 +902,7 @@ void QgsComposer::on_mActionAtlasFirst_triggered()
}

atlasMap->firstFeature();
emit( atlasPreviewFeatureChanged() );
}

void QgsComposer::on_mActionAtlasLast_triggered()
@@ -910,6 +914,7 @@ void QgsComposer::on_mActionAtlasLast_triggered()
}

atlasMap->lastFeature();
emit( atlasPreviewFeatureChanged() );
}

QgsMapCanvas *QgsComposer::mapCanvas( void )
@@ -123,6 +123,9 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
//!Composer deletes the old composerview when loading a template
void composerWillBeRemoved( QgsComposerView* v );

//! Is emitted when the atlas preview feature changes
void atlasPreviewFeatureChanged();

public slots:
//! Zoom to full extent of the paper
void on_mActionZoomAll_triggered();
@@ -5048,6 +5048,7 @@ QgsComposer* QgisApp::createNewComposer( QString title )
emit composerAdded( newComposerObject->view() );
connect( newComposerObject, SIGNAL( composerAdded( QgsComposerView* ) ), this, SIGNAL( composerAdded( QgsComposerView* ) ) );
connect( newComposerObject, SIGNAL( composerWillBeRemoved( QgsComposerView* ) ), this, SIGNAL( composerWillBeRemoved( QgsComposerView* ) ) );
connect( newComposerObject, SIGNAL( atlasPreviewFeatureChanged() ), this, SLOT( refreshMapCanvas() ) );
markDirty();
return newComposerObject;
}
@@ -5137,6 +5138,7 @@ bool QgisApp::loadComposersFromProject( const QDomDocument& doc )
emit composerAdded( composer->view() );
connect( composer, SIGNAL( composerAdded( QgsComposerView* ) ), this, SIGNAL( composerAdded( QgsComposerView* ) ) );
connect( composer, SIGNAL( composerWillBeRemoved( QgsComposerView* ) ), this, SIGNAL( composerWillBeRemoved( QgsComposerView* ) ) );
connect( composer, SIGNAL( atlasPreviewFeatureChanged() ), this, SLOT( refreshMapCanvas() ) );
}
return true;
}

0 comments on commit 12eb44e

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