diff --git a/python/PyQt6/core/auto_generated/providers/qgsprovidersublayerdetails.sip.in b/python/PyQt6/core/auto_generated/providers/qgsprovidersublayerdetails.sip.in index e64e6542c616..5d377aeb5264 100644 --- a/python/PyQt6/core/auto_generated/providers/qgsprovidersublayerdetails.sip.in +++ b/python/PyQt6/core/auto_generated/providers/qgsprovidersublayerdetails.sip.in @@ -21,7 +21,7 @@ according to a specific data provider. It is possible that multiple data providers may be able to utilize the same underlying sub layer in a single dataset, yet will interpret this layer differently. For instance, a layer - in a GeoPDF document can be interpreted as either a vector layer by the OGR data provider or a raster + in a Geospatial PDF document can be interpreted as either a vector layer by the OGR data provider or a raster layer by the GDAL provider. The :py:func:`~providerKey` property can be used to determine the data provider associated with a :py:class:`QgsProviderSubLayerDetails` instance. diff --git a/python/core/auto_additions/qgsmapsettingsutils.py b/python/core/auto_additions/qgsmapsettingsutils.py index 6df3ab3883e1..86d15bb60de3 100644 --- a/python/core/auto_additions/qgsmapsettingsutils.py +++ b/python/core/auto_additions/qgsmapsettingsutils.py @@ -1,5 +1,5 @@ # The following has been generated automatically from src/core/qgsmapsettingsutils.h # monkey patching scoped based enum -QgsMapSettingsUtils.EffectsCheckFlag.IgnoreGeoPdfSupportedEffects.__doc__ = "Ignore advanced effects which are supported in GeoPDF exports" +QgsMapSettingsUtils.EffectsCheckFlag.IgnoreGeoPdfSupportedEffects.__doc__ = "Ignore advanced effects which are supported in geospatial PDF exports" QgsMapSettingsUtils.EffectsCheckFlag.__doc__ = "Flags for controlling the behavior of :py:func:`~QgsMapSettingsUtils.containsAdvancedEffects`\n\n.. versionadded:: 3.14\n\n" + '* ``IgnoreGeoPdfSupportedEffects``: ' + QgsMapSettingsUtils.EffectsCheckFlag.IgnoreGeoPdfSupportedEffects.__doc__ # -- diff --git a/python/core/auto_generated/providers/qgsprovidersublayerdetails.sip.in b/python/core/auto_generated/providers/qgsprovidersublayerdetails.sip.in index e64e6542c616..5d377aeb5264 100644 --- a/python/core/auto_generated/providers/qgsprovidersublayerdetails.sip.in +++ b/python/core/auto_generated/providers/qgsprovidersublayerdetails.sip.in @@ -21,7 +21,7 @@ according to a specific data provider. It is possible that multiple data providers may be able to utilize the same underlying sub layer in a single dataset, yet will interpret this layer differently. For instance, a layer - in a GeoPDF document can be interpreted as either a vector layer by the OGR data provider or a raster + in a Geospatial PDF document can be interpreted as either a vector layer by the OGR data provider or a raster layer by the GDAL provider. The :py:func:`~providerKey` property can be used to determine the data provider associated with a :py:class:`QgsProviderSubLayerDetails` instance. diff --git a/src/app/layout/qgslayoutdesignerdialog.cpp b/src/app/layout/qgslayoutdesignerdialog.cpp index 548d58ac53ed..0a49f173550c 100644 --- a/src/app/layout/qgslayoutdesignerdialog.cpp +++ b/src/app/layout/qgslayoutdesignerdialog.cpp @@ -3339,16 +3339,16 @@ void QgsLayoutDesignerDialog::exportAtlasToPdf() outputFileName = QDir( dir ).filePath( QStringLiteral( "atlas" ) ); // filename is overridden by atlas } - bool allowGeoPdfExport = true; - QString geoPdfReason; + bool allowGeospatialPdfExport = true; + QString geospatialPdfReason; if ( singleFile ) { - allowGeoPdfExport = false; - geoPdfReason = tr( "GeoPDF export is not available when exporting an atlas to a single PDF file." ); + allowGeospatialPdfExport = false; + geospatialPdfReason = tr( "Geospatial PDF export is not available when exporting an atlas to a single PDF file." ); } QgsLayoutExporter::PdfExportSettings pdfSettings; - if ( !getPdfExportSettings( pdfSettings, allowGeoPdfExport, geoPdfReason ) ) + if ( !getPdfExportSettings( pdfSettings, allowGeospatialPdfExport, geospatialPdfReason ) ) return; mView->setPaintingEnabled( false ); @@ -4477,7 +4477,7 @@ bool QgsLayoutDesignerDialog::getSvgExportSettings( QgsLayoutExporter::SvgExport return true; } -bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExportSettings &settings, bool allowGeoPdfExport, const QString &geoPdfReason ) +bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExportSettings &settings, bool allowGeospatialPdfExport, const QString &geospatialPdfReason ) { Qgis::TextRenderFormat prevTextRenderFormat = mMasterLayout->layoutProject()->labelingEngineSettings().defaultTextRenderFormat(); bool forceVector = false; @@ -4485,11 +4485,11 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport bool includeMetadata = true; bool disableRasterTiles = false; bool simplify = true; - bool geoPdf = false; + bool geospatialPdf = false; bool useOgcBestPracticeFormat = false; bool losslessImages = false; QStringList exportThemes; - QStringList geoPdfLayerOrder; + QStringList geospatialPdfLayerOrder; if ( mLayout ) { settings.flags = mLayout->renderContext().flags(); @@ -4499,14 +4499,14 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport includeMetadata = mLayout->customProperty( QStringLiteral( "pdfIncludeMetadata" ), 1 ).toBool(); disableRasterTiles = mLayout->customProperty( QStringLiteral( "pdfDisableRasterTiles" ), 0 ).toBool(); simplify = mLayout->customProperty( QStringLiteral( "pdfSimplify" ), 1 ).toBool(); - geoPdf = mLayout->customProperty( QStringLiteral( "pdfCreateGeoPdf" ), 0 ).toBool(); + geospatialPdf = mLayout->customProperty( QStringLiteral( "pdfCreateGeoPdf" ), 0 ).toBool(); useOgcBestPracticeFormat = mLayout->customProperty( QStringLiteral( "pdfOgcBestPracticeFormat" ), 0 ).toBool(); const QString themes = mLayout->customProperty( QStringLiteral( "pdfExportThemes" ) ).toString(); if ( !themes.isEmpty() ) exportThemes = themes.split( QStringLiteral( "~~~" ) ); const QString layerOrder = mLayout->customProperty( QStringLiteral( "pdfLayerOrder" ) ).toString(); if ( !layerOrder.isEmpty() ) - geoPdfLayerOrder = layerOrder.split( QStringLiteral( "~~~" ) ); + geospatialPdfLayerOrder = layerOrder.split( QStringLiteral( "~~~" ) ); const int prevLayoutSettingLabelsAsOutlines = mLayout->customProperty( QStringLiteral( "pdfTextFormat" ), -1 ).toInt(); if ( prevLayoutSettingLabelsAsOutlines >= 0 ) @@ -4517,7 +4517,7 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport } // open options dialog - QString dialogGeoPdfReason = geoPdfReason; + QString dialogGeospatialPdfReason = geospatialPdfReason; QList< QgsLayoutItemMap * > maps; if ( mLayout ) mLayout->layoutItems( maps ); @@ -4526,20 +4526,20 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport { if ( !map->crs().isValid() ) { - allowGeoPdfExport = false; - dialogGeoPdfReason = tr( "One or more map items do not have a valid CRS set. This is required for GeoPDF export." ); + allowGeospatialPdfExport = false; + dialogGeospatialPdfReason = tr( "One or more map items do not have a valid CRS set. This is required for geospatial PDF export." ); break; } if ( map->mapRotation() != 0 || map->itemRotation() != 0 || map->dataDefinedProperties().isActive( QgsLayoutObject::MapRotation ) ) { - allowGeoPdfExport = false; - dialogGeoPdfReason = tr( "One or more map items are rotated. This is not supported for GeoPDF export." ); + allowGeospatialPdfExport = false; + dialogGeospatialPdfReason = tr( "One or more map items are rotated. This is not supported for geospatial PDF export." ); break; } } - QgsLayoutPdfExportOptionsDialog dialog( this, allowGeoPdfExport, dialogGeoPdfReason, geoPdfLayerOrder ); + QgsLayoutPdfExportOptionsDialog dialog( this, allowGeospatialPdfExport, dialogGeospatialPdfReason, geospatialPdfLayerOrder ); dialog.setTextRenderFormat( prevTextRenderFormat ); dialog.setForceVector( forceVector ); @@ -4548,7 +4548,7 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport dialog.setMetadataEnabled( includeMetadata ); dialog.setRasterTilingDisabled( disableRasterTiles ); dialog.setGeometriesSimplified( simplify ); - dialog.setExportGeoPdf( geoPdf ); + dialog.setExportGeospatialPdf( geospatialPdf ); dialog.setUseOgcBestPracticeFormat( useOgcBestPracticeFormat ); dialog.setExportThemes( exportThemes ); dialog.setLosslessImageExport( losslessImages ); @@ -4563,10 +4563,10 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport disableRasterTiles = dialog.rasterTilingDisabled(); simplify = dialog.geometriesSimplified(); Qgis::TextRenderFormat textRenderFormat = dialog.textRenderFormat(); - geoPdf = dialog.exportGeoPdf(); + geospatialPdf = dialog.exportGeospatialPdf(); useOgcBestPracticeFormat = dialog.useOgcBestPracticeFormat(); exportThemes = dialog.exportThemes(); - geoPdfLayerOrder = dialog.geoPdfLayerOrder(); + geospatialPdfLayerOrder = dialog.geospatialPdfLayerOrder(); losslessImages = dialog.losslessImageExport(); QgsLayoutExporter::settingOpenAfterExportingPdf->setValue( dialog.openAfterExporting() ); @@ -4579,10 +4579,10 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport mLayout->setCustomProperty( QStringLiteral( "pdfDisableRasterTiles" ), disableRasterTiles ? 1 : 0 ); mLayout->setCustomProperty( QStringLiteral( "pdfTextFormat" ), static_cast< int >( textRenderFormat ) ); mLayout->setCustomProperty( QStringLiteral( "pdfSimplify" ), simplify ? 1 : 0 ); - mLayout->setCustomProperty( QStringLiteral( "pdfCreateGeoPdf" ), geoPdf ? 1 : 0 ); + mLayout->setCustomProperty( QStringLiteral( "pdfCreateGeoPdf" ), geospatialPdf ? 1 : 0 ); mLayout->setCustomProperty( QStringLiteral( "pdfOgcBestPracticeFormat" ), useOgcBestPracticeFormat ? 1 : 0 ); mLayout->setCustomProperty( QStringLiteral( "pdfExportThemes" ), exportThemes.join( QLatin1String( "~~~" ) ) ); - mLayout->setCustomProperty( QStringLiteral( "pdfLayerOrder" ), geoPdfLayerOrder.join( QLatin1String( "~~~" ) ) ); + mLayout->setCustomProperty( QStringLiteral( "pdfLayerOrder" ), geospatialPdfLayerOrder.join( QLatin1String( "~~~" ) ) ); mLayout->setCustomProperty( QStringLiteral( "pdfLosslessImages" ), losslessImages ? 1 : 0 ); } @@ -4591,7 +4591,7 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport settings.exportMetadata = includeMetadata; settings.textRenderFormat = textRenderFormat; settings.simplifyGeometries = simplify; - settings.writeGeoPdf = geoPdf; + settings.writeGeoPdf = geospatialPdf; settings.useOgcBestPracticeFormatGeoreferencing = useOgcBestPracticeFormat; settings.useIso32000ExtensionFormatGeoreferencing = !useOgcBestPracticeFormat; settings.exportThemes = exportThemes; diff --git a/src/app/layout/qgslayoutdesignerdialog.h b/src/app/layout/qgslayoutdesignerdialog.h index c087222cdf97..c71f0effbc09 100644 --- a/src/app/layout/qgslayoutdesignerdialog.h +++ b/src/app/layout/qgslayoutdesignerdialog.h @@ -559,7 +559,7 @@ class QgsLayoutDesignerDialog: public QMainWindow, public Ui::QgsLayoutDesignerB bool showFileSizeWarning(); bool getRasterExportSettings( QgsLayoutExporter::ImageExportSettings &settings, QSize &imageSize ); bool getSvgExportSettings( QgsLayoutExporter::SvgExportSettings &settings ); - bool getPdfExportSettings( QgsLayoutExporter::PdfExportSettings &settings, bool allowGeoPdfExport = true, const QString &geoPdfReason = QString() ); + bool getPdfExportSettings( QgsLayoutExporter::PdfExportSettings &settings, bool allowGeospatialPdfExport = true, const QString &geospatialPdfReason = QString() ); void toggleAtlasActions( bool enabled ); diff --git a/src/app/qgsmapsavedialog.cpp b/src/app/qgsmapsavedialog.cpp index d3074f417d6e..7acb2571e778 100644 --- a/src/app/qgsmapsavedialog.cpp +++ b/src/app/qgsmapsavedialog.cpp @@ -115,27 +115,27 @@ QgsMapSaveDialog::QgsMapSaveDialog( QWidget *parent, QgsMapCanvas *mapCanvas, co mTextRenderFormatComboBox->addItem( tr( "Always Export Text as Paths (Recommended)" ), static_cast< int>( Qgis::TextRenderFormat::AlwaysOutlines ) ); mTextRenderFormatComboBox->addItem( tr( "Always Export Text as Text Objects" ), static_cast< int >( Qgis::TextRenderFormat::AlwaysText ) ); - const bool geoPdfAvailable = QgsAbstractGeoPdfExporter::geoPDFCreationAvailable(); - mGeoPDFGroupBox->setEnabled( geoPdfAvailable ); - mGeoPDFGroupBox->setChecked( false ); - if ( !geoPdfAvailable ) + const bool geospatialPdfAvailable = QgsAbstractGeospatialPdfExporter::geospatialPDFCreationAvailable(); + mGeospatialPDFGroupBox->setEnabled( geospatialPdfAvailable ); + mGeospatialPDFGroupBox->setChecked( false ); + if ( !geospatialPdfAvailable ) { - mGeoPDFOptionsStackedWidget->setCurrentIndex( 0 ); - mGeoPdfUnavailableReason->setText( QgsAbstractGeoPdfExporter::geoPDFAvailabilityExplanation() ); + mGeospatialPDFOptionsStackedWidget->setCurrentIndex( 0 ); + mGeospatialPdfUnavailableReason->setText( QgsAbstractGeospatialPdfExporter::geospatialPDFAvailabilityExplanation() ); // avoid showing reason in disabled text color - we want it to stand out - QPalette p = mGeoPdfUnavailableReason->palette(); + QPalette p = mGeospatialPdfUnavailableReason->palette(); p.setColor( QPalette::Disabled, QPalette::WindowText, QPalette::WindowText ); - mGeoPdfUnavailableReason->setPalette( p ); - mGeoPDFOptionsStackedWidget->removeWidget( mGeoPDFOptionsStackedWidget->widget( 1 ) ); + mGeospatialPdfUnavailableReason->setPalette( p ); + mGeospatialPDFOptionsStackedWidget->removeWidget( mGeospatialPDFOptionsStackedWidget->widget( 1 ) ); } else { - mGeoPDFOptionsStackedWidget->setCurrentIndex( 1 ); - mGeoPdfFormatComboBox->addItem( tr( "ISO 32000 Extension (recommended)" ) ); - mGeoPdfFormatComboBox->addItem( tr( "OGC Best Practice" ) ); + mGeospatialPDFOptionsStackedWidget->setCurrentIndex( 1 ); + mGeospatialPdfFormatComboBox->addItem( tr( "ISO 32000 Extension (recommended)" ) ); + mGeospatialPdfFormatComboBox->addItem( tr( "OGC Best Practice" ) ); } - connect( mGeoPDFGroupBox, &QGroupBox::toggled, this, &QgsMapSaveDialog::updatePdfExportWarning ); + connect( mGeospatialPDFGroupBox, &QGroupBox::toggled, this, &QgsMapSaveDialog::updatePdfExportWarning ); updatePdfExportWarning(); break; } @@ -143,7 +143,7 @@ QgsMapSaveDialog::QgsMapSaveDialog( QWidget *parent, QgsMapCanvas *mapCanvas, co case Image: { mExportMetadataCheckBox->hide(); - mGeoPDFGroupBox->hide(); + mGeospatialPDFGroupBox->hide(); mAdvancedPdfSettings->hide(); mTextExportLabel->hide(); QPushButton *button = new QPushButton( tr( "Copy to Clipboard" ) ); @@ -520,35 +520,35 @@ void QgsMapSaveDialog::onAccepted() ms.setTextRenderFormat( static_cast< Qgis::TextRenderFormat >( mTextRenderFormatComboBox->currentData().toInt() ) ); - QgsAbstractGeoPdfExporter::ExportDetails geoPdfExportDetails; + QgsAbstractGeospatialPdfExporter::ExportDetails geospatialPdfExportDetails; if ( mExportMetadataCheckBox->isChecked() ) { - // These details will be used on non-GeoPDF exports is the export metadata checkbox is checked - geoPdfExportDetails.author = QgsProject::instance()->metadata().author(); - geoPdfExportDetails.producer = QStringLiteral( "QGIS %1" ).arg( Qgis::version() ); - geoPdfExportDetails.creator = QStringLiteral( "QGIS %1" ).arg( Qgis::version() ); - geoPdfExportDetails.creationDateTime = QDateTime::currentDateTime(); - geoPdfExportDetails.subject = QgsProject::instance()->metadata().abstract(); - geoPdfExportDetails.title = QgsProject::instance()->metadata().title(); - geoPdfExportDetails.keywords = QgsProject::instance()->metadata().keywords(); + // These details will be used on non-Geospatial PDF exports is the export metadata checkbox is checked + geospatialPdfExportDetails.author = QgsProject::instance()->metadata().author(); + geospatialPdfExportDetails.producer = QStringLiteral( "QGIS %1" ).arg( Qgis::version() ); + geospatialPdfExportDetails.creator = QStringLiteral( "QGIS %1" ).arg( Qgis::version() ); + geospatialPdfExportDetails.creationDateTime = QDateTime::currentDateTime(); + geospatialPdfExportDetails.subject = QgsProject::instance()->metadata().abstract(); + geospatialPdfExportDetails.title = QgsProject::instance()->metadata().title(); + geospatialPdfExportDetails.keywords = QgsProject::instance()->metadata().keywords(); } - if ( mGeoPDFGroupBox->isChecked() ) + if ( mGeospatialPDFGroupBox->isChecked() ) { - if ( mGeoPdfFormatComboBox->currentIndex() == 0 ) + if ( mGeospatialPdfFormatComboBox->currentIndex() == 0 ) { - geoPdfExportDetails.useIso32000ExtensionFormatGeoreferencing = true; - geoPdfExportDetails.useOgcBestPracticeFormatGeoreferencing = false; + geospatialPdfExportDetails.useIso32000ExtensionFormatGeoreferencing = true; + geospatialPdfExportDetails.useOgcBestPracticeFormatGeoreferencing = false; } else { - geoPdfExportDetails.useIso32000ExtensionFormatGeoreferencing = false; - geoPdfExportDetails.useOgcBestPracticeFormatGeoreferencing = true; + geospatialPdfExportDetails.useIso32000ExtensionFormatGeoreferencing = false; + geospatialPdfExportDetails.useOgcBestPracticeFormatGeoreferencing = true; } - geoPdfExportDetails.includeFeatures = mExportGeoPdfFeaturesCheckBox->isChecked(); + geospatialPdfExportDetails.includeFeatures = mExportGeospatialPdfFeaturesCheckBox->isChecked(); } - QgsMapRendererTask *mapRendererTask = new QgsMapRendererTask( ms, fileName, QStringLiteral( "PDF" ), saveAsRaster(), QgsTask::CanCancel, mGeoPDFGroupBox->isChecked(), geoPdfExportDetails ); + QgsMapRendererTask *mapRendererTask = new QgsMapRendererTask( ms, fileName, QStringLiteral( "PDF" ), saveAsRaster(), QgsTask::CanCancel, mGeospatialPDFGroupBox->isChecked(), geospatialPdfExportDetails ); if ( drawAnnotations() ) { @@ -586,7 +586,7 @@ void QgsMapSaveDialog::onAccepted() void QgsMapSaveDialog::updatePdfExportWarning() { - const QStringList layers = QgsMapSettingsUtils::containsAdvancedEffects( mMapCanvas->mapSettings(), mGeoPDFGroupBox->isChecked() ? QgsMapSettingsUtils::EffectsCheckFlags( QgsMapSettingsUtils::EffectsCheckFlag::IgnoreGeoPdfSupportedEffects ) : QgsMapSettingsUtils::EffectsCheckFlags() ); + const QStringList layers = QgsMapSettingsUtils::containsAdvancedEffects( mMapCanvas->mapSettings(), mGeospatialPDFGroupBox->isChecked() ? QgsMapSettingsUtils::EffectsCheckFlags( QgsMapSettingsUtils::EffectsCheckFlag::IgnoreGeoPdfSupportedEffects ) : QgsMapSettingsUtils::EffectsCheckFlags() ); if ( !layers.isEmpty() ) { mInfoDetails = tr( "The following layer(s) use advanced effects:\n\n%1\n\nRasterizing map is recommended for proper rendering." ).arg( diff --git a/src/core/layout/qgslayoutexporter.cpp b/src/core/layout/qgslayoutexporter.cpp index 01fbca7ad2b2..15647157fd8b 100644 --- a/src/core/layout/qgslayoutexporter.cpp +++ b/src/core/layout/qgslayoutexporter.cpp @@ -553,9 +553,9 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToPdf( const QString &f mLayout->renderContext().setSimplifyMethod( createExportSimplifyMethod() ); } - std::unique_ptr< QgsLayoutGeoPdfExporter > geoPdfExporter; + std::unique_ptr< QgsLayoutGeospatialPdfExporter > geospatialPdfExporter; if ( settings.writeGeoPdf || settings.exportLayersAsSeperateFiles ) //#spellok - geoPdfExporter = std::make_unique< QgsLayoutGeoPdfExporter >( mLayout ); + geospatialPdfExporter = std::make_unique< QgsLayoutGeospatialPdfExporter >( mLayout ); mLayout->renderContext().setFlags( settings.flags ); @@ -584,21 +584,21 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToPdf( const QString &f const QList items = mLayout->items( Qt::AscendingOrder ); - QList< QgsLayoutGeoPdfExporter::ComponentLayerDetail > pdfComponents; + QList< QgsLayoutGeospatialPdfExporter::ComponentLayerDetail > pdfComponents; const QDir baseDir = settings.exportLayersAsSeperateFiles ? QFileInfo( filePath ).dir() : QDir(); //#spellok const QString baseFileName = settings.exportLayersAsSeperateFiles ? QFileInfo( filePath ).completeBaseName() : QString(); //#spellok - auto exportFunc = [this, &subSettings, &pdfComponents, &geoPdfExporter, &settings, &baseDir, &baseFileName]( unsigned int layerId, const QgsLayoutItem::ExportLayerDetail & layerDetail )->QgsLayoutExporter::ExportResult + auto exportFunc = [this, &subSettings, &pdfComponents, &geospatialPdfExporter, &settings, &baseDir, &baseFileName]( unsigned int layerId, const QgsLayoutItem::ExportLayerDetail & layerDetail )->QgsLayoutExporter::ExportResult { ExportResult layerExportResult = Success; - QgsLayoutGeoPdfExporter::ComponentLayerDetail component; + QgsLayoutGeospatialPdfExporter::ComponentLayerDetail component; component.name = layerDetail.name; component.mapLayerId = layerDetail.mapLayerId; component.opacity = layerDetail.opacity; component.compositionMode = layerDetail.compositionMode; component.group = layerDetail.mapTheme; - component.sourcePdfPath = settings.writeGeoPdf ? geoPdfExporter->generateTemporaryFilepath( QStringLiteral( "layer_%1.pdf" ).arg( layerId ) ) : baseDir.filePath( QStringLiteral( "%1_%2.pdf" ).arg( baseFileName ).arg( layerId, 4, 10, QChar( '0' ) ) ); + component.sourcePdfPath = settings.writeGeoPdf ? geospatialPdfExporter->generateTemporaryFilepath( QStringLiteral( "layer_%1.pdf" ).arg( layerId ) ) : baseDir.filePath( QStringLiteral( "%1_%2.pdf" ).arg( baseFileName ).arg( layerId, 4, 10, QChar( '0' ) ) ); pdfComponents << component; QPdfWriter printer = QPdfWriter( component.sourcePdfPath ); preparePrintAsPdf( mLayout, &printer, component.sourcePdfPath ); @@ -620,7 +620,7 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToPdf( const QString &f if ( settings.writeGeoPdf ) { - QgsAbstractGeoPdfExporter::ExportDetails details; + QgsAbstractGeospatialPdfExporter::ExportDetails details; details.dpi = settings.dpi; // TODO - multipages QgsLayoutSize pageSize = mLayout->pageCollection()->page( 0 )->sizeWithUnits(); @@ -629,7 +629,7 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToPdf( const QString &f if ( settings.exportMetadata ) { - // copy layout metadata to GeoPDF export settings + // copy layout metadata to geospatial PDF export settings details.author = mLayout->project()->metadata().author(); details.producer = QStringLiteral( "QGIS %1" ).arg( Qgis::version() ); details.creator = QStringLiteral( "QGIS %1" ).arg( Qgis::version() ); @@ -652,7 +652,7 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToPdf( const QString &f mLayout->layoutItems( maps ); for ( QgsLayoutItemMap *map : std::as_const( maps ) ) { - QgsAbstractGeoPdfExporter::GeoReferencedSection georef; + QgsAbstractGeospatialPdfExporter::GeoReferencedSection georef; georef.crs = map->crs(); const QPointF topLeft = map->mapToScene( QPointF( 0, 0 ) ); @@ -677,22 +677,22 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToPdf( const QString &f const QgsPointXY bottomLeftMap = t.map( bottomLeft ); const QgsPointXY bottomRightMap = t.map( bottomRight ); - georef.controlPoints << QgsAbstractGeoPdfExporter::ControlPoint( QgsPointXY( topLeftMm.x(), topLeftMm.y() ), topLeftMap ); - georef.controlPoints << QgsAbstractGeoPdfExporter::ControlPoint( QgsPointXY( topRightMm.x(), topRightMm.y() ), topRightMap ); - georef.controlPoints << QgsAbstractGeoPdfExporter::ControlPoint( QgsPointXY( bottomLeftMm.x(), bottomLeftMm.y() ), bottomLeftMap ); - georef.controlPoints << QgsAbstractGeoPdfExporter::ControlPoint( QgsPointXY( bottomRightMm.x(), bottomRightMm.y() ), bottomRightMap ); + georef.controlPoints << QgsAbstractGeospatialPdfExporter::ControlPoint( QgsPointXY( topLeftMm.x(), topLeftMm.y() ), topLeftMap ); + georef.controlPoints << QgsAbstractGeospatialPdfExporter::ControlPoint( QgsPointXY( topRightMm.x(), topRightMm.y() ), topRightMap ); + georef.controlPoints << QgsAbstractGeospatialPdfExporter::ControlPoint( QgsPointXY( bottomLeftMm.x(), bottomLeftMm.y() ), bottomLeftMap ); + georef.controlPoints << QgsAbstractGeospatialPdfExporter::ControlPoint( QgsPointXY( bottomRightMm.x(), bottomRightMm.y() ), bottomRightMap ); details.georeferencedSections << georef; } } - details.customLayerTreeGroups = geoPdfExporter->customLayerTreeGroups(); - details.initialLayerVisibility = geoPdfExporter->initialLayerVisibility(); - details.layerOrder = geoPdfExporter->layerOrder(); + details.customLayerTreeGroups = geospatialPdfExporter->customLayerTreeGroups(); + details.initialLayerVisibility = geospatialPdfExporter->initialLayerVisibility(); + details.layerOrder = geospatialPdfExporter->layerOrder(); details.includeFeatures = settings.includeGeoPdfFeatures; details.useOgcBestPracticeFormatGeoreferencing = settings.useOgcBestPracticeFormatGeoreferencing; details.useIso32000ExtensionFormatGeoreferencing = settings.useIso32000ExtensionFormatGeoreferencing; - if ( !geoPdfExporter->finalize( pdfComponents, filePath, details ) ) + if ( !geospatialPdfExporter->finalize( pdfComponents, filePath, details ) ) result = PrintError; } else diff --git a/src/core/layout/qgslayoutexporter.h b/src/core/layout/qgslayoutexporter.h index b0f1608b946d..b10674e1356f 100644 --- a/src/core/layout/qgslayoutexporter.h +++ b/src/core/layout/qgslayoutexporter.h @@ -326,9 +326,9 @@ class CORE_EXPORT QgsLayoutExporter bool simplifyGeometries = true; /** - * TRUE if GeoPDF files should be created, instead of normal PDF files. + * TRUE if geospatial PDF files should be created, instead of normal PDF files. * - * Whilst GeoPDF files can include some desirable properties like the ability to interactively + * Whilst geospatial PDF files can include some desirable properties like the ability to interactively * query map features, they also can result in lower-quality output files, or forced rasterization * of layers. * @@ -366,8 +366,8 @@ class CORE_EXPORT QgsLayoutExporter /** * TRUE if OGC "best practice" format georeferencing should be used. * - * \warning This results in GeoPDF files compatible with the TerraGo suite of tools, but - * can break compatibility with the built-in Acrobat geospatial tools (yes, GeoPDF + * \warning This results in geospatial PDF files compatible with a unnamed suite of tools starting with Terra and ending with Go, but + * can break compatibility with the built-in Acrobat geospatial tools (yes, Geospatial PDF * format is a mess!). * * If PdfExportSettings::writeGeoPdf is FALSE than this option has no effect. @@ -375,17 +375,17 @@ class CORE_EXPORT QgsLayoutExporter bool useOgcBestPracticeFormatGeoreferencing = false; /** - * TRUE if feature vector information (such as attributes) should be exported during GeoPDF exports. + * TRUE if feature vector information (such as attributes) should be exported during Geospatial PDF exports. * * If PdfExportSettings::writeGeoPdf is FALSE than this option has no effect. */ bool includeGeoPdfFeatures = true; /** - * Optional list of map themes to export as GeoPDF layer groups. + * Optional list of map themes to export as Geospatial PDF layer groups. * * If set, map item's which are not assigned a specific map theme will iterate through all listed - * themes and a GeoPDF layer group will be created for each. + * themes and a Geospatial PDF layer group will be created for each. * * If PdfExportSettings::writeGeoPdf is FALSE than this option has no effect. */ diff --git a/src/core/layout/qgslayoutgeopdfexporter.cpp b/src/core/layout/qgslayoutgeopdfexporter.cpp index 4815df24ca24..b85f64e59c67 100644 --- a/src/core/layout/qgslayoutgeopdfexporter.cpp +++ b/src/core/layout/qgslayoutgeopdfexporter.cpp @@ -32,11 +32,11 @@ #include ///@cond PRIVATE -class QgsGeoPdfRenderedFeatureHandler: public QgsRenderedFeatureHandlerInterface +class QgsGeospatialPdfRenderedFeatureHandler: public QgsRenderedFeatureHandlerInterface { public: - QgsGeoPdfRenderedFeatureHandler( QgsLayoutItemMap *map, QgsLayoutGeoPdfExporter *exporter, const QStringList &layerIds ) + QgsGeospatialPdfRenderedFeatureHandler( QgsLayoutItemMap *map, QgsLayoutGeospatialPdfExporter *exporter, const QStringList &layerIds ) : mExporter( exporter ) , mMap( map ) , mLayerIds( layerIds ) @@ -88,7 +88,7 @@ class QgsGeoPdfRenderedFeatureHandler: public QgsRenderedFeatureHandlerInterface // always convert to multitype, to make things consistent transformed.convertToMultiType(); - mExporter->pushRenderedFeature( layerId, QgsLayoutGeoPdfExporter::RenderedFeature( feature, transformed ), theme ); + mExporter->pushRenderedFeature( layerId, QgsLayoutGeospatialPdfExporter::RenderedFeature( feature, transformed ), theme ); } QSet usedAttributes( QgsVectorLayer *, const QgsRenderContext & ) const override @@ -99,13 +99,13 @@ class QgsGeoPdfRenderedFeatureHandler: public QgsRenderedFeatureHandlerInterface private: QTransform mMapToLayoutTransform; QTransform mLayoutToPdfTransform; - QgsLayoutGeoPdfExporter *mExporter = nullptr; + QgsLayoutGeospatialPdfExporter *mExporter = nullptr; QgsLayoutItemMap *mMap = nullptr; QStringList mLayerIds; }; ///@endcond -QgsLayoutGeoPdfExporter::QgsLayoutGeoPdfExporter( QgsLayout *layout ) +QgsLayoutGeospatialPdfExporter::QgsLayoutGeospatialPdfExporter( QgsLayout *layout ) : mLayout( layout ) { // build a list of exportable feature layers in advance @@ -137,19 +137,19 @@ QgsLayoutGeoPdfExporter::QgsLayoutGeoPdfExporter( QgsLayout *layout ) mLayout->layoutItems( maps ); for ( QgsLayoutItemMap *map : std::as_const( maps ) ) { - QgsGeoPdfRenderedFeatureHandler *handler = new QgsGeoPdfRenderedFeatureHandler( map, this, exportableLayerIds ); + QgsGeospatialPdfRenderedFeatureHandler *handler = new QgsGeospatialPdfRenderedFeatureHandler( map, this, exportableLayerIds ); mMapHandlers.insert( map, handler ); map->addRenderedFeatureHandler( handler ); } // start with project layer order, and then apply custom layer order if set - QStringList geoPdfLayerOrder; + QStringList geospatialPdfLayerOrder; const QString presetLayerOrder = mLayout->customProperty( QStringLiteral( "pdfLayerOrder" ) ).toString(); if ( !presetLayerOrder.isEmpty() ) - geoPdfLayerOrder = presetLayerOrder.split( QStringLiteral( "~~~" ) ); + geospatialPdfLayerOrder = presetLayerOrder.split( QStringLiteral( "~~~" ) ); QList< QgsMapLayer * > layerOrder = mLayout->project()->layerTreeRoot()->layerOrder(); - for ( auto it = geoPdfLayerOrder.rbegin(); it != geoPdfLayerOrder.rend(); ++it ) + for ( auto it = geospatialPdfLayerOrder.rbegin(); it != geospatialPdfLayerOrder.rend(); ++it ) { for ( int i = 0; i < layerOrder.size(); ++i ) { @@ -165,7 +165,7 @@ QgsLayoutGeoPdfExporter::QgsLayoutGeoPdfExporter( QgsLayout *layout ) mLayerOrder << layer->id(); } -QgsLayoutGeoPdfExporter::~QgsLayoutGeoPdfExporter() +QgsLayoutGeospatialPdfExporter::~QgsLayoutGeospatialPdfExporter() { // cleanup - remove rendered feature handler from all maps for ( auto it = mMapHandlers.constBegin(); it != mMapHandlers.constEnd(); ++it ) @@ -175,7 +175,7 @@ QgsLayoutGeoPdfExporter::~QgsLayoutGeoPdfExporter() } } -QgsAbstractGeoPdfExporter::VectorComponentDetail QgsLayoutGeoPdfExporter::componentDetailForLayerId( const QString &layerId ) +QgsAbstractGeospatialPdfExporter::VectorComponentDetail QgsLayoutGeospatialPdfExporter::componentDetailForLayerId( const QString &layerId ) { QgsProject *project = mLayout->project(); VectorComponentDetail detail; diff --git a/src/core/layout/qgslayoutgeopdfexporter.h b/src/core/layout/qgslayoutgeopdfexporter.h index 7fe8abe7eb52..0c8af27ca5d5 100644 --- a/src/core/layout/qgslayoutgeopdfexporter.h +++ b/src/core/layout/qgslayoutgeopdfexporter.h @@ -25,18 +25,18 @@ #define SIP_NO_FILE class QgsLayout; -class QgsGeoPdfRenderedFeatureHandler; +class QgsGeospatialPdfRenderedFeatureHandler; /** - * \class QgsLayoutGeoPdfExporter + * \class QgsLayoutGeospatialPdfExporter * \ingroup core * - * \brief Handles GeoPDF export specific setup, cleanup and processing steps. + * \brief Handles geospatial PDF export specific setup, cleanup and processing steps. * * This class is a low level implementation detail only. Generally, you should use the high level interface exposed by * QgsLayoutExporter instead. * - * \warning QgsLayoutGeoPdfExporter is designed to be a short lived object. It should be created for a + * \warning QgsLayoutGeospatialPdfExporter is designed to be a short lived object. It should be created for a * single layout export operation only, and then immediately destroyed. Failure to correctly * destroy the object after exporting a layout will leave the layout in an inconsistent, unstable state. * @@ -44,16 +44,16 @@ class QgsGeoPdfRenderedFeatureHandler; * * \since QGIS 3.10 */ -class CORE_EXPORT QgsLayoutGeoPdfExporter : public QgsAbstractGeoPdfExporter +class CORE_EXPORT QgsLayoutGeospatialPdfExporter : public QgsAbstractGeospatialPdfExporter { public: /** - * Constructor for QgsLayoutGeoPdfExporter, associated with the specified \a layout. + * Constructor for QgsLayoutGeospatialPdfExporter, associated with the specified \a layout. */ - QgsLayoutGeoPdfExporter( QgsLayout *layout ); + QgsLayoutGeospatialPdfExporter( QgsLayout *layout ); - ~QgsLayoutGeoPdfExporter() override; + ~QgsLayoutGeospatialPdfExporter() override; /** * Returns any custom layer tree groups defined in the layer's settings. @@ -69,8 +69,8 @@ class CORE_EXPORT QgsLayoutGeoPdfExporter : public QgsAbstractGeoPdfExporter QMap< QString, bool > initialLayerVisibility() const { return mInitialLayerVisibility; } /** - * Optional list of map layer IDs in the order they should be shown in the generated GeoPDF layer tree. - * Layer IDs earlier in the list will appear higher in the GeoPDF layer tree. + * Optional list of map layer IDs in the order they should be shown in the generated geospatial PDF layer tree. + * Layer IDs earlier in the list will appear higher in the geospatial PDF layer tree. * * \since QGIS 3.14 */ @@ -81,13 +81,13 @@ class CORE_EXPORT QgsLayoutGeoPdfExporter : public QgsAbstractGeoPdfExporter VectorComponentDetail componentDetailForLayerId( const QString &layerId ) override; QgsLayout *mLayout = nullptr; - QHash< QgsLayoutItemMap *, QgsGeoPdfRenderedFeatureHandler * > mMapHandlers; + QHash< QgsLayoutItemMap *, QgsGeospatialPdfRenderedFeatureHandler * > mMapHandlers; QMap< QString, bool > mInitialLayerVisibility; QMap< QString, QString > mCustomLayerTreeGroups; QStringList mLayerOrder; - friend class TestQgsLayoutGeoPdfExport; + friend class TestQgsLayoutGeospatialPdfExport; }; #endif //QGSLAYOUTGEOPDFEXPORTER_H diff --git a/src/core/layout/qgslayoutitemmap.h b/src/core/layout/qgslayoutitemmap.h index b6a742ef3a6c..ad9472620b86 100644 --- a/src/core/layout/qgslayoutitemmap.h +++ b/src/core/layout/qgslayoutitemmap.h @@ -1200,7 +1200,7 @@ class CORE_EXPORT QgsLayoutItemMap : public QgsLayoutItem, public QgsTemporalRan friend class QgsLayoutItemLegend; friend class TestQgsLayoutMap; friend class QgsCompositionConverter; - friend class QgsGeoPdfRenderedFeatureHandler; + friend class QgsGeospatialPdfRenderedFeatureHandler; friend class QgsLayoutExporter; }; diff --git a/src/core/maprenderer/qgsmaprenderertask.cpp b/src/core/maprenderer/qgsmaprenderertask.cpp index fad4308ebbe6..5357e6b9d956 100644 --- a/src/core/maprenderer/qgsmaprenderertask.cpp +++ b/src/core/maprenderer/qgsmaprenderertask.cpp @@ -38,12 +38,12 @@ ///@cond PRIVATE -class QgsMapRendererTaskGeoPdfExporter : public QgsAbstractGeoPdfExporter +class QgsMapRendererTaskGeospatialPdfExporter : public QgsAbstractGeospatialPdfExporter { public: - QgsMapRendererTaskGeoPdfExporter( const QgsMapSettings &ms ) + QgsMapRendererTaskGeospatialPdfExporter( const QgsMapSettings &ms ) { // collect details upfront, while we are still in the main thread const QList< QgsMapLayer * > layers = ms.layers(); @@ -62,7 +62,7 @@ class QgsMapRendererTaskGeoPdfExporter : public QgsAbstractGeoPdfExporter private: - QgsAbstractGeoPdfExporter::VectorComponentDetail componentDetailForLayerId( const QString &layerId ) override + QgsAbstractGeospatialPdfExporter::VectorComponentDetail componentDetailForLayerId( const QString &layerId ) override { return mLayerDetails.value( layerId ); } @@ -75,7 +75,7 @@ class QgsMapRendererTaskRenderedFeatureHandler : public QgsRenderedFeatureHandle { public: - QgsMapRendererTaskRenderedFeatureHandler( QgsMapRendererTaskGeoPdfExporter *exporter, const QgsMapSettings &settings ) + QgsMapRendererTaskRenderedFeatureHandler( QgsMapRendererTaskGeospatialPdfExporter *exporter, const QgsMapSettings &settings ) : mExporter( exporter ) , mMapSettings( settings ) { @@ -97,7 +97,7 @@ class QgsMapRendererTaskRenderedFeatureHandler : public QgsRenderedFeatureHandle // always convert to multitype, to make things consistent transformed.convertToMultiType(); - mExporter->pushRenderedFeature( layerId, QgsAbstractGeoPdfExporter::RenderedFeature( feature, transformed ) ); + mExporter->pushRenderedFeature( layerId, QgsAbstractGeospatialPdfExporter::RenderedFeature( feature, transformed ) ); } QSet usedAttributes( QgsVectorLayer *, const QgsRenderContext & ) const override @@ -107,7 +107,7 @@ class QgsMapRendererTaskRenderedFeatureHandler : public QgsRenderedFeatureHandle private: - QgsMapRendererTaskGeoPdfExporter *mExporter = nullptr; + QgsMapRendererTaskGeospatialPdfExporter *mExporter = nullptr; QgsMapSettings mMapSettings; //! Transform from output space (pixels) to PDF space (pixels at 72 dpi) QTransform mTransform; @@ -117,14 +117,14 @@ class QgsMapRendererTaskRenderedFeatureHandler : public QgsRenderedFeatureHandle ///@endcond QgsMapRendererTask::QgsMapRendererTask( const QgsMapSettings &ms, const QString &fileName, const QString &fileFormat, const bool forceRaster, QgsTask::Flags flags, - const bool geoPDF, const QgsAbstractGeoPdfExporter::ExportDetails &geoPdfExportDetails ) + const bool geoPDF, const QgsAbstractGeospatialPdfExporter::ExportDetails &geospatialPdfExportDetails ) : QgsTask( fileFormat == QLatin1String( "PDF" ) ? tr( "Saving as PDF" ) : tr( "Saving as image" ), flags ) , mMapSettings( ms ) , mFileName( fileName ) , mFileFormat( fileFormat ) , mForceRaster( forceRaster ) - , mGeoPDF( geoPDF && mFileFormat == QLatin1String( "PDF" ) && QgsAbstractGeoPdfExporter::geoPDFCreationAvailable() ) - , mGeoPdfExportDetails( geoPdfExportDetails ) + , mGeospatialPDF( geoPDF && mFileFormat == QLatin1String( "PDF" ) && QgsAbstractGeospatialPdfExporter::geospatialPDFCreationAvailable() ) + , mGeospatialPdfExportDetails( geospatialPdfExportDetails ) { if ( mFileFormat == QLatin1String( "PDF" ) && !qgsDoubleNear( mMapSettings.devicePixelRatio(), 1.0 ) ) { @@ -178,21 +178,21 @@ bool QgsMapRendererTask::run() if ( mErrored ) return false; - if ( mGeoPDF ) + if ( mGeospatialPDF ) { - QList< QgsAbstractGeoPdfExporter::ComponentLayerDetail > pdfComponents; + QList< QgsAbstractGeospatialPdfExporter::ComponentLayerDetail > pdfComponents; QgsMapRendererStagedRenderJob *job = static_cast< QgsMapRendererStagedRenderJob * >( mJob.get() ); int outputLayer = 1; while ( !job->isFinished() ) { - QgsAbstractGeoPdfExporter::ComponentLayerDetail component; + QgsAbstractGeospatialPdfExporter::ComponentLayerDetail component; component.name = QStringLiteral( "layer_%1" ).arg( outputLayer ); component.mapLayerId = job->currentLayerId(); component.opacity = job->currentLayerOpacity(); component.compositionMode = job->currentLayerCompositionMode(); - component.sourcePdfPath = mGeoPdfExporter->generateTemporaryFilepath( QStringLiteral( "layer_%1.pdf" ).arg( outputLayer ) ); + component.sourcePdfPath = mGeospatialPdfExporter->generateTemporaryFilepath( QStringLiteral( "layer_%1.pdf" ).arg( outputLayer ) ); pdfComponents << component; QPdfWriter pdfWriter( component.sourcePdfPath ); @@ -211,7 +211,7 @@ bool QgsMapRendererTask::run() outputLayer++; job->nextPart(); } - QgsAbstractGeoPdfExporter::ExportDetails exportDetails = mGeoPdfExportDetails; + QgsAbstractGeospatialPdfExporter::ExportDetails exportDetails = mGeospatialPdfExportDetails; const double pageWidthMM = mMapSettings.outputSize().width() * 25.4 / mMapSettings.outputDpi(); const double pageHeightMM = mMapSettings.outputSize().height() * 25.4 / mMapSettings.outputDpi(); exportDetails.pageSizeMm = QSizeF( pageWidthMM, pageHeightMM ); @@ -223,19 +223,19 @@ bool QgsMapRendererTask::run() if ( mSaveWorldFile ) { // setup georeferencing - QgsAbstractGeoPdfExporter::GeoReferencedSection georef; + QgsAbstractGeospatialPdfExporter::GeoReferencedSection georef; georef.crs = mMapSettings.destinationCrs(); georef.pageBoundsMm = QgsRectangle( 0, 0, pageWidthMM, pageHeightMM ); georef.controlPoints.reserve( 4 ); - georef.controlPoints << QgsAbstractGeoPdfExporter::ControlPoint( QgsPointXY( 0, 0 ), mMapSettings.mapToPixel().toMapCoordinates( 0, 0 ) ); - georef.controlPoints << QgsAbstractGeoPdfExporter::ControlPoint( QgsPointXY( pageWidthMM, 0 ), mMapSettings.mapToPixel().toMapCoordinates( mMapSettings.outputSize().width(), 0 ) ); - georef.controlPoints << QgsAbstractGeoPdfExporter::ControlPoint( QgsPointXY( pageWidthMM, pageHeightMM ), mMapSettings.mapToPixel().toMapCoordinates( mMapSettings.outputSize().width(), mMapSettings.outputSize().height() ) ); - georef.controlPoints << QgsAbstractGeoPdfExporter::ControlPoint( QgsPointXY( 0, pageHeightMM ), mMapSettings.mapToPixel().toMapCoordinates( 0, mMapSettings.outputSize().height() ) ); + georef.controlPoints << QgsAbstractGeospatialPdfExporter::ControlPoint( QgsPointXY( 0, 0 ), mMapSettings.mapToPixel().toMapCoordinates( 0, 0 ) ); + georef.controlPoints << QgsAbstractGeospatialPdfExporter::ControlPoint( QgsPointXY( pageWidthMM, 0 ), mMapSettings.mapToPixel().toMapCoordinates( mMapSettings.outputSize().width(), 0 ) ); + georef.controlPoints << QgsAbstractGeospatialPdfExporter::ControlPoint( QgsPointXY( pageWidthMM, pageHeightMM ), mMapSettings.mapToPixel().toMapCoordinates( mMapSettings.outputSize().width(), mMapSettings.outputSize().height() ) ); + georef.controlPoints << QgsAbstractGeospatialPdfExporter::ControlPoint( QgsPointXY( 0, pageHeightMM ), mMapSettings.mapToPixel().toMapCoordinates( 0, mMapSettings.outputSize().height() ) ); exportDetails.georeferencedSections << georef; } - const bool res = mGeoPdfExporter->finalize( pdfComponents, mFileName, exportDetails ); - mGeoPdfExporter.reset(); + const bool res = mGeospatialPdfExporter->finalize( pdfComponents, mFileName, exportDetails ); + mGeospatialPdfExporter.reset(); mTempPainter.reset(); mPdfWriter.reset(); return res; @@ -331,10 +331,10 @@ bool QgsMapRendererTask::run() if ( mExportMetadata ) { QString creationDateString; - const QDateTime creationDateTime = mGeoPdfExportDetails.creationDateTime; + const QDateTime creationDateTime = mGeospatialPdfExportDetails.creationDateTime; if ( creationDateTime.isValid() ) { - creationDateString = QStringLiteral( "D:%1" ).arg( mGeoPdfExportDetails.creationDateTime.toString( QStringLiteral( "yyyyMMddHHmmss" ) ) ); + creationDateString = QStringLiteral( "D:%1" ).arg( mGeospatialPdfExportDetails.creationDateTime.toString( QStringLiteral( "yyyyMMddHHmmss" ) ) ); if ( creationDateTime.timeZone().isValid() ) { int offsetFromUtc = creationDateTime.timeZone().offsetFromUtc( creationDateTime ); @@ -347,14 +347,14 @@ bool QgsMapRendererTask::run() } GDALSetMetadataItem( outputDS.get(), "CREATION_DATE", creationDateString.toUtf8().constData(), nullptr ); - GDALSetMetadataItem( outputDS.get(), "AUTHOR", mGeoPdfExportDetails.author.toUtf8().constData(), nullptr ); + GDALSetMetadataItem( outputDS.get(), "AUTHOR", mGeospatialPdfExportDetails.author.toUtf8().constData(), nullptr ); const QString creator = QStringLiteral( "QGIS %1" ).arg( Qgis::version() ); GDALSetMetadataItem( outputDS.get(), "CREATOR", creator.toUtf8().constData(), nullptr ); GDALSetMetadataItem( outputDS.get(), "PRODUCER", creator.toUtf8().constData(), nullptr ); - GDALSetMetadataItem( outputDS.get(), "SUBJECT", mGeoPdfExportDetails.subject.toUtf8().constData(), nullptr ); - GDALSetMetadataItem( outputDS.get(), "TITLE", mGeoPdfExportDetails.title.toUtf8().constData(), nullptr ); + GDALSetMetadataItem( outputDS.get(), "SUBJECT", mGeospatialPdfExportDetails.subject.toUtf8().constData(), nullptr ); + GDALSetMetadataItem( outputDS.get(), "TITLE", mGeospatialPdfExportDetails.title.toUtf8().constData(), nullptr ); - const QgsAbstractMetadataBase::KeywordMap keywords = mGeoPdfExportDetails.keywords; + const QgsAbstractMetadataBase::KeywordMap keywords = mGeospatialPdfExportDetails.keywords; QStringList allKeywords; for ( auto it = keywords.constBegin(); it != keywords.constEnd(); ++it ) { @@ -442,12 +442,12 @@ void QgsMapRendererTask::finished( bool result ) void QgsMapRendererTask::prepare() { - if ( mGeoPDF ) + if ( mGeospatialPDF ) { - mGeoPdfExporter = std::make_unique< QgsMapRendererTaskGeoPdfExporter >( mMapSettings ); - if ( mGeoPdfExportDetails.includeFeatures ) + mGeospatialPdfExporter = std::make_unique< QgsMapRendererTaskGeospatialPdfExporter >( mMapSettings ); + if ( mGeospatialPdfExportDetails.includeFeatures ) { - mRenderedFeatureHandler = std::make_unique< QgsMapRendererTaskRenderedFeatureHandler >( static_cast< QgsMapRendererTaskGeoPdfExporter * >( mGeoPdfExporter.get() ), mMapSettings ); + mRenderedFeatureHandler = std::make_unique< QgsMapRendererTaskRenderedFeatureHandler >( static_cast< QgsMapRendererTaskGeospatialPdfExporter * >( mGeospatialPdfExporter.get() ), mMapSettings ); mMapSettings.addRenderedFeatureHandler( mRenderedFeatureHandler.get() ); } diff --git a/src/core/maprenderer/qgsmaprenderertask.h b/src/core/maprenderer/qgsmaprenderertask.h index a965be75ba88..e01d036904f6 100644 --- a/src/core/maprenderer/qgsmaprenderertask.h +++ b/src/core/maprenderer/qgsmaprenderertask.h @@ -32,7 +32,7 @@ #include class QgsMapRendererCustomPainterJob; -class QgsAbstractGeoPdfExporter; +class QgsAbstractGeospatialPdfExporter; /** * \class QgsMapRendererTask @@ -60,8 +60,8 @@ class CORE_EXPORT QgsMapRendererTask : public QgsTask /** * Constructor for QgsMapRendererTask to render a map to an image file. * - * If the output \a fileFormat is set to PDF, the \a geoPdf argument controls whether a GeoPDF file is created. - * See QgsAbstractGeoPdfExporter::geoPDFCreationAvailable() for conditions on GeoPDF creation availability. + * If the output \a fileFormat is set to PDF, the \a geospatialPdf argument controls whether a geospatial PDF file is created. + * See QgsAbstractGeospatialPdfExporter::geospatialPDFCreationAvailable() for conditions on geospatial PDF creation availability. * * Since QGIS 3.26 the optional \a flags argument can be used to control the task flags. */ @@ -69,7 +69,7 @@ class CORE_EXPORT QgsMapRendererTask : public QgsTask const QString &fileName, const QString &fileFormat = QString( "PNG" ), bool forceRaster = false, - QgsTask::Flags flags = QgsTask::CanCancel, bool geoPdf = false, const QgsAbstractGeoPdfExporter::ExportDetails &geoPdfExportDetails = QgsAbstractGeoPdfExporter::ExportDetails() + QgsTask::Flags flags = QgsTask::CanCancel, bool geospatialPdf = false, const QgsAbstractGeospatialPdfExporter::ExportDetails &geospatialPdfExportDetails = QgsAbstractGeospatialPdfExporter::ExportDetails() ); #else @@ -143,7 +143,7 @@ class CORE_EXPORT QgsMapRendererTask : public QgsTask QMutex mJobMutex; std::unique_ptr< QgsMapRendererJob > mJob; - std::unique_ptr< QgsAbstractGeoPdfExporter > mGeoPdfExporter; + std::unique_ptr< QgsAbstractGeospatialPdfExporter > mGeospatialPdfExporter; std::unique_ptr< QgsRenderedFeatureHandlerInterface > mRenderedFeatureHandler; QPainter *mPainter = nullptr; @@ -158,8 +158,8 @@ class CORE_EXPORT QgsMapRendererTask : public QgsTask bool mForceRaster = false; bool mSaveWorldFile = false; bool mExportMetadata = false; - bool mGeoPDF = false; - QgsAbstractGeoPdfExporter::ExportDetails mGeoPdfExportDetails; + bool mGeospatialPDF = false; + QgsAbstractGeospatialPdfExporter::ExportDetails mGeospatialPdfExportDetails; QList< QgsAnnotation * > mAnnotations; QList< QgsMapDecoration * > mDecorations; diff --git a/src/core/providers/qgsprovidersublayerdetails.h b/src/core/providers/qgsprovidersublayerdetails.h index 6d2c9d2153ae..dca8a9b07eb7 100644 --- a/src/core/providers/qgsprovidersublayerdetails.h +++ b/src/core/providers/qgsprovidersublayerdetails.h @@ -36,7 +36,7 @@ * * \note It is possible that multiple data providers may be able to utilize the same underlying * sub layer in a single dataset, yet will interpret this layer differently. For instance, a layer - * in a GeoPDF document can be interpreted as either a vector layer by the OGR data provider or a raster + * in a Geospatial PDF document can be interpreted as either a vector layer by the OGR data provider or a raster * layer by the GDAL provider. The providerKey() property can be used to determine the data provider * associated with a QgsProviderSubLayerDetails instance. * diff --git a/src/core/qgsabstractgeopdfexporter.cpp b/src/core/qgsabstractgeopdfexporter.cpp index 0d63ee5c010a..07da51fd1c2e 100644 --- a/src/core/qgsabstractgeopdfexporter.cpp +++ b/src/core/qgsabstractgeopdfexporter.cpp @@ -32,7 +32,7 @@ #include #include -bool QgsAbstractGeoPdfExporter::geoPDFCreationAvailable() +bool QgsAbstractGeospatialPdfExporter::geospatialPDFCreationAvailable() { // test if GDAL has read support in PDF driver GDALDriverH hDriverMem = GDALGetDriverByName( "PDF" ); @@ -52,7 +52,7 @@ bool QgsAbstractGeoPdfExporter::geoPDFCreationAvailable() return false; } -QString QgsAbstractGeoPdfExporter::geoPDFAvailabilityExplanation() +QString QgsAbstractGeospatialPdfExporter::geospatialPDFAvailabilityExplanation() { // test if GDAL has read support in PDF driver GDALDriverH hDriverMem = GDALGetDriverByName( "PDF" ); @@ -69,10 +69,10 @@ QString QgsAbstractGeoPdfExporter::geoPDFAvailabilityExplanation() if ( pHavePdfium && strstr( pHavePdfium, "YES" ) ) return QString(); - return QObject::tr( "GDAL PDF driver was not built with PDF read support. A build with PDF read support is required for GeoPDF creation." ); + return QObject::tr( "GDAL PDF driver was not built with PDF read support. A build with PDF read support is required for geospatial PDF creation." ); } -bool QgsAbstractGeoPdfExporter::finalize( const QList &components, const QString &destinationFile, const ExportDetails &details ) +bool QgsAbstractGeospatialPdfExporter::finalize( const QList &components, const QString &destinationFile, const ExportDetails &details ) { if ( details.includeFeatures && !saveTemporaryLayers() ) return false; @@ -102,7 +102,7 @@ bool QgsAbstractGeoPdfExporter::finalize( const QList &com } else { - mErrorMessage = QObject::tr( "Could not create GeoPDF composition file" ); + mErrorMessage = QObject::tr( "Could not create geospatial PDF composition file" ); return false; } @@ -118,12 +118,12 @@ bool QgsAbstractGeoPdfExporter::finalize( const QList &com return res; } -QString QgsAbstractGeoPdfExporter::generateTemporaryFilepath( const QString &filename ) const +QString QgsAbstractGeospatialPdfExporter::generateTemporaryFilepath( const QString &filename ) const { return mTemporaryDir.filePath( QgsFileUtils::stringToSafeFilename( filename ) ); } -bool QgsAbstractGeoPdfExporter::compositionModeSupported( QPainter::CompositionMode mode ) +bool QgsAbstractGeospatialPdfExporter::compositionModeSupported( QPainter::CompositionMode mode ) { switch ( mode ) { @@ -148,7 +148,7 @@ bool QgsAbstractGeoPdfExporter::compositionModeSupported( QPainter::CompositionM return false; } -void QgsAbstractGeoPdfExporter::pushRenderedFeature( const QString &layerId, const QgsAbstractGeoPdfExporter::RenderedFeature &feature, const QString &group ) +void QgsAbstractGeospatialPdfExporter::pushRenderedFeature( const QString &layerId, const QgsAbstractGeospatialPdfExporter::RenderedFeature &feature, const QString &group ) { // because map layers may be rendered in parallel, we need a mutex here QMutexLocker locker( &mMutex ); @@ -159,7 +159,7 @@ void QgsAbstractGeoPdfExporter::pushRenderedFeature( const QString &layerId, con mCollatedFeatures[ group ][ layerId ].append( f ); } -bool QgsAbstractGeoPdfExporter::saveTemporaryLayers() +bool QgsAbstractGeospatialPdfExporter::saveTemporaryLayers() { for ( auto groupIt = mCollatedFeatures.constBegin(); groupIt != mCollatedFeatures.constEnd(); ++groupIt ) { @@ -201,7 +201,7 @@ bool QgsAbstractGeoPdfExporter::saveTemporaryLayers() return true; } -QString QgsAbstractGeoPdfExporter::createCompositionXml( const QList &components, const ExportDetails &details ) +QString QgsAbstractGeospatialPdfExporter::createCompositionXml( const QList &components, const ExportDetails &details ) { QDomDocument doc; @@ -411,7 +411,7 @@ QString QgsAbstractGeoPdfExporter::createCompositionXml( const QList controlPoints; + QList< QgsAbstractGeospatialPdfExporter::ControlPoint > controlPoints; }; @@ -193,7 +193,7 @@ class CORE_EXPORT QgsAbstractGeoPdfExporter * The optional \a group argument can be used to differentiate features from the same layer exported * multiple times as part of different layer groups. */ - void pushRenderedFeature( const QString &layerId, const QgsAbstractGeoPdfExporter::RenderedFeature &feature, const QString &group = QString() ); + void pushRenderedFeature( const QString &layerId, const QgsAbstractGeospatialPdfExporter::RenderedFeature &feature, const QString &group = QString() ); struct ExportDetails { @@ -204,7 +204,7 @@ class CORE_EXPORT QgsAbstractGeoPdfExporter double dpi = 300; //! List of georeferenced sections - QList< QgsAbstractGeoPdfExporter::GeoReferencedSection > georeferencedSections; + QList< QgsAbstractGeospatialPdfExporter::GeoReferencedSection > georeferencedSections; //! Metadata author tag QString author; @@ -239,8 +239,8 @@ class CORE_EXPORT QgsAbstractGeoPdfExporter /** * TRUE if OGC "best practice" format georeferencing should be used. * - * \warning This results in GeoPDF files compatible with the TerraGo suite of tools, but - * can break compatibility with the built-in Acrobat geospatial tools (yes, GeoPDF + * \warning This results in Geospatial PDF files compatible with a unnamed suite of tools starting with Terra and ending with Go, but + * can break compatibility with the built-in Acrobat geospatial tools (yes, Geospatial PDF * format is a mess!). */ bool useOgcBestPracticeFormatGeoreferencing = false; @@ -278,9 +278,9 @@ class CORE_EXPORT QgsAbstractGeoPdfExporter QMap< QString, bool > initialLayerVisibility; /** - * Optional list of layer IDs, in the order desired to appear in the generated GeoPDF file. + * Optional list of layer IDs, in the order desired to appear in the generated Geospatial PDF file. * - * Layers appearing earlier in the list will show earlier in the GeoPDF layer tree list. + * Layers appearing earlier in the list will show earlier in the Geospatial PDF layer tree list. * * \since QGIS 3.14 */ @@ -295,13 +295,13 @@ class CORE_EXPORT QgsAbstractGeoPdfExporter * argument gives a list of additional layers to include in the generated PDF file. These must have already * been created, e.g. as a result of rendering layers to separate PDF source files. * - * Any features previously collected by calls to pushRenderedFeature() will be included automatically in the GeoPDF + * Any features previously collected by calls to pushRenderedFeature() will be included automatically in the Geospatial PDF * export. * * Returns TRUE if the operation was successful, or FALSE if an error occurred. If an error occurred, it * can be retrieved by calling errorMessage(). */ - bool finalize( const QList< QgsAbstractGeoPdfExporter::ComponentLayerDetail > &components, const QString &destinationFile, const ExportDetails &details ); + bool finalize( const QList< QgsAbstractGeospatialPdfExporter::ComponentLayerDetail > &components, const QString &destinationFile, const ExportDetails &details ); /** * Returns the last error message encountered during the export. @@ -309,13 +309,13 @@ class CORE_EXPORT QgsAbstractGeoPdfExporter QString errorMessage() const { return mErrorMessage; } /** - * Returns a file path to use for temporary files required for GeoPDF creation. + * Returns a file path to use for temporary files required for Geospatial PDF creation. */ QString generateTemporaryFilepath( const QString &filename ) const; /** * Returns TRUE if the specified composition \a mode is supported for layers - * during GeoPDF exports. + * during Geospatial PDF exports. * * \since QGIS 3.14 */ @@ -324,7 +324,7 @@ class CORE_EXPORT QgsAbstractGeoPdfExporter protected: /** - * Contains information relating to a single PDF layer in the GeoPDF export. + * Contains information relating to a single PDF layer in the Geospatial PDF export. */ struct VectorComponentDetail { @@ -366,15 +366,15 @@ class CORE_EXPORT QgsAbstractGeoPdfExporter bool saveTemporaryLayers(); - QString createCompositionXml( const QList< QgsAbstractGeoPdfExporter::ComponentLayerDetail > &components, const ExportDetails &details ); + QString createCompositionXml( const QList< QgsAbstractGeospatialPdfExporter::ComponentLayerDetail > &components, const ExportDetails &details ); /** * Returns the GDAL string representation of the specified QPainter composition \a mode. */ static QString compositionModeToString( QPainter::CompositionMode mode ); - friend class TestQgsLayoutGeoPdfExport; - friend class TestQgsGeoPdfExport; + friend class TestQgsLayoutGeospatialPdfExport; + friend class TestQgsGeospatialPdfExport; }; #endif //QGSABSTRACTGEOPDFEXPORTER_H diff --git a/src/core/qgsmapsettingsutils.cpp b/src/core/qgsmapsettingsutils.cpp index d0f281ded777..0715e6f6a37f 100644 --- a/src/core/qgsmapsettingsutils.cpp +++ b/src/core/qgsmapsettingsutils.cpp @@ -39,7 +39,7 @@ QStringList QgsMapSettingsUtils::containsAdvancedEffects( const QgsMapSettings & { if ( flags & EffectsCheckFlag::IgnoreGeoPdfSupportedEffects ) { - layerHasAdvancedBlendMode = !QgsAbstractGeoPdfExporter::compositionModeSupported( layer->blendMode() ); + layerHasAdvancedBlendMode = !QgsAbstractGeospatialPdfExporter::compositionModeSupported( layer->blendMode() ); } else { diff --git a/src/core/qgsmapsettingsutils.h b/src/core/qgsmapsettingsutils.h index 2e836ba3412a..3958d17c93ea 100644 --- a/src/core/qgsmapsettingsutils.h +++ b/src/core/qgsmapsettingsutils.h @@ -40,7 +40,7 @@ class CORE_EXPORT QgsMapSettingsUtils */ enum class EffectsCheckFlag { - IgnoreGeoPdfSupportedEffects = 1 << 0, //!< Ignore advanced effects which are supported in GeoPDF exports + IgnoreGeoPdfSupportedEffects = 1 << 0, //!< Ignore advanced effects which are supported in geospatial PDF exports }; Q_DECLARE_FLAGS( EffectsCheckFlags, EffectsCheckFlag ) diff --git a/src/gui/layout/qgsgeopdflayertreemodel.cpp b/src/gui/layout/qgsgeopdflayertreemodel.cpp index e8783ef0fe77..a48e44501a18 100644 --- a/src/gui/layout/qgsgeopdflayertreemodel.cpp +++ b/src/gui/layout/qgsgeopdflayertreemodel.cpp @@ -22,19 +22,19 @@ #include "qgsvectorlayer.h" #include "qgsapplication.h" -QgsGeoPdfLayerTreeModel::QgsGeoPdfLayerTreeModel( const QList &layers, QObject *parent ) +QgsGeospatialPdfLayerTreeModel::QgsGeospatialPdfLayerTreeModel( const QList &layers, QObject *parent ) : QgsMapLayerModel( layers, parent ) { setItemsCanBeReordered( true ); } -int QgsGeoPdfLayerTreeModel::columnCount( const QModelIndex &parent ) const +int QgsGeospatialPdfLayerTreeModel::columnCount( const QModelIndex &parent ) const { Q_UNUSED( parent ) return 4; } -Qt::ItemFlags QgsGeoPdfLayerTreeModel::flags( const QModelIndex &idx ) const +Qt::ItemFlags QgsGeospatialPdfLayerTreeModel::flags( const QModelIndex &idx ) const { if ( !idx.isValid() ) return Qt::ItemIsDropEnabled; @@ -58,17 +58,17 @@ Qt::ItemFlags QgsGeoPdfLayerTreeModel::flags( const QModelIndex &idx ) const return Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsDragEnabled; } -QgsMapLayer *QgsGeoPdfLayerTreeModel::mapLayer( const QModelIndex &idx ) const +QgsMapLayer *QgsGeospatialPdfLayerTreeModel::mapLayer( const QModelIndex &idx ) const { return layerFromIndex( index( idx.row(), LayerColumn, idx.parent() ) ); } -QgsVectorLayer *QgsGeoPdfLayerTreeModel::vectorLayer( const QModelIndex &idx ) const +QgsVectorLayer *QgsGeospatialPdfLayerTreeModel::vectorLayer( const QModelIndex &idx ) const { return qobject_cast( mapLayer( idx ) ); } -QVariant QgsGeoPdfLayerTreeModel::headerData( int section, Qt::Orientation orientation, int role ) const +QVariant QgsGeospatialPdfLayerTreeModel::headerData( int section, Qt::Orientation orientation, int role ) const { if ( orientation == Qt::Horizontal ) { @@ -92,7 +92,7 @@ QVariant QgsGeoPdfLayerTreeModel::headerData( int section, Qt::Orientation orien return QgsMapLayerModel::headerData( section, orientation, role ); } -QVariant QgsGeoPdfLayerTreeModel::data( const QModelIndex &idx, int role ) const +QVariant QgsGeospatialPdfLayerTreeModel::data( const QModelIndex &idx, int role ) const { switch ( idx.column() ) { @@ -167,7 +167,7 @@ QVariant QgsGeoPdfLayerTreeModel::data( const QModelIndex &idx, int role ) const return QVariant(); } -bool QgsGeoPdfLayerTreeModel::setData( const QModelIndex &index, const QVariant &value, int role ) +bool QgsGeospatialPdfLayerTreeModel::setData( const QModelIndex &index, const QVariant &value, int role ) { switch ( index.column() ) { @@ -219,7 +219,7 @@ bool QgsGeoPdfLayerTreeModel::setData( const QModelIndex &index, const QVariant return false; } -void QgsGeoPdfLayerTreeModel::checkAll( bool checked, const QModelIndex &parent, int column ) +void QgsGeospatialPdfLayerTreeModel::checkAll( bool checked, const QModelIndex &parent, int column ) { for ( int row = 0; row < rowCount( parent ); ++row ) { @@ -231,14 +231,14 @@ void QgsGeoPdfLayerTreeModel::checkAll( bool checked, const QModelIndex &parent, ///@cond PRIVATE -QgsGeoPdfLayerFilteredTreeModel::QgsGeoPdfLayerFilteredTreeModel( QgsGeoPdfLayerTreeModel *sourceModel, QObject *parent ) +QgsGeospatialPdfLayerFilteredTreeModel::QgsGeospatialPdfLayerFilteredTreeModel( QgsGeospatialPdfLayerTreeModel *sourceModel, QObject *parent ) : QSortFilterProxyModel( parent ) , mLayerTreeModel( sourceModel ) { setSourceModel( sourceModel ); } -bool QgsGeoPdfLayerFilteredTreeModel::filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const +bool QgsGeospatialPdfLayerFilteredTreeModel::filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const { if ( QgsMapLayer *layer = mLayerTreeModel->layerFromIndex( sourceModel()->index( source_row, 0, source_parent ) ) ) { diff --git a/src/gui/layout/qgsgeopdflayertreemodel.h b/src/gui/layout/qgsgeopdflayertreemodel.h index e47d6ff44744..65ca175d3200 100644 --- a/src/gui/layout/qgsgeopdflayertreemodel.h +++ b/src/gui/layout/qgsgeopdflayertreemodel.h @@ -36,7 +36,7 @@ class QgsVectorLayer; * \note This class is not a part of public API * \since QGIS 3.12 */ -class GUI_EXPORT QgsGeoPdfLayerTreeModel : public QgsMapLayerModel +class GUI_EXPORT QgsGeospatialPdfLayerTreeModel : public QgsMapLayerModel { Q_OBJECT @@ -52,7 +52,7 @@ class GUI_EXPORT QgsGeoPdfLayerTreeModel : public QgsMapLayerModel }; //! constructor - QgsGeoPdfLayerTreeModel( const QList< QgsMapLayer * > &layers, QObject *parent = nullptr ); + QgsGeospatialPdfLayerTreeModel( const QList< QgsMapLayer * > &layers, QObject *parent = nullptr ); int columnCount( const QModelIndex &parent ) const override; QVariant headerData( int section, Qt::Orientation orientation, int role ) const override; @@ -73,17 +73,17 @@ class GUI_EXPORT QgsGeoPdfLayerTreeModel : public QgsMapLayerModel ///@cond PRIVATE -class GUI_EXPORT QgsGeoPdfLayerFilteredTreeModel : public QSortFilterProxyModel +class GUI_EXPORT QgsGeospatialPdfLayerFilteredTreeModel : public QSortFilterProxyModel { Q_OBJECT public: - QgsGeoPdfLayerFilteredTreeModel( QgsGeoPdfLayerTreeModel *sourceModel, QObject *parent = nullptr ); + QgsGeospatialPdfLayerFilteredTreeModel( QgsGeospatialPdfLayerTreeModel *sourceModel, QObject *parent = nullptr ); bool filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const override; private: - QgsGeoPdfLayerTreeModel *mLayerTreeModel = nullptr; + QgsGeospatialPdfLayerTreeModel *mLayerTreeModel = nullptr; }; ///@endcond diff --git a/src/gui/layout/qgslayoutpdfexportoptionsdialog.cpp b/src/gui/layout/qgslayoutpdfexportoptionsdialog.cpp index c94719ef4693..f02ef5171951 100644 --- a/src/gui/layout/qgslayoutpdfexportoptionsdialog.cpp +++ b/src/gui/layout/qgslayoutpdfexportoptionsdialog.cpp @@ -29,34 +29,34 @@ #include #include -QgsLayoutPdfExportOptionsDialog::QgsLayoutPdfExportOptionsDialog( QWidget *parent, bool allowGeoPdfExport, const QString &geoPdfReason, const QStringList &geoPdfLayerOrder, Qt::WindowFlags flags ) +QgsLayoutPdfExportOptionsDialog::QgsLayoutPdfExportOptionsDialog( QWidget *parent, bool allowGeospatialPdfExport, const QString &geospatialPdfReason, const QStringList &geospatialPdfLayerOrder, Qt::WindowFlags flags ) : QDialog( parent, flags ) { setupUi( this ); - mGeoPdfStructureTreeMenu = new QMenu( this ); + mGeospatialPdfStructureTreeMenu = new QMenu( this ); mTextRenderFormatComboBox->addItem( tr( "Always Export Text as Paths (Recommended)" ), static_cast< int >( Qgis::TextRenderFormat::AlwaysOutlines ) ); mTextRenderFormatComboBox->addItem( tr( "Always Export Text as Text Objects" ), static_cast< int >( Qgis::TextRenderFormat::AlwaysText ) ); - mGeopdfAvailable = allowGeoPdfExport && QgsAbstractGeoPdfExporter::geoPDFCreationAvailable(); - mGeoPDFGroupBox->setEnabled( mGeopdfAvailable ); - mGeoPDFGroupBox->setChecked( false ); - if ( !mGeopdfAvailable ) + mGeospatialPdfAvailable = allowGeospatialPdfExport && QgsAbstractGeospatialPdfExporter::geospatialPDFCreationAvailable(); + mGeospatialPDFGroupBox->setEnabled( mGeospatialPdfAvailable ); + mGeospatialPDFGroupBox->setChecked( false ); + if ( !mGeospatialPdfAvailable ) { - mGeoPDFOptionsStackedWidget->setCurrentIndex( 0 ); - mGeoPdfUnavailableReason->setText( geoPdfReason.isEmpty() ? QgsAbstractGeoPdfExporter::geoPDFAvailabilityExplanation() : geoPdfReason ); + mGeospatialPDFOptionsStackedWidget->setCurrentIndex( 0 ); + mGeospatialPdfUnavailableReason->setText( geospatialPdfReason.isEmpty() ? QgsAbstractGeospatialPdfExporter::geospatialPDFAvailabilityExplanation() : geospatialPdfReason ); // avoid showing reason in disabled text color - we want it to stand out - QPalette p = mGeoPdfUnavailableReason->palette(); + QPalette p = mGeospatialPdfUnavailableReason->palette(); p.setColor( QPalette::Disabled, QPalette::WindowText, QPalette::WindowText ); - mGeoPdfUnavailableReason->setPalette( p ); - mGeoPDFOptionsStackedWidget->removeWidget( mGeoPDFOptionsStackedWidget->widget( 1 ) ); + mGeospatialPdfUnavailableReason->setPalette( p ); + mGeospatialPDFOptionsStackedWidget->removeWidget( mGeospatialPDFOptionsStackedWidget->widget( 1 ) ); } else { - mGeoPDFOptionsStackedWidget->setCurrentIndex( 1 ); - mGeoPdfFormatComboBox->addItem( tr( "ISO 32000 Extension (recommended)" ) ); - mGeoPdfFormatComboBox->addItem( tr( "OGC Best Practice" ) ); + mGeospatialPDFOptionsStackedWidget->setCurrentIndex( 1 ); + mGeospatialPdfFormatComboBox->addItem( tr( "ISO 32000 Extension (recommended)" ) ); + mGeospatialPdfFormatComboBox->addItem( tr( "OGC Best Practice" ) ); } mComboImageCompression->addItem( tr( "Lossy (JPEG)" ), false ); @@ -72,7 +72,7 @@ QgsLayoutPdfExportOptionsDialog::QgsLayoutPdfExportOptionsDialog( QWidget *paren } QList< QgsMapLayer * > order = QgsProject::instance()->layerTreeRoot()->layerOrder(); - for ( auto it = geoPdfLayerOrder.rbegin(); it != geoPdfLayerOrder.rend(); ++it ) + for ( auto it = geospatialPdfLayerOrder.rbegin(); it != geospatialPdfLayerOrder.rend(); ++it ) { for ( int i = 0; i < order.size(); ++i ) { @@ -83,25 +83,25 @@ QgsLayoutPdfExportOptionsDialog::QgsLayoutPdfExportOptionsDialog( QWidget *paren } } } - mGeoPdfStructureModel = new QgsGeoPdfLayerTreeModel( order, this ); - mGeoPdfStructureProxyModel = new QgsGeoPdfLayerFilteredTreeModel( mGeoPdfStructureModel, this ); - mGeoPdfStructureTree->setModel( mGeoPdfStructureProxyModel ); - mGeoPdfStructureTree->resizeColumnToContents( 0 ); - mGeoPdfStructureTree->header()->show(); - mGeoPdfStructureTree->setSelectionMode( QAbstractItemView::SingleSelection ); - mGeoPdfStructureTree->setSelectionBehavior( QAbstractItemView::SelectRows ); - - mGeoPdfStructureTree->setDragEnabled( true ); - mGeoPdfStructureTree->setAcceptDrops( true ); - mGeoPdfStructureTree->setDragDropMode( QAbstractItemView::InternalMove ); - mGeoPdfStructureTree->setDefaultDropAction( Qt::MoveAction ); - - mGeoPdfStructureTree->setContextMenuPolicy( Qt::CustomContextMenu ); - connect( mGeoPdfStructureTree, &QTreeView::customContextMenuRequested, this, [ = ]( const QPoint & point ) + mGeospatialPdfStructureModel = new QgsGeospatialPdfLayerTreeModel( order, this ); + mGeospatialPdfStructureProxyModel = new QgsGeospatialPdfLayerFilteredTreeModel( mGeospatialPdfStructureModel, this ); + mGeospatialPdfStructureTree->setModel( mGeospatialPdfStructureProxyModel ); + mGeospatialPdfStructureTree->resizeColumnToContents( 0 ); + mGeospatialPdfStructureTree->header()->show(); + mGeospatialPdfStructureTree->setSelectionMode( QAbstractItemView::SingleSelection ); + mGeospatialPdfStructureTree->setSelectionBehavior( QAbstractItemView::SelectRows ); + + mGeospatialPdfStructureTree->setDragEnabled( true ); + mGeospatialPdfStructureTree->setAcceptDrops( true ); + mGeospatialPdfStructureTree->setDragDropMode( QAbstractItemView::InternalMove ); + mGeospatialPdfStructureTree->setDefaultDropAction( Qt::MoveAction ); + + mGeospatialPdfStructureTree->setContextMenuPolicy( Qt::CustomContextMenu ); + connect( mGeospatialPdfStructureTree, &QTreeView::customContextMenuRequested, this, [ = ]( const QPoint & point ) { - const QModelIndex index = mGeoPdfStructureTree->indexAt( point ); + const QModelIndex index = mGeospatialPdfStructureTree->indexAt( point ); if ( index.isValid() ) - showContextMenuForGeoPdfStructure( point, mGeoPdfStructureProxyModel->mapToSource( index ) ); + showContextMenuForGeospatialPdfStructure( point, mGeospatialPdfStructureProxyModel->mapToSource( index ) ); } ); connect( mHelpButtonBox, &QDialogButtonBox::helpRequested, this, &QgsLayoutPdfExportOptionsDialog::showHelp ); @@ -183,45 +183,45 @@ bool QgsLayoutPdfExportOptionsDialog::losslessImageExport() const return mComboImageCompression->currentData().toBool(); } -void QgsLayoutPdfExportOptionsDialog::setExportGeoPdf( bool enabled ) +void QgsLayoutPdfExportOptionsDialog::setExportGeospatialPdf( bool enabled ) { - if ( !mGeopdfAvailable ) + if ( !mGeospatialPdfAvailable ) return; - mGeoPDFGroupBox->setChecked( enabled ); + mGeospatialPDFGroupBox->setChecked( enabled ); } -bool QgsLayoutPdfExportOptionsDialog::exportGeoPdf() const +bool QgsLayoutPdfExportOptionsDialog::exportGeospatialPdf() const { - if ( !mGeopdfAvailable ) + if ( !mGeospatialPdfAvailable ) return false; - return mGeoPDFGroupBox->isChecked(); + return mGeospatialPDFGroupBox->isChecked(); } void QgsLayoutPdfExportOptionsDialog::setUseOgcBestPracticeFormat( bool enabled ) { - if ( !mGeopdfAvailable ) + if ( !mGeospatialPdfAvailable ) return; if ( enabled ) - mGeoPdfFormatComboBox->setCurrentIndex( 1 ); + mGeospatialPdfFormatComboBox->setCurrentIndex( 1 ); else - mGeoPdfFormatComboBox->setCurrentIndex( 0 ); + mGeospatialPdfFormatComboBox->setCurrentIndex( 0 ); } bool QgsLayoutPdfExportOptionsDialog::useOgcBestPracticeFormat() const { - if ( !mGeopdfAvailable ) + if ( !mGeospatialPdfAvailable ) return false; - return mGeoPdfFormatComboBox->currentIndex() == 1; + return mGeospatialPdfFormatComboBox->currentIndex() == 1; } void QgsLayoutPdfExportOptionsDialog::setExportThemes( const QStringList &themes ) { - if ( !mGeopdfAvailable ) + if ( !mGeospatialPdfAvailable ) return; mIncludeMapThemesCheck->setChecked( !themes.isEmpty() ); @@ -235,7 +235,7 @@ void QgsLayoutPdfExportOptionsDialog::setExportThemes( const QStringList &themes QStringList QgsLayoutPdfExportOptionsDialog::exportThemes() const { QStringList res; - if ( !mGeopdfAvailable ) + if ( !mGeospatialPdfAvailable ) return res; if ( !mIncludeMapThemesCheck || !mIncludeMapThemesCheck->isChecked() ) @@ -251,12 +251,12 @@ QStringList QgsLayoutPdfExportOptionsDialog::exportThemes() const return res; } -QStringList QgsLayoutPdfExportOptionsDialog::geoPdfLayerOrder() const +QStringList QgsLayoutPdfExportOptionsDialog::geospatialPdfLayerOrder() const { QStringList order; - for ( int row = 0; row < mGeoPdfStructureProxyModel->rowCount(); ++row ) + for ( int row = 0; row < mGeospatialPdfStructureProxyModel->rowCount(); ++row ) { - order << mGeoPdfStructureProxyModel->data( mGeoPdfStructureProxyModel->index( row, 0 ), QgsGeoPdfLayerTreeModel::LayerIdRole ).toString(); + order << mGeospatialPdfStructureProxyModel->data( mGeospatialPdfStructureProxyModel->index( row, 0 ), QgsGeospatialPdfLayerTreeModel::LayerIdRole ).toString(); } return order; } @@ -276,26 +276,26 @@ void QgsLayoutPdfExportOptionsDialog::showHelp() QgsHelp::openHelp( QStringLiteral( "print_composer/create_output.html" ) ); } -void QgsLayoutPdfExportOptionsDialog::showContextMenuForGeoPdfStructure( QPoint point, const QModelIndex &index ) +void QgsLayoutPdfExportOptionsDialog::showContextMenuForGeospatialPdfStructure( QPoint point, const QModelIndex &index ) { - mGeoPdfStructureTreeMenu->clear(); + mGeospatialPdfStructureTreeMenu->clear(); switch ( index.column() ) { - case QgsGeoPdfLayerTreeModel::IncludeVectorAttributes: - case QgsGeoPdfLayerTreeModel::InitiallyVisible: + case QgsGeospatialPdfLayerTreeModel::IncludeVectorAttributes: + case QgsGeospatialPdfLayerTreeModel::InitiallyVisible: { - QAction *selectAll = new QAction( tr( "Select All" ), mGeoPdfStructureTreeMenu ); - mGeoPdfStructureTreeMenu->addAction( selectAll ); + QAction *selectAll = new QAction( tr( "Select All" ), mGeospatialPdfStructureTreeMenu ); + mGeospatialPdfStructureTreeMenu->addAction( selectAll ); connect( selectAll, &QAction::triggered, this, [ = ] { - mGeoPdfStructureModel->checkAll( true, QModelIndex(), index.column() ); + mGeospatialPdfStructureModel->checkAll( true, QModelIndex(), index.column() ); } ); - QAction *deselectAll = new QAction( tr( "Deselect All" ), mGeoPdfStructureTreeMenu ); - mGeoPdfStructureTreeMenu->addAction( deselectAll ); + QAction *deselectAll = new QAction( tr( "Deselect All" ), mGeospatialPdfStructureTreeMenu ); + mGeospatialPdfStructureTreeMenu->addAction( deselectAll ); connect( deselectAll, &QAction::triggered, this, [ = ] { - mGeoPdfStructureModel->checkAll( false, QModelIndex(), index.column() ); + mGeospatialPdfStructureModel->checkAll( false, QModelIndex(), index.column() ); } ); break; } @@ -304,8 +304,8 @@ void QgsLayoutPdfExportOptionsDialog::showContextMenuForGeoPdfStructure( QPoint break; } - if ( !mGeoPdfStructureTreeMenu->actions().empty() ) + if ( !mGeospatialPdfStructureTreeMenu->actions().empty() ) { - mGeoPdfStructureTreeMenu->exec( mGeoPdfStructureTree->mapToGlobal( point ) ); + mGeospatialPdfStructureTreeMenu->exec( mGeospatialPdfStructureTree->mapToGlobal( point ) ); } } diff --git a/src/gui/layout/qgslayoutpdfexportoptionsdialog.h b/src/gui/layout/qgslayoutpdfexportoptionsdialog.h index b73797e139e0..12289f0d50a6 100644 --- a/src/gui/layout/qgslayoutpdfexportoptionsdialog.h +++ b/src/gui/layout/qgslayoutpdfexportoptionsdialog.h @@ -26,8 +26,8 @@ #include "qgis.h" #include "ui_qgspdfexportoptions.h" -class QgsGeoPdfLayerTreeModel; -class QgsGeoPdfLayerFilteredTreeModel; +class QgsGeospatialPdfLayerTreeModel; +class QgsGeospatialPdfLayerFilteredTreeModel; /** * \ingroup gui @@ -45,16 +45,16 @@ class GUI_EXPORT QgsLayoutPdfExportOptionsDialog: public QDialog, private Ui::Qg /** * Constructor for QgsLayoutPdfExportOptionsDialog * \param parent parent widget - * \param allowGeoPdfExport set to FALSE if geoPdf export is blocked - * \param geoPdfReason set to a descriptive translated string explaining why geopdf export is not available if applicable - * \param geoPdfLayerOrder optional layer ID order list for layers in the geopdf file. Any layers not present in this list - * will instead be appended to the end of the geopdf layer list + * \param allowGeospatialPdfExport set to FALSE if geospatial PDF export is blocked + * \param geospatialPdfReason set to a descriptive translated string explaining why geospatial PDF export is not available if applicable + * \param geospatialPdfLayerOrder optional layer ID order list for layers in the geospatial PDF file. Any layers not present in this list + * will instead be appended to the end of the geospatial PDF layer list * \param flags window flags */ QgsLayoutPdfExportOptionsDialog( QWidget *parent = nullptr, - bool allowGeoPdfExport = true, - const QString &geoPdfReason = QString(), - const QStringList &geoPdfLayerOrder = QStringList(), + bool allowGeospatialPdfExport = true, + const QString &geospatialPdfReason = QString(), + const QStringList &geospatialPdfLayerOrder = QStringList(), Qt::WindowFlags flags = Qt::WindowFlags() ); //! Sets the text render format @@ -89,10 +89,10 @@ class GUI_EXPORT QgsLayoutPdfExportOptionsDialog: public QDialog, private Ui::Qg //! Returns whether lossless image compression is enabled bool losslessImageExport() const; - //! Sets whether to export a Geo-PDF - void setExportGeoPdf( bool enabled ); - //! Returns whether Geo-PDF export is enabled - bool exportGeoPdf() const; + //! Sets whether to export a Geospatial PDF + void setExportGeospatialPdf( bool enabled ); + //! Returns whether Geospatial PDF export is enabled + bool exportGeospatialPdf() const; //! Sets whether to use OGC best-practice format void setUseOgcBestPracticeFormat( bool enabled ); @@ -104,8 +104,8 @@ class GUI_EXPORT QgsLayoutPdfExportOptionsDialog: public QDialog, private Ui::Qg //! Returns the list of export themes QStringList exportThemes() const; - //! Returns a list of map layer IDs in the desired order they should appear in a generated GeoPDF file - QStringList geoPdfLayerOrder() const; + //! Returns a list of map layer IDs in the desired order they should appear in a generated Geospatial PDF file + QStringList geospatialPdfLayerOrder() const; //! Sets whether to open the pdf after exporting it void setOpenAfterExporting( bool enabled ); @@ -115,14 +115,14 @@ class GUI_EXPORT QgsLayoutPdfExportOptionsDialog: public QDialog, private Ui::Qg private slots: void showHelp(); - void showContextMenuForGeoPdfStructure( QPoint point, const QModelIndex &index ); + void showContextMenuForGeospatialPdfStructure( QPoint point, const QModelIndex &index ); private: - bool mGeopdfAvailable = true; - QgsGeoPdfLayerTreeModel *mGeoPdfStructureModel = nullptr; - QgsGeoPdfLayerFilteredTreeModel *mGeoPdfStructureProxyModel = nullptr; - QMenu *mGeoPdfStructureTreeMenu = nullptr; + bool mGeospatialPdfAvailable = true; + QgsGeospatialPdfLayerTreeModel *mGeospatialPdfStructureModel = nullptr; + QgsGeospatialPdfLayerFilteredTreeModel *mGeospatialPdfStructureProxyModel = nullptr; + QMenu *mGeospatialPdfStructureTreeMenu = nullptr; }; diff --git a/src/server/services/wms/qgswmsparameters.cpp b/src/server/services/wms/qgswmsparameters.cpp index 4640748a7e1f..94b685957a09 100644 --- a/src/server/services/wms/qgswmsparameters.cpp +++ b/src/server/services/wms/qgswmsparameters.cpp @@ -2239,15 +2239,15 @@ namespace QgsWms return codec; } - bool QgsWmsParameters::writeGeoPdf() const + bool QgsWmsParameters::writeGeospatialPdf() const { - bool geoPdf = false; + bool geospatialPdf = false; const QMap options = formatOptions(); if ( options.contains( PdfFormatOption::WRITE_GEO_PDF ) ) { - geoPdf = QVariant( options[PdfFormatOption::WRITE_GEO_PDF] ).toBool(); + geospatialPdf = QVariant( options[PdfFormatOption::WRITE_GEO_PDF] ).toBool(); } - return geoPdf; + return geospatialPdf; } bool QgsWmsParameters::pdfForceVectorOutput() const diff --git a/src/server/services/wms/qgswmsparameters.h b/src/server/services/wms/qgswmsparameters.h index cb31d168dda9..c0fc2ba2f0a0 100644 --- a/src/server/services/wms/qgswmsparameters.h +++ b/src/server/services/wms/qgswmsparameters.h @@ -1388,10 +1388,10 @@ namespace QgsWms bool isForce2D() const; /** - * Returns if a GeoPDF shall be exported + * Returns if a geospatial shall be exported * \since QGIS 3.32 */ - bool writeGeoPdf() const; + bool writeGeospatialPdf() const; /** * Returns if pdf should be exported as vector @@ -1448,7 +1448,7 @@ namespace QgsWms bool pdfUseOgcBestPracticeFormatGeoreferencing() const; /** - * Returns map themes for GeoPDF export + * Returns map themes for geospatial PDF export * \since QGIS 3.32 */ QStringList pdfExportMapThemes() const; diff --git a/src/server/services/wms/qgswmsrenderer.cpp b/src/server/services/wms/qgswmsrenderer.cpp index 66f3c9199791..5148a8b796b4 100644 --- a/src/server/services/wms/qgswmsrenderer.cpp +++ b/src/server/services/wms/qgswmsrenderer.cpp @@ -650,7 +650,7 @@ namespace QgsWms { exportSettings.exportThemes = exportThemes; } - exportSettings.writeGeoPdf = mWmsParameters.writeGeoPdf(); + exportSettings.writeGeoPdf = mWmsParameters.writeGeospatialPdf(); exportSettings.textRenderFormat = mWmsParameters.pdfTextRenderFormat(); exportSettings.forceVectorOutput = mWmsParameters.pdfForceVectorOutput(); exportSettings.appendGeoreference = mWmsParameters.pdfAppendGeoreference(); diff --git a/src/ui/layout/qgspdfexportoptions.ui b/src/ui/layout/qgspdfexportoptions.ui index 82255c19bbc6..f7c2da5e9e2f 100644 --- a/src/ui/layout/qgspdfexportoptions.ui +++ b/src/ui/layout/qgspdfexportoptions.ui @@ -104,9 +104,9 @@ - + - Create Geospatial PDF (GeoPDF) + Create Geospatial PDF true @@ -128,7 +128,7 @@ 0 - + 0 @@ -153,7 +153,7 @@ 0 - + @@ -201,10 +201,10 @@ - + - + Layer Structure @@ -215,7 +215,7 @@ - Uncheck layers to avoid exporting vector feature information for those layers, and optionally set the group name to allow multiple layers to be joined into a single logical PDF group. Layers can be dragged and dropped to rearrange their order in the generated GeoPDF table of contents. + Uncheck layers to avoid exporting vector feature information for those layers, and optionally set the group name to allow multiple layers to be joined into a single logical PDF group. Layers can be dragged and dropped to rearrange their order in the generated Geospatial PDF table of contents. true @@ -223,7 +223,7 @@ - + true @@ -358,11 +358,11 @@ mIncludeMetadataCheckbox mTextRenderFormatComboBox mComboImageCompression - mGeoPDFGroupBox - mGeoPdfFormatComboBox + mGeospatialPDFGroupBox + mGeospatialPdfFormatComboBox mIncludeMapThemesCheck mThemesList - mGeoPdfStructureTree + mGeospatialPdfStructureTree mSimplifyGeometriesCheckbox mDisableRasterTilingCheckBox diff --git a/src/ui/qgsmapsavedialog.ui b/src/ui/qgsmapsavedialog.ui index 4f5fb1e41205..3a329c2d099a 100644 --- a/src/ui/qgsmapsavedialog.ui +++ b/src/ui/qgsmapsavedialog.ui @@ -57,9 +57,9 @@ - + - Create Geospatial PDF (GeoPDF) + Create Geospatial PDF true @@ -69,7 +69,7 @@ - + 1 @@ -88,7 +88,7 @@ 0 - + @@ -111,7 +111,7 @@ 0 - + @@ -121,7 +121,7 @@ - + Include vector feature information @@ -412,9 +412,9 @@ Rasterizing the map is recommended when such effects are used. mDrawAnnotations mSaveWorldFile mExportMetadataCheckBox - mGeoPDFGroupBox - mGeoPdfFormatComboBox - mExportGeoPdfFeaturesCheckBox + mGeospatialPDFGroupBox + mGeospatialPdfFormatComboBox + mExportGeospatialPdfFeaturesCheckBox mSaveAsRaster mSimplifyGeometriesCheckbox mTextRenderFormatComboBox diff --git a/tests/src/core/testqgsgeopdfexport.cpp b/tests/src/core/testqgsgeopdfexport.cpp index e2b06e63619a..6afd977f67d2 100644 --- a/tests/src/core/testqgsgeopdfexport.cpp +++ b/tests/src/core/testqgsgeopdfexport.cpp @@ -21,7 +21,7 @@ #include #include "qgstest.h" -class TestGeoPdfExporter : public QgsAbstractGeoPdfExporter +class TestGeospatialPdfExporter : public QgsAbstractGeospatialPdfExporter { private: @@ -38,12 +38,12 @@ class TestGeoPdfExporter : public QgsAbstractGeoPdfExporter }; -class TestQgsGeoPdfExport : public QgsTest +class TestQgsGeospatialPdfExport : public QgsTest { Q_OBJECT public: - TestQgsGeoPdfExport() : QgsTest( QStringLiteral( "GeoPDF Export Testss" ) ) {} + TestQgsGeospatialPdfExport() : QgsTest( QStringLiteral( "Geospatial PDF Export Testss" ) ) {} private slots: void initTestCase();// will be called before the first testfunction is executed. @@ -58,28 +58,28 @@ class TestQgsGeoPdfExport : public QgsTest void compositionMode(); }; -void TestQgsGeoPdfExport::initTestCase() +void TestQgsGeospatialPdfExport::initTestCase() { QgsApplication::init(); QgsApplication::initQgis(); } -void TestQgsGeoPdfExport::cleanupTestCase() +void TestQgsGeospatialPdfExport::cleanupTestCase() { QgsApplication::exitQgis(); } -void TestQgsGeoPdfExport::testCollectingFeatures() +void TestQgsGeospatialPdfExport::testCollectingFeatures() { - if ( !QgsAbstractGeoPdfExporter::geoPDFCreationAvailable() ) + if ( !QgsAbstractGeospatialPdfExporter::geospatialPDFCreationAvailable() ) { - QSKIP( "This test requires GeoPDF creation abilities", SkipSingle ); + QSKIP( "This test requires geospatial PDF creation abilities", SkipSingle ); } - TestGeoPdfExporter geoPdfExporter; + TestGeospatialPdfExporter geospatialPdfExporter; // no features, no crash - QVERIFY( geoPdfExporter.saveTemporaryLayers() ); - QCOMPARE( geoPdfExporter.mVectorComponents.count(), 0 ); + QVERIFY( geospatialPdfExporter.saveTemporaryLayers() ); + QCOMPARE( geospatialPdfExporter.mVectorComponents.count(), 0 ); QgsFields fields; fields.append( QgsField( QStringLiteral( "a1" ), QVariant::Int ) ); @@ -89,20 +89,20 @@ void TestQgsGeoPdfExport::testCollectingFeatures() f.setAttributes( QgsAttributes() << 1 << 2 ); f.setGeometry( QgsGeometry( new QgsPoint( 1, 2 ) ) ); QgsGeometry renderedBounds( QgsGeometry::fromRect( QgsRectangle( 1, 10, 6, 20 ) ) ); - geoPdfExporter.pushRenderedFeature( QStringLiteral( "layer1" ), QgsAbstractGeoPdfExporter::RenderedFeature( f, renderedBounds ) ); + geospatialPdfExporter.pushRenderedFeature( QStringLiteral( "layer1" ), QgsAbstractGeospatialPdfExporter::RenderedFeature( f, renderedBounds ) ); f.setAttributes( QgsAttributes() << 11 << 22 ); f.setGeometry( QgsGeometry( new QgsPoint( 3, 4 ) ) ); renderedBounds = QgsGeometry::fromRect( QgsRectangle( 2, 10, 7, 20 ) ); - geoPdfExporter.pushRenderedFeature( QStringLiteral( "layer1" ), QgsAbstractGeoPdfExporter::RenderedFeature( f, renderedBounds ) ); + geospatialPdfExporter.pushRenderedFeature( QStringLiteral( "layer1" ), QgsAbstractGeospatialPdfExporter::RenderedFeature( f, renderedBounds ) ); f.setAttributes( QgsAttributes() << 31 << 32 ); f.setGeometry( QgsGeometry( new QgsPoint( 4, 5 ) ) ); renderedBounds = QgsGeometry::fromWkt( QStringLiteral( "LineString(1 1, 2 2)" ) ); - geoPdfExporter.pushRenderedFeature( QStringLiteral( "layer2" ), QgsAbstractGeoPdfExporter::RenderedFeature( f, renderedBounds ) ); + geospatialPdfExporter.pushRenderedFeature( QStringLiteral( "layer2" ), QgsAbstractGeospatialPdfExporter::RenderedFeature( f, renderedBounds ) ); - QVERIFY( geoPdfExporter.saveTemporaryLayers() ); - QCOMPARE( geoPdfExporter.mVectorComponents.count(), 2 ); - QgsAbstractGeoPdfExporter::VectorComponentDetail component; - for ( const auto &it : std::as_const( geoPdfExporter.mVectorComponents ) ) + QVERIFY( geospatialPdfExporter.saveTemporaryLayers() ); + QCOMPARE( geospatialPdfExporter.mVectorComponents.count(), 2 ); + QgsAbstractGeospatialPdfExporter::VectorComponentDetail component; + for ( const auto &it : std::as_const( geospatialPdfExporter.mVectorComponents ) ) { if ( it.mapLayerId == QLatin1String( "layer1" ) ) { @@ -129,7 +129,7 @@ void TestQgsGeoPdfExport::testCollectingFeatures() QCOMPARE( f.attributes().at( 2 ).toInt(), 22 ); QCOMPARE( f.geometry().asWkt(), QStringLiteral( "Polygon ((2 10, 7 10, 7 20, 2 20, 2 10))" ) ); - for ( const auto &it : std::as_const( geoPdfExporter.mVectorComponents ) ) + for ( const auto &it : std::as_const( geospatialPdfExporter.mVectorComponents ) ) { if ( it.mapLayerId == QLatin1String( "layer2" ) ) { @@ -152,12 +152,12 @@ void TestQgsGeoPdfExport::testCollectingFeatures() QCOMPARE( f.geometry().asWkt(), QStringLiteral( "LineString (1 1, 2 2)" ) ); } -void TestQgsGeoPdfExport::testComposition() +void TestQgsGeospatialPdfExport::testComposition() { - TestGeoPdfExporter geoPdfExporter; + TestGeospatialPdfExporter geospatialPdfExporter; // no features, no crash - QVERIFY( geoPdfExporter.saveTemporaryLayers() ); - QCOMPARE( geoPdfExporter.mVectorComponents.count(), 0 ); + QVERIFY( geospatialPdfExporter.saveTemporaryLayers() ); + QCOMPARE( geospatialPdfExporter.mVectorComponents.count(), 0 ); QgsFields fields; fields.append( QgsField( QStringLiteral( "a1" ), QVariant::Int ) ); @@ -167,20 +167,20 @@ void TestQgsGeoPdfExport::testComposition() f.setAttributes( QgsAttributes() << 1 << 2 ); f.setGeometry( QgsGeometry( new QgsPoint( 1, 2 ) ) ); QgsGeometry renderedBounds( QgsGeometry::fromRect( QgsRectangle( 1, 10, 6, 20 ) ) ); - geoPdfExporter.pushRenderedFeature( QStringLiteral( "layer1" ), QgsAbstractGeoPdfExporter::RenderedFeature( f, renderedBounds ) ); + geospatialPdfExporter.pushRenderedFeature( QStringLiteral( "layer1" ), QgsAbstractGeospatialPdfExporter::RenderedFeature( f, renderedBounds ) ); f.setAttributes( QgsAttributes() << 31 << 32 ); f.setGeometry( QgsGeometry( new QgsPoint( 4, 5 ) ) ); renderedBounds = QgsGeometry::fromWkt( QStringLiteral( "LineString(1 1, 2 2)" ) ); - geoPdfExporter.pushRenderedFeature( QStringLiteral( "layer2" ), QgsAbstractGeoPdfExporter::RenderedFeature( f, renderedBounds ) ); + geospatialPdfExporter.pushRenderedFeature( QStringLiteral( "layer2" ), QgsAbstractGeospatialPdfExporter::RenderedFeature( f, renderedBounds ) ); - QVERIFY( geoPdfExporter.saveTemporaryLayers() ); - QgsAbstractGeoPdfExporter::VectorComponentDetail component; + QVERIFY( geospatialPdfExporter.saveTemporaryLayers() ); + QgsAbstractGeospatialPdfExporter::VectorComponentDetail component; QString layer1Path; QString layer1Layer; QString layer2Path; QString layer2Layer; - for ( const auto &it : std::as_const( geoPdfExporter.mVectorComponents ) ) + for ( const auto &it : std::as_const( geospatialPdfExporter.mVectorComponents ) ) { if ( it.mapLayerId == QLatin1String( "layer1" ) ) { @@ -195,20 +195,20 @@ void TestQgsGeoPdfExport::testComposition() } // test creation of the composition xml - QList< QgsAbstractGeoPdfExporter::ComponentLayerDetail > renderedLayers; - QgsAbstractGeoPdfExporter::ComponentLayerDetail detail; + QList< QgsAbstractGeospatialPdfExporter::ComponentLayerDetail > renderedLayers; + QgsAbstractGeospatialPdfExporter::ComponentLayerDetail detail; detail.mapLayerId = QStringLiteral( "layer3" ); detail.opacity = 0.7; detail.compositionMode = QPainter::CompositionMode_Screen; detail.sourcePdfPath = QStringLiteral( "a pdf.pdf" ); renderedLayers << detail; - QgsAbstractGeoPdfExporter::ExportDetails details; + QgsAbstractGeospatialPdfExporter::ExportDetails details; details.layerIdToPdfLayerTreeNameMap.insert( QStringLiteral( "layer1" ), QStringLiteral( "my first layer" ) ); details.initialLayerVisibility.insert( QStringLiteral( "layer2" ), false ); details.layerOrder = QStringList() << QStringLiteral( "layer2" ); - QString composition = geoPdfExporter.createCompositionXml( renderedLayers, details ); + QString composition = geospatialPdfExporter.createCompositionXml( renderedLayers, details ); QgsDebugMsgLevel( composition, 1 ); QDomDocument doc; doc.setContent( composition ); @@ -254,14 +254,14 @@ void TestQgsGeoPdfExport::testComposition() QCOMPARE( layerTreeList.at( 2 ).toElement().attribute( QStringLiteral( "id" ) ), QStringLiteral( "layer3" ) ); } -void TestQgsGeoPdfExport::testMetadata() +void TestQgsGeospatialPdfExport::testMetadata() { - TestGeoPdfExporter geoPdfExporter; + TestGeospatialPdfExporter geospatialPdfExporter; // test creation of the composition xml with metadata - QList< QgsAbstractGeoPdfExporter::ComponentLayerDetail > renderedLayers; - QgsAbstractGeoPdfExporter::ExportDetails details; - QString composition = geoPdfExporter.createCompositionXml( renderedLayers, details ); + QList< QgsAbstractGeospatialPdfExporter::ComponentLayerDetail > renderedLayers; + QgsAbstractGeospatialPdfExporter::ExportDetails details; + QString composition = geospatialPdfExporter.createCompositionXml( renderedLayers, details ); QgsDebugMsgLevel( composition, 1 ); QDomDocument doc; doc.setContent( composition ); @@ -282,7 +282,7 @@ void TestQgsGeoPdfExport::testMetadata() details.title = QStringLiteral( "my title" ); details.keywords.insert( QStringLiteral( "k1" ), QStringList() << QStringLiteral( "v1" ) << QStringLiteral( "v2" ) ); - composition = geoPdfExporter.createCompositionXml( renderedLayers, details ); + composition = geospatialPdfExporter.createCompositionXml( renderedLayers, details ); QgsDebugMsgLevel( composition, 1 ); doc.setContent( composition ); QCOMPARE( doc.elementsByTagName( QStringLiteral( "Author" ) ).at( 0 ).toElement().text(), QStringLiteral( "my author" ) ); @@ -295,30 +295,30 @@ void TestQgsGeoPdfExport::testMetadata() } -void TestQgsGeoPdfExport::testGeoref() +void TestQgsGeospatialPdfExport::testGeoref() { - TestGeoPdfExporter geoPdfExporter; + TestGeospatialPdfExporter geospatialPdfExporter; // test creation of the composition xml with georeferencing - QList< QgsAbstractGeoPdfExporter::ComponentLayerDetail > renderedLayers; - QgsAbstractGeoPdfExporter::ExportDetails details; - QString composition = geoPdfExporter.createCompositionXml( renderedLayers, details ); + QList< QgsAbstractGeospatialPdfExporter::ComponentLayerDetail > renderedLayers; + QgsAbstractGeospatialPdfExporter::ExportDetails details; + QString composition = geospatialPdfExporter.createCompositionXml( renderedLayers, details ); QgsDebugMsgLevel( composition, 1 ); QDomDocument doc; doc.setContent( composition ); QCOMPARE( doc.elementsByTagName( QStringLiteral( "Georeferencing" ) ).count(), 0 ); // with points - QgsAbstractGeoPdfExporter::GeoReferencedSection section; + QgsAbstractGeospatialPdfExporter::GeoReferencedSection section; section.crs = QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4283" ) ); section.pageBoundsMm = QgsRectangle( 0, 0, 253.2, 222.25 ); - section.controlPoints.append( QgsAbstractGeoPdfExporter::ControlPoint( QgsPointXY( 0, 0 ), QgsPointXY( -122.4, 53.6 ) ) ); - section.controlPoints.append( QgsAbstractGeoPdfExporter::ControlPoint( QgsPointXY( 253.2, 0 ), QgsPointXY( -78, 53.6 ) ) ); - section.controlPoints.append( QgsAbstractGeoPdfExporter::ControlPoint( QgsPointXY( 253.2, 222.25 ), QgsPointXY( -78, 14.6 ) ) ); - section.controlPoints.append( QgsAbstractGeoPdfExporter::ControlPoint( QgsPointXY( 0, 222.25 ), QgsPointXY( -122.4, 14.6 ) ) ); + section.controlPoints.append( QgsAbstractGeospatialPdfExporter::ControlPoint( QgsPointXY( 0, 0 ), QgsPointXY( -122.4, 53.6 ) ) ); + section.controlPoints.append( QgsAbstractGeospatialPdfExporter::ControlPoint( QgsPointXY( 253.2, 0 ), QgsPointXY( -78, 53.6 ) ) ); + section.controlPoints.append( QgsAbstractGeospatialPdfExporter::ControlPoint( QgsPointXY( 253.2, 222.25 ), QgsPointXY( -78, 14.6 ) ) ); + section.controlPoints.append( QgsAbstractGeospatialPdfExporter::ControlPoint( QgsPointXY( 0, 222.25 ), QgsPointXY( -122.4, 14.6 ) ) ); details.georeferencedSections << section; - composition = geoPdfExporter.createCompositionXml( renderedLayers, details ); + composition = geospatialPdfExporter.createCompositionXml( renderedLayers, details ); QgsDebugMsgLevel( composition, 1 ); doc.setContent( composition ); QCOMPARE( doc.elementsByTagName( QStringLiteral( "SRS" ) ).at( 0 ).toElement().text(), QStringLiteral( "EPSG:4283" ) ); @@ -345,28 +345,28 @@ void TestQgsGeoPdfExport::testGeoref() QCOMPARE( cp1.attribute( QStringLiteral( "y" ) ).left( 10 ), QStringLiteral( "-2.8346456" ) ); } -void TestQgsGeoPdfExport::testGeorefPolygon() +void TestQgsGeospatialPdfExport::testGeorefPolygon() { // test georeferencing a region using polygon bounds - TestGeoPdfExporter geoPdfExporter; + TestGeospatialPdfExporter geospatialPdfExporter; - QList< QgsAbstractGeoPdfExporter::ComponentLayerDetail > renderedLayers; - QgsAbstractGeoPdfExporter::ExportDetails details; + QList< QgsAbstractGeospatialPdfExporter::ComponentLayerDetail > renderedLayers; + QgsAbstractGeospatialPdfExporter::ExportDetails details; // with points - QgsAbstractGeoPdfExporter::GeoReferencedSection section; + QgsAbstractGeospatialPdfExporter::GeoReferencedSection section; section.crs = QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4283" ) ); section.pageBoundsMm = QgsRectangle( 0, 0, 253.2, 222.25 ); QgsPolygon p; p.fromWkt( QStringLiteral( "Polygon((30 5, 250 15, 240 200, 50 190, 30 5))" ) ); section.pageBoundsPolygon = p; - section.controlPoints.append( QgsAbstractGeoPdfExporter::ControlPoint( QgsPointXY( 0, 0 ), QgsPointXY( -122.4, 53.6 ) ) ); - section.controlPoints.append( QgsAbstractGeoPdfExporter::ControlPoint( QgsPointXY( 253.2, 0 ), QgsPointXY( -78, 53.6 ) ) ); - section.controlPoints.append( QgsAbstractGeoPdfExporter::ControlPoint( QgsPointXY( 253.2, 222.25 ), QgsPointXY( -78, 14.6 ) ) ); - section.controlPoints.append( QgsAbstractGeoPdfExporter::ControlPoint( QgsPointXY( 0, 222.25 ), QgsPointXY( -122.4, 14.6 ) ) ); + section.controlPoints.append( QgsAbstractGeospatialPdfExporter::ControlPoint( QgsPointXY( 0, 0 ), QgsPointXY( -122.4, 53.6 ) ) ); + section.controlPoints.append( QgsAbstractGeospatialPdfExporter::ControlPoint( QgsPointXY( 253.2, 0 ), QgsPointXY( -78, 53.6 ) ) ); + section.controlPoints.append( QgsAbstractGeospatialPdfExporter::ControlPoint( QgsPointXY( 253.2, 222.25 ), QgsPointXY( -78, 14.6 ) ) ); + section.controlPoints.append( QgsAbstractGeospatialPdfExporter::ControlPoint( QgsPointXY( 0, 222.25 ), QgsPointXY( -122.4, 14.6 ) ) ); details.georeferencedSections << section; - QString composition = geoPdfExporter.createCompositionXml( renderedLayers, details ); + QString composition = geospatialPdfExporter.createCompositionXml( renderedLayers, details ); QgsDebugMsgLevel( composition, 1 ); QDomDocument doc; doc.setContent( composition ); @@ -391,12 +391,12 @@ void TestQgsGeoPdfExport::testGeorefPolygon() QCOMPARE( cp1.attribute( QStringLiteral( "y" ) ).left( 10 ), QStringLiteral( "-2.8346456" ) ); } -void TestQgsGeoPdfExport::testGroups() +void TestQgsGeospatialPdfExport::testGroups() { - TestGeoPdfExporter geoPdfExporter; + TestGeospatialPdfExporter geospatialPdfExporter; // no features, no crash - QVERIFY( geoPdfExporter.saveTemporaryLayers() ); - QCOMPARE( geoPdfExporter.mVectorComponents.count(), 0 ); + QVERIFY( geospatialPdfExporter.saveTemporaryLayers() ); + QCOMPARE( geospatialPdfExporter.mVectorComponents.count(), 0 ); QgsFields fields; fields.append( QgsField( QStringLiteral( "a1" ), QVariant::Int ) ); @@ -406,20 +406,20 @@ void TestQgsGeoPdfExport::testGroups() f.setAttributes( QgsAttributes() << 1 << 2 ); f.setGeometry( QgsGeometry( new QgsPoint( 1, 2 ) ) ); QgsGeometry renderedBounds( QgsGeometry::fromRect( QgsRectangle( 1, 10, 6, 20 ) ) ); - geoPdfExporter.pushRenderedFeature( QStringLiteral( "layer1" ), QgsAbstractGeoPdfExporter::RenderedFeature( f, renderedBounds ) ); + geospatialPdfExporter.pushRenderedFeature( QStringLiteral( "layer1" ), QgsAbstractGeospatialPdfExporter::RenderedFeature( f, renderedBounds ) ); f.setAttributes( QgsAttributes() << 31 << 32 ); f.setGeometry( QgsGeometry( new QgsPoint( 4, 5 ) ) ); renderedBounds = QgsGeometry::fromWkt( QStringLiteral( "LineString(1 1, 2 2)" ) ); - geoPdfExporter.pushRenderedFeature( QStringLiteral( "layer2" ), QgsAbstractGeoPdfExporter::RenderedFeature( f, renderedBounds ) ); + geospatialPdfExporter.pushRenderedFeature( QStringLiteral( "layer2" ), QgsAbstractGeospatialPdfExporter::RenderedFeature( f, renderedBounds ) ); - QVERIFY( geoPdfExporter.saveTemporaryLayers() ); - QgsAbstractGeoPdfExporter::VectorComponentDetail component; + QVERIFY( geospatialPdfExporter.saveTemporaryLayers() ); + QgsAbstractGeospatialPdfExporter::VectorComponentDetail component; QString layer1Path; QString layer1Layer; QString layer2Path; QString layer2Layer; - for ( const auto &it : std::as_const( geoPdfExporter.mVectorComponents ) ) + for ( const auto &it : std::as_const( geospatialPdfExporter.mVectorComponents ) ) { if ( it.mapLayerId == QLatin1String( "layer1" ) ) { @@ -434,9 +434,9 @@ void TestQgsGeoPdfExport::testGroups() } // test creation of the composition xml - QList< QgsAbstractGeoPdfExporter::ComponentLayerDetail > renderedLayers; // no extra layers for now - QgsAbstractGeoPdfExporter::ExportDetails details; - QString composition = geoPdfExporter.createCompositionXml( renderedLayers, details ); + QList< QgsAbstractGeospatialPdfExporter::ComponentLayerDetail > renderedLayers; // no extra layers for now + QgsAbstractGeospatialPdfExporter::ExportDetails details; + QString composition = geospatialPdfExporter.createCompositionXml( renderedLayers, details ); QgsDebugMsgLevel( composition, 1 ); QDomDocument doc; doc.setContent( composition ); @@ -475,9 +475,9 @@ void TestQgsGeoPdfExport::testGroups() } -void TestQgsGeoPdfExport::testCustomGroups() +void TestQgsGeospatialPdfExport::testCustomGroups() { - TestGeoPdfExporter geoPdfExporter; + TestGeospatialPdfExporter geospatialPdfExporter; QgsFields fields; fields.append( QgsField( QStringLiteral( "a1" ), QVariant::Int ) ); @@ -487,20 +487,20 @@ void TestQgsGeoPdfExport::testCustomGroups() f.setAttributes( QgsAttributes() << 1 << 2 ); f.setGeometry( QgsGeometry( new QgsPoint( 1, 2 ) ) ); QgsGeometry renderedBounds( QgsGeometry::fromRect( QgsRectangle( 1, 10, 6, 20 ) ) ); - geoPdfExporter.pushRenderedFeature( QStringLiteral( "layer1" ), QgsAbstractGeoPdfExporter::RenderedFeature( f, renderedBounds ) ); + geospatialPdfExporter.pushRenderedFeature( QStringLiteral( "layer1" ), QgsAbstractGeospatialPdfExporter::RenderedFeature( f, renderedBounds ) ); f.setAttributes( QgsAttributes() << 31 << 32 ); f.setGeometry( QgsGeometry( new QgsPoint( 4, 5 ) ) ); renderedBounds = QgsGeometry::fromWkt( QStringLiteral( "LineString(1 1, 2 2)" ) ); - geoPdfExporter.pushRenderedFeature( QStringLiteral( "layer2" ), QgsAbstractGeoPdfExporter::RenderedFeature( f, renderedBounds ) ); + geospatialPdfExporter.pushRenderedFeature( QStringLiteral( "layer2" ), QgsAbstractGeospatialPdfExporter::RenderedFeature( f, renderedBounds ) ); - QVERIFY( geoPdfExporter.saveTemporaryLayers() ); - QgsAbstractGeoPdfExporter::VectorComponentDetail component; + QVERIFY( geospatialPdfExporter.saveTemporaryLayers() ); + QgsAbstractGeospatialPdfExporter::VectorComponentDetail component; QString layer1Path; QString layer1Layer; QString layer2Path; QString layer2Layer; - for ( const auto &it : std::as_const( geoPdfExporter.mVectorComponents ) ) + for ( const auto &it : std::as_const( geospatialPdfExporter.mVectorComponents ) ) { if ( it.mapLayerId == QLatin1String( "layer1" ) ) { @@ -515,12 +515,12 @@ void TestQgsGeoPdfExport::testCustomGroups() } // test creation of the composition xml - QList< QgsAbstractGeoPdfExporter::ComponentLayerDetail > renderedLayers; // no extra layers for now - QgsAbstractGeoPdfExporter::ExportDetails details; + QList< QgsAbstractGeospatialPdfExporter::ComponentLayerDetail > renderedLayers; // no extra layers for now + QgsAbstractGeospatialPdfExporter::ExportDetails details; details.customLayerTreeGroups.insert( QStringLiteral( "layer1" ), QStringLiteral( "my group" ) ); details.customLayerTreeGroups.insert( QStringLiteral( "layer2" ), QStringLiteral( "my group2" ) ); - QString composition = geoPdfExporter.createCompositionXml( renderedLayers, details ); + QString composition = geospatialPdfExporter.createCompositionXml( renderedLayers, details ); QgsDebugMsgLevel( composition, 1 ); QDomDocument doc; doc.setContent( composition ); @@ -557,40 +557,38 @@ void TestQgsGeoPdfExport::testCustomGroups() QCOMPARE( ifLayerOnList.at( layer2Idx ).toElement().elementsByTagName( QStringLiteral( "Vector" ) ).at( 0 ).toElement().attribute( QStringLiteral( "visible" ) ), QStringLiteral( "false" ) ); QCOMPARE( ifLayerOnList.at( layer2Idx ).toElement().elementsByTagName( QStringLiteral( "LogicalStructure" ) ).at( 0 ).toElement().attribute( QStringLiteral( "fieldToDisplay" ) ), QStringLiteral( "attr layer2" ) ); QCOMPARE( ifLayerOnList.at( layer2Idx ).toElement().elementsByTagName( QStringLiteral( "LogicalStructure" ) ).at( 0 ).toElement().attribute( QStringLiteral( "displayLayerName" ) ), QStringLiteral( "name layer2" ) ); - - } -void TestQgsGeoPdfExport::compositionMode() +void TestQgsGeospatialPdfExport::compositionMode() { - QVERIFY( QgsAbstractGeoPdfExporter::compositionModeSupported( QPainter::CompositionMode_SourceOver ) ); - QVERIFY( QgsAbstractGeoPdfExporter::compositionModeSupported( QPainter::CompositionMode_Multiply ) ); - QVERIFY( QgsAbstractGeoPdfExporter::compositionModeSupported( QPainter::CompositionMode_Screen ) ); - QVERIFY( QgsAbstractGeoPdfExporter::compositionModeSupported( QPainter::CompositionMode_Overlay ) ); - QVERIFY( QgsAbstractGeoPdfExporter::compositionModeSupported( QPainter::CompositionMode_Darken ) ); - QVERIFY( QgsAbstractGeoPdfExporter::compositionModeSupported( QPainter::CompositionMode_Lighten ) ); - QVERIFY( QgsAbstractGeoPdfExporter::compositionModeSupported( QPainter::CompositionMode_ColorDodge ) ); - QVERIFY( QgsAbstractGeoPdfExporter::compositionModeSupported( QPainter::CompositionMode_ColorBurn ) ); - QVERIFY( QgsAbstractGeoPdfExporter::compositionModeSupported( QPainter::CompositionMode_HardLight ) ); - QVERIFY( QgsAbstractGeoPdfExporter::compositionModeSupported( QPainter::CompositionMode_SoftLight ) ); - QVERIFY( QgsAbstractGeoPdfExporter::compositionModeSupported( QPainter::CompositionMode_Difference ) ); - QVERIFY( QgsAbstractGeoPdfExporter::compositionModeSupported( QPainter::CompositionMode_Exclusion ) ); - QVERIFY( !QgsAbstractGeoPdfExporter::compositionModeSupported( QPainter::CompositionMode_Plus ) ); - - QCOMPARE( QgsAbstractGeoPdfExporter::compositionModeToString( QPainter::CompositionMode_SourceOver ), QStringLiteral( "Normal" ) ); - QCOMPARE( QgsAbstractGeoPdfExporter::compositionModeToString( QPainter::CompositionMode_Multiply ), QStringLiteral( "Multiply" ) ); - QCOMPARE( QgsAbstractGeoPdfExporter::compositionModeToString( QPainter::CompositionMode_Screen ), QStringLiteral( "Screen" ) ); - QCOMPARE( QgsAbstractGeoPdfExporter::compositionModeToString( QPainter::CompositionMode_Overlay ), QStringLiteral( "Overlay" ) ); - QCOMPARE( QgsAbstractGeoPdfExporter::compositionModeToString( QPainter::CompositionMode_Darken ), QStringLiteral( "Darken" ) ); - QCOMPARE( QgsAbstractGeoPdfExporter::compositionModeToString( QPainter::CompositionMode_Lighten ), QStringLiteral( "Lighten" ) ); - QCOMPARE( QgsAbstractGeoPdfExporter::compositionModeToString( QPainter::CompositionMode_ColorDodge ), QStringLiteral( "ColorDodge" ) ); - QCOMPARE( QgsAbstractGeoPdfExporter::compositionModeToString( QPainter::CompositionMode_ColorBurn ), QStringLiteral( "ColorBurn" ) ); - QCOMPARE( QgsAbstractGeoPdfExporter::compositionModeToString( QPainter::CompositionMode_HardLight ), QStringLiteral( "HardLight" ) ); - QCOMPARE( QgsAbstractGeoPdfExporter::compositionModeToString( QPainter::CompositionMode_SoftLight ), QStringLiteral( "SoftLight" ) ); - QCOMPARE( QgsAbstractGeoPdfExporter::compositionModeToString( QPainter::CompositionMode_Difference ), QStringLiteral( "Difference" ) ); - QCOMPARE( QgsAbstractGeoPdfExporter::compositionModeToString( QPainter::CompositionMode_Exclusion ), QStringLiteral( "Exclusion" ) ); - QCOMPARE( QgsAbstractGeoPdfExporter::compositionModeToString( QPainter::CompositionMode_Plus ), QStringLiteral( "Normal" ) ); + QVERIFY( QgsAbstractGeospatialPdfExporter::compositionModeSupported( QPainter::CompositionMode_SourceOver ) ); + QVERIFY( QgsAbstractGeospatialPdfExporter::compositionModeSupported( QPainter::CompositionMode_Multiply ) ); + QVERIFY( QgsAbstractGeospatialPdfExporter::compositionModeSupported( QPainter::CompositionMode_Screen ) ); + QVERIFY( QgsAbstractGeospatialPdfExporter::compositionModeSupported( QPainter::CompositionMode_Overlay ) ); + QVERIFY( QgsAbstractGeospatialPdfExporter::compositionModeSupported( QPainter::CompositionMode_Darken ) ); + QVERIFY( QgsAbstractGeospatialPdfExporter::compositionModeSupported( QPainter::CompositionMode_Lighten ) ); + QVERIFY( QgsAbstractGeospatialPdfExporter::compositionModeSupported( QPainter::CompositionMode_ColorDodge ) ); + QVERIFY( QgsAbstractGeospatialPdfExporter::compositionModeSupported( QPainter::CompositionMode_ColorBurn ) ); + QVERIFY( QgsAbstractGeospatialPdfExporter::compositionModeSupported( QPainter::CompositionMode_HardLight ) ); + QVERIFY( QgsAbstractGeospatialPdfExporter::compositionModeSupported( QPainter::CompositionMode_SoftLight ) ); + QVERIFY( QgsAbstractGeospatialPdfExporter::compositionModeSupported( QPainter::CompositionMode_Difference ) ); + QVERIFY( QgsAbstractGeospatialPdfExporter::compositionModeSupported( QPainter::CompositionMode_Exclusion ) ); + QVERIFY( !QgsAbstractGeospatialPdfExporter::compositionModeSupported( QPainter::CompositionMode_Plus ) ); + + QCOMPARE( QgsAbstractGeospatialPdfExporter::compositionModeToString( QPainter::CompositionMode_SourceOver ), QStringLiteral( "Normal" ) ); + QCOMPARE( QgsAbstractGeospatialPdfExporter::compositionModeToString( QPainter::CompositionMode_Multiply ), QStringLiteral( "Multiply" ) ); + QCOMPARE( QgsAbstractGeospatialPdfExporter::compositionModeToString( QPainter::CompositionMode_Screen ), QStringLiteral( "Screen" ) ); + QCOMPARE( QgsAbstractGeospatialPdfExporter::compositionModeToString( QPainter::CompositionMode_Overlay ), QStringLiteral( "Overlay" ) ); + QCOMPARE( QgsAbstractGeospatialPdfExporter::compositionModeToString( QPainter::CompositionMode_Darken ), QStringLiteral( "Darken" ) ); + QCOMPARE( QgsAbstractGeospatialPdfExporter::compositionModeToString( QPainter::CompositionMode_Lighten ), QStringLiteral( "Lighten" ) ); + QCOMPARE( QgsAbstractGeospatialPdfExporter::compositionModeToString( QPainter::CompositionMode_ColorDodge ), QStringLiteral( "ColorDodge" ) ); + QCOMPARE( QgsAbstractGeospatialPdfExporter::compositionModeToString( QPainter::CompositionMode_ColorBurn ), QStringLiteral( "ColorBurn" ) ); + QCOMPARE( QgsAbstractGeospatialPdfExporter::compositionModeToString( QPainter::CompositionMode_HardLight ), QStringLiteral( "HardLight" ) ); + QCOMPARE( QgsAbstractGeospatialPdfExporter::compositionModeToString( QPainter::CompositionMode_SoftLight ), QStringLiteral( "SoftLight" ) ); + QCOMPARE( QgsAbstractGeospatialPdfExporter::compositionModeToString( QPainter::CompositionMode_Difference ), QStringLiteral( "Difference" ) ); + QCOMPARE( QgsAbstractGeospatialPdfExporter::compositionModeToString( QPainter::CompositionMode_Exclusion ), QStringLiteral( "Exclusion" ) ); + QCOMPARE( QgsAbstractGeospatialPdfExporter::compositionModeToString( QPainter::CompositionMode_Plus ), QStringLiteral( "Normal" ) ); } -QGSTEST_MAIN( TestQgsGeoPdfExport ) +QGSTEST_MAIN( TestQgsGeospatialPdfExport ) #include "testqgsgeopdfexport.moc" diff --git a/tests/src/core/testqgslayoutgeopdfexport.cpp b/tests/src/core/testqgslayoutgeopdfexport.cpp index 1e2a970189da..d0ebf21b48a2 100644 --- a/tests/src/core/testqgslayoutgeopdfexport.cpp +++ b/tests/src/core/testqgslayoutgeopdfexport.cpp @@ -27,12 +27,12 @@ #include #include "qgstest.h" -class TestQgsLayoutGeoPdfExport : public QgsTest +class TestQgsLayoutGeospatialPdfExport : public QgsTest { Q_OBJECT public: - TestQgsLayoutGeoPdfExport() : QgsTest( QStringLiteral( "GeoPDF Export Tests" ) ) {} + TestQgsLayoutGeospatialPdfExport() : QgsTest( QStringLiteral( "Geospatial PDF Export Tests" ) ) {} private slots: void initTestCase();// will be called before the first testfunction is executed. @@ -43,38 +43,38 @@ class TestQgsLayoutGeoPdfExport : public QgsTest void layerOrder(); }; -void TestQgsLayoutGeoPdfExport::initTestCase() +void TestQgsLayoutGeospatialPdfExport::initTestCase() { QgsApplication::init(); QgsApplication::initQgis(); } -void TestQgsLayoutGeoPdfExport::cleanupTestCase() +void TestQgsLayoutGeospatialPdfExport::cleanupTestCase() { QgsApplication::exitQgis(); } -void TestQgsLayoutGeoPdfExport::testTempFilenames() +void TestQgsLayoutGeospatialPdfExport::testTempFilenames() { QgsProject p; QgsLayout l( &p ); - QgsLayoutGeoPdfExporter geoPdfExporter( &l ); + QgsLayoutGeospatialPdfExporter geospatialPdfExporter( &l ); - QString outputFile = geoPdfExporter.generateTemporaryFilepath( QStringLiteral( "test_src.pdf" ) ); + QString outputFile = geospatialPdfExporter.generateTemporaryFilepath( QStringLiteral( "test_src.pdf" ) ); QVERIFY( outputFile.endsWith( QLatin1String( "test_src.pdf" ) ) ); // test generating temporary file path with slash characters (https://github.com/qgis/QGIS/issues/51480) - outputFile = geoPdfExporter.generateTemporaryFilepath( QStringLiteral( "test/ src.pdf" ) ); + outputFile = geospatialPdfExporter.generateTemporaryFilepath( QStringLiteral( "test/ src.pdf" ) ); QVERIFY( outputFile.endsWith( QLatin1String( "test_ src.pdf" ) ) ); - outputFile = geoPdfExporter.generateTemporaryFilepath( QStringLiteral( "test\\ src.pdf" ) ); + outputFile = geospatialPdfExporter.generateTemporaryFilepath( QStringLiteral( "test\\ src.pdf" ) ); QVERIFY( outputFile.endsWith( QLatin1String( "test_ src.pdf" ) ) ); - outputFile = geoPdfExporter.generateTemporaryFilepath( QStringLiteral( "test: src.pdf" ) ); + outputFile = geospatialPdfExporter.generateTemporaryFilepath( QStringLiteral( "test: src.pdf" ) ); QVERIFY( outputFile.endsWith( QLatin1String( "test_ src.pdf" ) ) ); } -void TestQgsLayoutGeoPdfExport::testCollectingFeatures() +void TestQgsLayoutGeospatialPdfExport::testCollectingFeatures() { QgsVectorLayer *linesLayer = new QgsVectorLayer( TEST_DATA_DIR + QStringLiteral( "/lines.shp" ), QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); @@ -131,19 +131,19 @@ void TestQgsLayoutGeoPdfExport::testCollectingFeatures() map2->setBackgroundEnabled( true ); l.addLayoutItem( map2 ); - QgsLayoutGeoPdfExporter geoPdfExporter( &l ); + QgsLayoutGeospatialPdfExporter geospatialPdfExporter( &l ); // trigger render QgsLayoutExporter exporter( &l ); - const QString outputFile = geoPdfExporter.generateTemporaryFilepath( QStringLiteral( "test_src.pdf" ) ); + const QString outputFile = geospatialPdfExporter.generateTemporaryFilepath( QStringLiteral( "test_src.pdf" ) ); QgsLayoutExporter::PdfExportSettings settings; settings.writeGeoPdf = true; settings.exportMetadata = false; exporter.exportToPdf( outputFile, settings ); // check that features were collected - QgsFeatureList lineFeatures = geoPdfExporter.mCollatedFeatures.value( QString() ).value( linesLayer->id() ); + QgsFeatureList lineFeatures = geospatialPdfExporter.mCollatedFeatures.value( QString() ).value( linesLayer->id() ); QCOMPARE( lineFeatures.count(), 6 ); QgsFeature lineFeature1; @@ -162,7 +162,7 @@ void TestQgsLayoutGeoPdfExport::testCollectingFeatures() QgsDebugMsgLevel( lineGeometry1.asWkt( 0 ), 1 ); QCOMPARE( lineGeometry1.asWkt( 0 ), QStringLiteral( "MultiLineString ((281 538, 283 532, 284 530, 285 529, 289 526, 299 520, 310 516, 313 513, 318 508, 319 507, 320 501, 320 498, 322 493, 323 491, 323 486, 324 484, 326 481, 327 478, 331 474, 331 473, 332 470, 332 465, 332 463, 333 459, 334 457, 338 454, 342 452, 345 450, 349 448, 349 445, 349 443, 347 439, 346 438, 345 435, 343 433, 342 432, 341 430, 341 428, 340 426, 340 424, 342 420, 343 418, 343 418, 348 407, 345 402, 343 399, 340 393, 340 389, 335 385, 333 382, 331 378, 331 376, 331 374, 331 372, 331 369, 332 367, 333 364, 334 362, 336 360, 338 357, 341 353, 346 344, 347 343, 350 339, 352 338, 356 333, 358 331, 363 328, 366 325, 370 321, 372 320, 376 317, 380 314, 384 312, 390 307, 392 305, 393 302, 393 299, 393 295, 393 294, 391 291, 388 287, 386 285, 385 283, 385 280, 386 278, 387 274, 388 272, 391 268, 392 267, 394 263, 398 259, 406 255))" ) ); - QgsFeatureList pointFeatures = geoPdfExporter.mCollatedFeatures.value( QString() ).value( pointsLayer->id() ); + QgsFeatureList pointFeatures = geospatialPdfExporter.mCollatedFeatures.value( QString() ).value( pointsLayer->id() ); QCOMPARE( pointFeatures.count(), 32 ); QgsFeature pointFeature3; @@ -185,7 +185,7 @@ void TestQgsLayoutGeoPdfExport::testCollectingFeatures() QCOMPARE( pointGeometry3.asWkt( 0 ), QStringLiteral( "MultiPolygon (((473 306, 505 306, 505 274, 473 274, 473 306)))" ) ); // check second map - QgsFeatureList polyFeatures = geoPdfExporter.mCollatedFeatures.value( QString() ).value( polygonLayer->id() ); + QgsFeatureList polyFeatures = geospatialPdfExporter.mCollatedFeatures.value( QString() ).value( polygonLayer->id() ); QCOMPARE( polyFeatures.count(), 10 ); QgsFeature polyFeature3b; @@ -205,14 +205,14 @@ void TestQgsLayoutGeoPdfExport::testCollectingFeatures() QCOMPARE( polyGeometry3b.asWkt( 0 ), QStringLiteral( "MultiPolygon (((469 306, 469 305, 468 305, 468 305, 467 305, 466 304, 466 304, 466 303, 467 303, 467 302, 468 302, 469 302, 470 302, 470 303, 471 303, 472 303, 473 303, 474 303, 474 303, 475 303, 476 303, 476 303, 478 300, 478 299, 478 299, 478 298, 478 296, 477 296, 476 295, 476 295, 475 294, 474 294, 474 294, 473 295, 472 295, 472 296, 471 296, 470 297, 469 297, 468 297, 466 296, 464 296, 463 296, 462 297, 462 298, 462 298, 461 299, 460 299, 459 300, 458 300, 458 301, 458 301, 458 302, 459 303, 459 303, 458 304, 458 304, 458 305, 458 306, 458 307, 458 308, 458 308, 459 309, 460 309, 460 310, 461 311, 462 311, 462 312, 463 312, 464 312, 465 312, 465 311, 467 310, 467 309, 468 308, 469 307, 469 306)))" ) ); // finalize and test collation - QgsAbstractGeoPdfExporter::ExportDetails details; + QgsAbstractGeospatialPdfExporter::ExportDetails details; details.pageSizeMm = QSizeF( 297, 210 ); const bool expected = true; - QCOMPARE( geoPdfExporter.finalize( QList(), outputFile, details ), expected ); - QVERIFY( geoPdfExporter.errorMessage().isEmpty() ); + QCOMPARE( geospatialPdfExporter.finalize( QList(), outputFile, details ), expected ); + QVERIFY( geospatialPdfExporter.errorMessage().isEmpty() ); - QgsAbstractGeoPdfExporter::VectorComponentDetail vectorDetail; - for ( const auto &it : geoPdfExporter.mVectorComponents ) + QgsAbstractGeospatialPdfExporter::VectorComponentDetail vectorDetail; + for ( const auto &it : geospatialPdfExporter.mVectorComponents ) { if ( it.mapLayerId == linesLayer->id() ) vectorDetail = it; @@ -223,7 +223,7 @@ void TestQgsLayoutGeoPdfExport::testCollectingFeatures() QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); QVERIFY( layer1->isValid() ); QCOMPARE( layer1->featureCount(), 6L ); - for ( const auto &it : geoPdfExporter.mVectorComponents ) + for ( const auto &it : geospatialPdfExporter.mVectorComponents ) { if ( it.mapLayerId == pointsLayer->id() ) vectorDetail = it; @@ -232,7 +232,7 @@ void TestQgsLayoutGeoPdfExport::testCollectingFeatures() QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); QVERIFY( layer2->isValid() ); QCOMPARE( layer2->featureCount(), 32L ); - for ( const auto &it : geoPdfExporter.mVectorComponents ) + for ( const auto &it : geospatialPdfExporter.mVectorComponents ) { if ( it.mapLayerId == polygonLayer->id() ) vectorDetail = it; @@ -246,7 +246,7 @@ void TestQgsLayoutGeoPdfExport::testCollectingFeatures() map2->setFollowVisibilityPreset( true ); map2->setFollowVisibilityPresetName( QStringLiteral( "test preset3" ) ); - QgsLayoutGeoPdfExporter geoPdfExporter2( &l ); + QgsLayoutGeospatialPdfExporter geospatialPdfExporter2( &l ); settings = QgsLayoutExporter::PdfExportSettings(); settings.writeGeoPdf = true; settings.exportMetadata = false; @@ -254,41 +254,41 @@ void TestQgsLayoutGeoPdfExport::testCollectingFeatures() exporter.exportToPdf( outputFile, settings ); // check that features were collected - lineFeatures = geoPdfExporter2.mCollatedFeatures.value( QString() ).value( linesLayer->id() ); + lineFeatures = geospatialPdfExporter2.mCollatedFeatures.value( QString() ).value( linesLayer->id() ); QCOMPARE( lineFeatures.count(), 0 ); - lineFeatures = geoPdfExporter2.mCollatedFeatures.value( QStringLiteral( "test preset2" ) ).value( linesLayer->id() ); + lineFeatures = geospatialPdfExporter2.mCollatedFeatures.value( QStringLiteral( "test preset2" ) ).value( linesLayer->id() ); QCOMPARE( lineFeatures.count(), 6 ); - lineFeatures = geoPdfExporter2.mCollatedFeatures.value( QStringLiteral( "test preset" ) ).value( linesLayer->id() ); + lineFeatures = geospatialPdfExporter2.mCollatedFeatures.value( QStringLiteral( "test preset" ) ).value( linesLayer->id() ); QCOMPARE( lineFeatures.count(), 6 ); - lineFeatures = geoPdfExporter2.mCollatedFeatures.value( QStringLiteral( "test preset3" ) ).value( linesLayer->id() ); + lineFeatures = geospatialPdfExporter2.mCollatedFeatures.value( QStringLiteral( "test preset3" ) ).value( linesLayer->id() ); QCOMPARE( lineFeatures.count(), 0 ); - pointFeatures = geoPdfExporter2.mCollatedFeatures.value( QString() ).value( pointsLayer->id() ); + pointFeatures = geospatialPdfExporter2.mCollatedFeatures.value( QString() ).value( pointsLayer->id() ); QCOMPARE( pointFeatures.count(), 0 ); - pointFeatures = geoPdfExporter2.mCollatedFeatures.value( QStringLiteral( "test preset2" ) ).value( pointsLayer->id() ); + pointFeatures = geospatialPdfExporter2.mCollatedFeatures.value( QStringLiteral( "test preset2" ) ).value( pointsLayer->id() ); QCOMPARE( pointFeatures.count(), 15 ); - pointFeatures = geoPdfExporter2.mCollatedFeatures.value( QStringLiteral( "test preset" ) ).value( pointsLayer->id() ); + pointFeatures = geospatialPdfExporter2.mCollatedFeatures.value( QStringLiteral( "test preset" ) ).value( pointsLayer->id() ); QCOMPARE( pointFeatures.count(), 0 ); - pointFeatures = geoPdfExporter2.mCollatedFeatures.value( QStringLiteral( "test preset3" ) ).value( pointsLayer->id() ); + pointFeatures = geospatialPdfExporter2.mCollatedFeatures.value( QStringLiteral( "test preset3" ) ).value( pointsLayer->id() ); QCOMPARE( pointFeatures.count(), 0 ); - polyFeatures = geoPdfExporter2.mCollatedFeatures.value( QString() ).value( polygonLayer->id() ); + polyFeatures = geospatialPdfExporter2.mCollatedFeatures.value( QString() ).value( polygonLayer->id() ); QCOMPARE( polyFeatures.count(), 10 ); - polyFeatures = geoPdfExporter2.mCollatedFeatures.value( QStringLiteral( "test preset2" ) ).value( polygonLayer->id() ); + polyFeatures = geospatialPdfExporter2.mCollatedFeatures.value( QStringLiteral( "test preset2" ) ).value( polygonLayer->id() ); QCOMPARE( polyFeatures.count(), 0 ); - polyFeatures = geoPdfExporter2.mCollatedFeatures.value( QStringLiteral( "test preset" ) ).value( polygonLayer->id() ); + polyFeatures = geospatialPdfExporter2.mCollatedFeatures.value( QStringLiteral( "test preset" ) ).value( polygonLayer->id() ); QCOMPARE( polyFeatures.count(), 0 ); - polyFeatures = geoPdfExporter2.mCollatedFeatures.value( QStringLiteral( "test preset3" ) ).value( polygonLayer->id() ); + polyFeatures = geospatialPdfExporter2.mCollatedFeatures.value( QStringLiteral( "test preset3" ) ).value( polygonLayer->id() ); QCOMPARE( polyFeatures.count(), 10 ); // finalize and test collation - details = QgsAbstractGeoPdfExporter::ExportDetails(); + details = QgsAbstractGeospatialPdfExporter::ExportDetails(); details.pageSizeMm = QSizeF( 297, 210 ); - QCOMPARE( geoPdfExporter2.finalize( QList(), outputFile, details ), expected ); - QVERIFY( geoPdfExporter2.errorMessage().isEmpty() ); + QCOMPARE( geospatialPdfExporter2.finalize( QList(), outputFile, details ), expected ); + QVERIFY( geospatialPdfExporter2.errorMessage().isEmpty() ); - vectorDetail = QgsAbstractGeoPdfExporter::VectorComponentDetail(); - for ( const auto &it : geoPdfExporter2.mVectorComponents ) + vectorDetail = QgsAbstractGeospatialPdfExporter::VectorComponentDetail(); + for ( const auto &it : geospatialPdfExporter2.mVectorComponents ) { if ( it.mapLayerId == linesLayer->id() && it.group == QLatin1String( "test preset2" ) ) vectorDetail = it; @@ -299,8 +299,8 @@ void TestQgsLayoutGeoPdfExport::testCollectingFeatures() QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); QVERIFY( layer1->isValid() ); QCOMPARE( layer1->featureCount(), 6L ); - vectorDetail = QgsAbstractGeoPdfExporter::VectorComponentDetail(); - for ( const auto &it : geoPdfExporter2.mVectorComponents ) + vectorDetail = QgsAbstractGeospatialPdfExporter::VectorComponentDetail(); + for ( const auto &it : geospatialPdfExporter2.mVectorComponents ) { if ( it.mapLayerId == linesLayer->id() && it.group == QLatin1String( "test preset" ) ) vectorDetail = it; @@ -311,8 +311,8 @@ void TestQgsLayoutGeoPdfExport::testCollectingFeatures() QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); QVERIFY( layer1->isValid() ); QCOMPARE( layer1->featureCount(), 6L ); - vectorDetail = QgsAbstractGeoPdfExporter::VectorComponentDetail(); - for ( const auto &it : geoPdfExporter2.mVectorComponents ) + vectorDetail = QgsAbstractGeospatialPdfExporter::VectorComponentDetail(); + for ( const auto &it : geospatialPdfExporter2.mVectorComponents ) { if ( it.mapLayerId == pointsLayer->id() && it.group == QLatin1String( "test preset2" ) ) vectorDetail = it; @@ -321,8 +321,8 @@ void TestQgsLayoutGeoPdfExport::testCollectingFeatures() QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); QVERIFY( layer2->isValid() ); QCOMPARE( layer2->featureCount(), 15L ); - vectorDetail = QgsAbstractGeoPdfExporter::VectorComponentDetail(); - for ( const auto &it : geoPdfExporter2.mVectorComponents ) + vectorDetail = QgsAbstractGeospatialPdfExporter::VectorComponentDetail(); + for ( const auto &it : geospatialPdfExporter2.mVectorComponents ) { if ( it.mapLayerId == polygonLayer->id() && it.group.isEmpty() ) vectorDetail = it; @@ -331,8 +331,8 @@ void TestQgsLayoutGeoPdfExport::testCollectingFeatures() QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); QVERIFY( layer3->isValid() ); QCOMPARE( layer3->featureCount(), 10L ); - vectorDetail = QgsAbstractGeoPdfExporter::VectorComponentDetail(); - for ( const auto &it : geoPdfExporter2.mVectorComponents ) + vectorDetail = QgsAbstractGeospatialPdfExporter::VectorComponentDetail(); + for ( const auto &it : geospatialPdfExporter2.mVectorComponents ) { if ( it.mapLayerId == polygonLayer->id() && it.group == QLatin1String( "test preset3" ) ) vectorDetail = it; @@ -343,7 +343,7 @@ void TestQgsLayoutGeoPdfExport::testCollectingFeatures() QCOMPARE( layer3->featureCount(), 10L ); } -void TestQgsLayoutGeoPdfExport::skipLayers() +void TestQgsLayoutGeospatialPdfExport::skipLayers() { QgsVectorLayer *linesLayer = new QgsVectorLayer( TEST_DATA_DIR + QStringLiteral( "/lines.shp" ), QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); @@ -376,27 +376,27 @@ void TestQgsLayoutGeoPdfExport::skipLayers() map->setBackgroundEnabled( true ); l.addLayoutItem( map ); - const QgsLayoutGeoPdfExporter geoPdfExporter( &l ); + const QgsLayoutGeospatialPdfExporter geospatialPdfExporter( &l ); // trigger render QgsLayoutExporter exporter( &l ); - const QString outputFile = geoPdfExporter.generateTemporaryFilepath( QStringLiteral( "test_src.pdf" ) ); + const QString outputFile = geospatialPdfExporter.generateTemporaryFilepath( QStringLiteral( "test_src.pdf" ) ); QgsLayoutExporter::PdfExportSettings settings; settings.writeGeoPdf = true; settings.exportMetadata = false; exporter.exportToPdf( outputFile, settings ); // check that features were collected - const QgsFeatureList lineFeatures = geoPdfExporter.mCollatedFeatures.value( QString() ).value( linesLayer->id() ); + const QgsFeatureList lineFeatures = geospatialPdfExporter.mCollatedFeatures.value( QString() ).value( linesLayer->id() ); QCOMPARE( lineFeatures.count(), 0 ); // should be nothing, layer is set to skip - const QgsFeatureList pointFeatures = geoPdfExporter.mCollatedFeatures.value( QString() ).value( pointsLayer->id() ); + const QgsFeatureList pointFeatures = geospatialPdfExporter.mCollatedFeatures.value( QString() ).value( pointsLayer->id() ); QCOMPARE( pointFeatures.count(), 15 ); // should be features, layer was set to export - const QgsFeatureList polyFeatures = geoPdfExporter.mCollatedFeatures.value( QString() ).value( polygonLayer->id() ); + const QgsFeatureList polyFeatures = geospatialPdfExporter.mCollatedFeatures.value( QString() ).value( polygonLayer->id() ); QCOMPARE( polyFeatures.count(), 10 ); // should be features, layer did not have any setting set } -void TestQgsLayoutGeoPdfExport::layerOrder() +void TestQgsLayoutGeospatialPdfExport::layerOrder() { QgsVectorLayer *linesLayer = new QgsVectorLayer( TEST_DATA_DIR + QStringLiteral( "/lines.shp" ), QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ); @@ -426,15 +426,15 @@ void TestQgsLayoutGeoPdfExport::layerOrder() map->setBackgroundEnabled( true ); l.addLayoutItem( map ); - const QgsLayoutGeoPdfExporter geoPdfExporter( &l ); + const QgsLayoutGeospatialPdfExporter geospatialPdfExporter( &l ); // by default we should follow project layer order - QCOMPARE( geoPdfExporter.layerOrder(), QStringList() << polygonLayer->id() << pointsLayer->id() << linesLayer->id() ); + QCOMPARE( geospatialPdfExporter.layerOrder(), QStringList() << polygonLayer->id() << pointsLayer->id() << linesLayer->id() ); // but if a custom order is specified, respected that l.setCustomProperty( QStringLiteral( "pdfLayerOrder" ), QStringLiteral( "%1~~~%2" ).arg( linesLayer->id(), polygonLayer->id() ) ); - const QgsLayoutGeoPdfExporter geoPdfExporter2( &l ); - QCOMPARE( geoPdfExporter2.layerOrder(), QStringList() << linesLayer->id() << polygonLayer->id() << pointsLayer->id() ); + const QgsLayoutGeospatialPdfExporter geospatialPdfExporter2( &l ); + QCOMPARE( geospatialPdfExporter2.layerOrder(), QStringList() << linesLayer->id() << polygonLayer->id() << pointsLayer->id() ); } -QGSTEST_MAIN( TestQgsLayoutGeoPdfExport ) +QGSTEST_MAIN( TestQgsLayoutGeospatialPdfExport ) #include "testqgslayoutgeopdfexport.moc"