@@ -1336,15 +1336,11 @@ void QgsComposer::exportCompositionAsPDF( QgsComposer::OutputMode mode )
1336
1336
1337
1337
QPainter painter;
1338
1338
1339
- try
1340
- {
1341
- loadAtlasPredefinedScalesFromProject ();
1342
- atlasMap->beginRender ();
1343
- }
1344
- catch ( std::exception & e )
1339
+ loadAtlasPredefinedScalesFromProject ();
1340
+ if ( ! atlasMap->beginRender () && !atlasMap->featureFilterErrorString ().isEmpty () )
1345
1341
{
1346
1342
QMessageBox::warning ( this , tr ( " Atlas processing error" ),
1347
- e. what ( ),
1343
+ tr ( " Feature filter parser error: %1 " ). arg ( atlasMap-> featureFilterErrorString () ),
1348
1344
QMessageBox::Ok,
1349
1345
QMessageBox::Ok );
1350
1346
mView ->setPaintingEnabled ( true );
@@ -1371,14 +1367,10 @@ void QgsComposer::exportCompositionAsPDF( QgsComposer::OutputMode mode )
1371
1367
atlasMap->endRender ();
1372
1368
break ;
1373
1369
}
1374
- try
1375
- {
1376
- atlasMap->prepareForFeature ( featureI );
1377
- }
1378
- catch ( std::runtime_error& e )
1370
+ if ( !atlasMap->prepareForFeature ( featureI ) )
1379
1371
{
1380
1372
QMessageBox::warning ( this , tr ( " Atlas processing error" ),
1381
- e. what ( ),
1373
+ tr ( " Atlas processing error " ),
1382
1374
QMessageBox::Ok,
1383
1375
QMessageBox::Ok );
1384
1376
mView ->setPaintingEnabled ( true );
@@ -1491,15 +1483,12 @@ void QgsComposer::printComposition( QgsComposer::OutputMode mode )
1491
1483
1492
1484
mComposition ->beginPrint ( mPrinter );
1493
1485
QPainter painter ( &mPrinter );
1494
- try
1495
- {
1496
- loadAtlasPredefinedScalesFromProject ();
1497
- atlasMap->beginRender ();
1498
- }
1499
- catch ( std::exception & e )
1486
+
1487
+ loadAtlasPredefinedScalesFromProject ();
1488
+ if ( ! atlasMap->beginRender () && !atlasMap->featureFilterErrorString ().isEmpty () )
1500
1489
{
1501
1490
QMessageBox::warning ( this , tr ( " Atlas processing error" ),
1502
- e. what ( ),
1491
+ tr ( " Feature filter parser error: %1 " ). arg ( atlasMap-> featureFilterErrorString () ),
1503
1492
QMessageBox::Ok,
1504
1493
QMessageBox::Ok );
1505
1494
mView ->setPaintingEnabled ( true );
@@ -1518,21 +1507,16 @@ void QgsComposer::printComposition( QgsComposer::OutputMode mode )
1518
1507
atlasMap->endRender ();
1519
1508
break ;
1520
1509
}
1521
- try
1522
- {
1523
- atlasMap->prepareForFeature ( i );
1524
- }
1525
- catch ( std::runtime_error& e )
1510
+ if ( !atlasMap->prepareForFeature ( i ) )
1526
1511
{
1527
1512
QMessageBox::warning ( this , tr ( " Atlas processing error" ),
1528
- e. what ( ),
1513
+ tr ( " Atlas processing error " ),
1529
1514
QMessageBox::Ok,
1530
1515
QMessageBox::Ok );
1531
1516
mView ->setPaintingEnabled ( true );
1532
1517
return ;
1533
1518
}
1534
1519
1535
-
1536
1520
if ( i > 0 )
1537
1521
{
1538
1522
mPrinter .newPage ();
@@ -1753,15 +1737,11 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode )
1753
1737
mView ->setPaintingEnabled ( false );
1754
1738
QApplication::setOverrideCursor ( Qt::BusyCursor );
1755
1739
1756
- try
1757
- {
1758
- loadAtlasPredefinedScalesFromProject ();
1759
- atlasMap->beginRender ();
1760
- }
1761
- catch ( std::exception & e )
1740
+ loadAtlasPredefinedScalesFromProject ();
1741
+ if ( ! atlasMap->beginRender () && !atlasMap->featureFilterErrorString ().isEmpty () )
1762
1742
{
1763
1743
QMessageBox::warning ( this , tr ( " Atlas processing error" ),
1764
- e. what ( ),
1744
+ tr ( " Feature filter parser error: %1 " ). arg ( atlasMap-> featureFilterErrorString () ),
1765
1745
QMessageBox::Ok,
1766
1746
QMessageBox::Ok );
1767
1747
mView ->setPaintingEnabled ( true );
@@ -1781,14 +1761,10 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode )
1781
1761
atlasMap->endRender ();
1782
1762
break ;
1783
1763
}
1784
- try
1785
- {
1786
- atlasMap->prepareForFeature ( feature );
1787
- }
1788
- catch ( std::runtime_error& e )
1764
+ if ( ! atlasMap->prepareForFeature ( feature ) )
1789
1765
{
1790
1766
QMessageBox::warning ( this , tr ( " Atlas processing error" ),
1791
- e. what ( ),
1767
+ tr ( " Atlas processing error " ),
1792
1768
QMessageBox::Ok,
1793
1769
QMessageBox::Ok );
1794
1770
mView ->setPaintingEnabled ( true );
@@ -2021,15 +1997,11 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
2021
1997
int featureI = 0 ;
2022
1998
if ( mode == QgsComposer::Atlas )
2023
1999
{
2024
- try
2025
- {
2026
- loadAtlasPredefinedScalesFromProject ();
2027
- atlasMap->beginRender ();
2028
- }
2029
- catch ( std::exception & e )
2000
+ loadAtlasPredefinedScalesFromProject ();
2001
+ if ( ! atlasMap->beginRender () && !atlasMap->featureFilterErrorString ().isEmpty () )
2030
2002
{
2031
2003
QMessageBox::warning ( this , tr ( " Atlas processing error" ),
2032
- e. what ( ),
2004
+ tr ( " Feature filter parser error: %1 " ). arg ( atlasMap-> featureFilterErrorString () ),
2033
2005
QMessageBox::Ok,
2034
2006
QMessageBox::Ok );
2035
2007
mView ->setPaintingEnabled ( true );
@@ -2053,14 +2025,10 @@ void QgsComposer::exportCompositionAsSVG( QgsComposer::OutputMode mode )
2053
2025
atlasMap->endRender ();
2054
2026
break ;
2055
2027
}
2056
- try
2057
- {
2058
- atlasMap->prepareForFeature ( featureI );
2059
- }
2060
- catch ( std::runtime_error& e )
2028
+ if ( !atlasMap->prepareForFeature ( featureI ) )
2061
2029
{
2062
2030
QMessageBox::warning ( this , tr ( " Atlas processing error" ),
2063
- e. what ( ),
2031
+ tr ( " Atlas processing error " ),
2064
2032
QMessageBox::Ok,
2065
2033
QMessageBox::Ok );
2066
2034
mView ->setPaintingEnabled ( true );
0 commit comments