File tree Expand file tree Collapse file tree 3 files changed +59
-4
lines changed Expand file tree Collapse file tree 3 files changed +59
-4
lines changed Original file line number Diff line number Diff line change @@ -2331,6 +2331,37 @@ namespace QgsWms
2331
2331
return useOgcGeoreferencing;
2332
2332
}
2333
2333
2334
+ QStringList QgsWmsParameters::pdfExportMapThemes () const
2335
+ {
2336
+ QStringList themes;
2337
+ const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2338
+ if ( options.contains ( PdfFormatOption::EXPORT_THEMES ) )
2339
+ {
2340
+ themes = options[PdfFormatOption::EXPORT_THEMES].split ( " ," );
2341
+ }
2342
+ return themes;
2343
+ }
2344
+
2345
+ QVector<qreal> QgsWmsParameters::pdfPredefinedMapScales () const
2346
+ {
2347
+ QVector<qreal> scales;
2348
+ const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2349
+ if ( options.contains ( PdfFormatOption::PREDEFINED_MAP_SCALES ) )
2350
+ {
2351
+ QStringList scaleList = options[PdfFormatOption::PREDEFINED_MAP_SCALES].split ( " ," );
2352
+ for ( const auto &it : scaleList )
2353
+ {
2354
+ bool ok = false ;
2355
+ qreal scale = it.toDouble ( &ok );
2356
+ if ( ok )
2357
+ {
2358
+ scales.append ( scale );
2359
+ }
2360
+ }
2361
+ }
2362
+ return scales;
2363
+ }
2364
+
2334
2365
QMap<QString, QString> QgsWmsParameters::dimensionValues () const
2335
2366
{
2336
2367
QMap<QString, QString> dimValues;
Original file line number Diff line number Diff line change @@ -1440,6 +1440,18 @@ namespace QgsWms
1440
1440
*/
1441
1441
bool pdfUseOgcBestPracticeFormatGeoreferencing () const ;
1442
1442
1443
+ /* *
1444
+ * Returns map themes for GeoPDF export
1445
+ * \since QGIS 3.32
1446
+ */
1447
+ QStringList pdfExportMapThemes () const ;
1448
+
1449
+ /* *
1450
+ * Returns list of map scales
1451
+ * \since QGIS 3.32
1452
+ */
1453
+ QVector<qreal> pdfPredefinedMapScales () const ;
1454
+
1443
1455
QString version () const override ;
1444
1456
1445
1457
QString request () const override ;
Original file line number Diff line number Diff line change @@ -630,10 +630,22 @@ namespace QgsWms
630
630
exportSettings.flags |= QgsLayoutRenderContext::FlagDrawSelection;
631
631
// Print as raster
632
632
exportSettings.rasterizeWholeImage = layout->customProperty ( QStringLiteral ( " rasterize" ), false ).toBool ();
633
- // Set scales
634
- exportSettings.predefinedMapScales = QgsLayoutUtils::predefinedScales ( layout.get ( ) );
635
-
636
- // Settings from format options request parameters
633
+ // Set scales. 1. Prio: request, 2. Prio: predefined mapscales in layout
634
+ QVector<qreal> requestMapScales = mWmsParameters .pdfPredefinedMapScales ();
635
+ if ( requestMapScales.size () > 0 )
636
+ {
637
+ exportSettings.predefinedMapScales = requestMapScales;
638
+ }
639
+ else
640
+ {
641
+ exportSettings.predefinedMapScales = QgsLayoutUtils::predefinedScales ( layout.get ( ) );
642
+ }
643
+ // Export themes
644
+ QStringList exportThemes = mWmsParameters .pdfExportMapThemes ();
645
+ if ( exportThemes.size () > 0 )
646
+ {
647
+ exportSettings.exportThemes = exportThemes;
648
+ }
637
649
exportSettings.writeGeoPdf = mWmsParameters .writeGeoPdf ();
638
650
exportSettings.textRenderFormat = mWmsParameters .pdfTextRenderFormat ();
639
651
exportSettings.forceVectorOutput = mWmsParameters .pdfForceVectorOutput ();
You can’t perform that action at this time.
0 commit comments