Skip to content

Commit

Permalink
[Atlas] Add better exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Mercier committed Feb 6, 2013
1 parent 866dce8 commit af8e55a
Showing 1 changed file with 40 additions and 4 deletions.
44 changes: 40 additions & 4 deletions src/app/composer/qgscomposer.cpp
Expand Up @@ -655,7 +655,16 @@ void QgsComposer::on_mActionExportAsPDF_triggered()

QPainter painter;

atlasMap->beginRender();
try {
atlasMap->beginRender();
}
catch ( std::exception& e )
{
QMessageBox::warning( this, tr( "Atlas processing error" ),
e.what(),
QMessageBox::Ok,
QMessageBox::Ok );
}
if ( atlasOnASingleFile )
{
mComposition->beginPrintAsPDF( printer, outputFileName );
Expand Down Expand Up @@ -755,7 +764,16 @@ void QgsComposer::on_mActionPrint_triggered()

mComposition->beginPrint( mPrinter );
QPainter painter( &mPrinter );
atlasMap->beginRender();
try {
atlasMap->beginRender();
}
catch ( std::exception& e )
{
QMessageBox::warning( this, tr( "Atlas processing error" ),
e.what(),
QMessageBox::Ok,
QMessageBox::Ok );
}
QProgressDialog progress( tr( "Rendering maps..." ), tr( "Abort" ), 0, atlasMap->numFeatures(), this );

for ( size_t i = 0; i < atlasMap->numFeatures(); ++i )
Expand Down Expand Up @@ -939,7 +957,16 @@ void QgsComposer::on_mActionExportAsImage_triggered()
mView->setPaintingEnabled( false );
QApplication::setOverrideCursor( Qt::BusyCursor );

atlasMap->beginRender();
try {
atlasMap->beginRender();
}
catch ( std::exception& e )
{
QMessageBox::warning( this, tr( "Atlas processing error" ),
e.what(),
QMessageBox::Ok,
QMessageBox::Ok );
}

QProgressDialog progress( tr( "Rendering maps..." ), tr( "Abort" ), 0, atlasMap->numFeatures(), this );

Expand Down Expand Up @@ -1096,7 +1123,16 @@ void QgsComposer::on_mActionExportAsSVG_triggered()
size_t featureI = 0;
if ( hasAnAtlas )
{
atlasMap->beginRender();
try {
atlasMap->beginRender();
}
catch ( std::exception& e )
{
QMessageBox::warning( this, tr( "Atlas processing error" ),
e.what(),
QMessageBox::Ok,
QMessageBox::Ok );
}
}
QProgressDialog progress( tr( "Rendering maps..." ), tr( "Abort" ), 0, atlasMap->numFeatures(), this );

Expand Down

0 comments on commit af8e55a

Please sign in to comment.