diff --git a/python/PyQt6/core/auto_additions/qgslayoutexporter.py b/python/PyQt6/core/auto_additions/qgslayoutexporter.py index adca0f29b779..68b79e5c9c80 100644 --- a/python/PyQt6/core/auto_additions/qgslayoutexporter.py +++ b/python/PyQt6/core/auto_additions/qgslayoutexporter.py @@ -19,7 +19,7 @@ except NameError: pass try: - QgsLayoutExporter.PdfExportSettings.__attribute_docs__ = {'dpi': 'Resolution to export layout at. If dpi <= 0 the default layout dpi will be used.', 'rasterizeWholeImage': 'Set to ``True`` to force whole layout to be rasterized while exporting.\n\nThis option is mutually exclusive with forceVectorOutput.', 'forceVectorOutput': 'Set to ``True`` to force vector object exports, even when the resultant appearance will differ\nfrom the layout. If ``False``, some items may be rasterized in order to maintain their\ncorrect appearance in the output.\n\nThis option is mutually exclusive with rasterizeWholeImage.', 'appendGeoreference': 'Indicates whether PDF export should append georeference data\n\n.. versionadded:: 3.10', 'exportMetadata': "Indicates whether PDF export should include metadata generated\nfrom the layout's project's metadata.\n\n.. versionadded:: 3.2", 'flags': 'Layout context flags, which control how the export will be created.', 'textRenderFormat': 'Text rendering format, which controls how text should be rendered in the export (e.g.\nas paths or real text objects).\n\n.. versionadded:: 3.4.3', 'simplifyGeometries': 'Indicates whether vector geometries should be simplified to avoid redundant extraneous detail,\nsuch as vertices which are not visible at the specified dpi of the output.\n\n.. versionadded:: 3.10', 'writeGeoPdf': '``True`` if GeoPDF files should be created, instead of normal PDF files.\n\nWhilst GeoPDF files can include some desirable properties like the ability to interactively\nquery map features, they also can result in lower-quality output files, or forced rasterization\nof layers.\n\n.. note::\n\n Requires builds based on GDAL 3.0 or greater.\n\n.. versionadded:: 3.10', 'exportLayersAsSeperateFiles': '``True`` if individual layers from the layout should be rendered to separate PDF files.\n\nThis option allows for separation of logic layout layers to individual PDF files. For instance,\nif this option is ``True``, then a separate PDF file will be created per layer per map item in the\nlayout. Additionally, separate PDF files may be created for other complex layout items, resulting\nin a set of PDF files which contain logical atomic components of the layout.\n\nThis option is designed to allow the PDF files to be composited back together in an external\napplication (e.g. Adobe Illustrator) as a non-QGIS, post-production step.\n\n.. versionadded:: 3.14', 'useIso32000ExtensionFormatGeoreferencing': '``True`` if ISO3200 extension format georeferencing should be used.\n\nThis is a recommended setting which results in Geospatial PDF files compatible\nwith the built-in Acrobat geospatial tools.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'useOgcBestPracticeFormatGeoreferencing': '``True`` if OGC "best practice" format georeferencing should be used.\n\n.. warning::\n\n This results in GeoPDF files compatible with the TerraGo suite of tools, but\n can break compatibility with the built-in Acrobat geospatial tools (yes, GeoPDF\n format is a mess!).\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'includeGeoPdfFeatures': '``True`` if feature vector information (such as attributes) should be exported during GeoPDF exports.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'exportThemes': "Optional list of map themes to export as GeoPDF layer groups.\n\nIf set, map item's which are not assigned a specific map theme will iterate through all listed\nthemes and a GeoPDF layer group will be created for each.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.", 'predefinedMapScales': 'A list of predefined scales to use with the layout. This is used\nfor maps which are set to the predefined atlas scaling mode.\n\n.. versionadded:: 3.10'} + QgsLayoutExporter.PdfExportSettings.__attribute_docs__ = {'dpi': 'Resolution to export layout at. If dpi <= 0 the default layout dpi will be used.', 'rasterizeWholeImage': 'Set to ``True`` to force whole layout to be rasterized while exporting.\n\nThis option is mutually exclusive with forceVectorOutput.', 'forceVectorOutput': 'Set to ``True`` to force vector object exports, even when the resultant appearance will differ\nfrom the layout. If ``False``, some items may be rasterized in order to maintain their\ncorrect appearance in the output.\n\nThis option is mutually exclusive with rasterizeWholeImage.', 'appendGeoreference': 'Indicates whether PDF export should append georeference data\n\n.. versionadded:: 3.10', 'exportMetadata': "Indicates whether PDF export should include metadata generated\nfrom the layout's project's metadata.\n\n.. versionadded:: 3.2", 'flags': 'Layout context flags, which control how the export will be created.', 'textRenderFormat': 'Text rendering format, which controls how text should be rendered in the export (e.g.\nas paths or real text objects).\n\n.. versionadded:: 3.4.3', 'simplifyGeometries': 'Indicates whether vector geometries should be simplified to avoid redundant extraneous detail,\nsuch as vertices which are not visible at the specified dpi of the output.\n\n.. versionadded:: 3.10', 'writeGeoPdf': '``True`` if geospatial PDF files should be created, instead of normal PDF files.\n\nWhilst geospatial PDF files can include some desirable properties like the ability to interactively\nquery map features, they also can result in lower-quality output files, or forced rasterization\nof layers.\n\n.. note::\n\n Requires builds based on GDAL 3.0 or greater.\n\n.. versionadded:: 3.10', 'exportLayersAsSeperateFiles': '``True`` if individual layers from the layout should be rendered to separate PDF files.\n\nThis option allows for separation of logic layout layers to individual PDF files. For instance,\nif this option is ``True``, then a separate PDF file will be created per layer per map item in the\nlayout. Additionally, separate PDF files may be created for other complex layout items, resulting\nin a set of PDF files which contain logical atomic components of the layout.\n\nThis option is designed to allow the PDF files to be composited back together in an external\napplication (e.g. Adobe Illustrator) as a non-QGIS, post-production step.\n\n.. versionadded:: 3.14', 'useIso32000ExtensionFormatGeoreferencing': '``True`` if ISO3200 extension format georeferencing should be used.\n\nThis is a recommended setting which results in Geospatial PDF files compatible\nwith the built-in Acrobat geospatial tools.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'useOgcBestPracticeFormatGeoreferencing': '``True`` if OGC "best practice" format georeferencing should be used.\n\n.. warning::\n\n This results in geospatial PDF files compatible with a unnamed suite of tools starting with Terra and ending with Go, but\n can break compatibility with the built-in Acrobat geospatial tools (yes, Geospatial PDF\n format is a mess!).\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'includeGeoPdfFeatures': '``True`` if feature vector information (such as attributes) should be exported during Geospatial PDF exports.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'exportThemes': "Optional list of map themes to export as Geospatial PDF layer groups.\n\nIf set, map item's which are not assigned a specific map theme will iterate through all listed\nthemes and a Geospatial PDF layer group will be created for each.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.", 'predefinedMapScales': 'A list of predefined scales to use with the layout. This is used\nfor maps which are set to the predefined atlas scaling mode.\n\n.. versionadded:: 3.10'} QgsLayoutExporter.PdfExportSettings.__doc__ = """Contains settings relating to exporting layouts to PDF""" QgsLayoutExporter.PdfExportSettings.__group__ = ['layout'] except NameError: diff --git a/python/PyQt6/core/auto_additions/qgsmapsettingsutils.py b/python/PyQt6/core/auto_additions/qgsmapsettingsutils.py index 1e181a20564c..f5806de4a422 100644 --- a/python/PyQt6/core/auto_additions/qgsmapsettingsutils.py +++ b/python/PyQt6/core/auto_additions/qgsmapsettingsutils.py @@ -1,11 +1,11 @@ # 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` .. versionadded:: 3.14 -* ``IgnoreGeoPdfSupportedEffects``: Ignore advanced effects which are supported in GeoPDF exports +* ``IgnoreGeoPdfSupportedEffects``: Ignore advanced effects which are supported in geospatial PDF exports """ # -- diff --git a/python/PyQt6/core/auto_generated/layout/qgslayoutitem.sip.in b/python/PyQt6/core/auto_generated/layout/qgslayoutitem.sip.in index 7bc94a70b6f5..73e47aa7ccbc 100644 --- a/python/PyQt6/core/auto_generated/layout/qgslayoutitem.sip.in +++ b/python/PyQt6/core/auto_generated/layout/qgslayoutitem.sip.in @@ -432,7 +432,7 @@ Sets the item's parent ``group``. virtual ExportLayerBehavior exportLayerBehavior() const; %Docstring -Returns the behavior of this item during exporting to layered exports (e.g. SVG or GeoPDF). +Returns the behavior of this item during exporting to layered exports (e.g. SVG or geospatial PDF). .. seealso:: :py:func:`numberExportLayers` diff --git a/python/PyQt6/core/auto_generated/providers/qgsprovidersublayerdetails.sip.in b/python/PyQt6/core/auto_generated/providers/qgsprovidersublayerdetails.sip.in index 12d0c8048c5d..4c0e80babbce 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/qgslayoutexporter.py b/python/core/auto_additions/qgslayoutexporter.py index 6b7cef4511e6..e6187b50435f 100644 --- a/python/core/auto_additions/qgslayoutexporter.py +++ b/python/core/auto_additions/qgslayoutexporter.py @@ -12,7 +12,7 @@ except NameError: pass try: - QgsLayoutExporter.PdfExportSettings.__attribute_docs__ = {'dpi': 'Resolution to export layout at. If dpi <= 0 the default layout dpi will be used.', 'rasterizeWholeImage': 'Set to ``True`` to force whole layout to be rasterized while exporting.\n\nThis option is mutually exclusive with forceVectorOutput.', 'forceVectorOutput': 'Set to ``True`` to force vector object exports, even when the resultant appearance will differ\nfrom the layout. If ``False``, some items may be rasterized in order to maintain their\ncorrect appearance in the output.\n\nThis option is mutually exclusive with rasterizeWholeImage.', 'appendGeoreference': 'Indicates whether PDF export should append georeference data\n\n.. versionadded:: 3.10', 'exportMetadata': "Indicates whether PDF export should include metadata generated\nfrom the layout's project's metadata.\n\n.. versionadded:: 3.2", 'flags': 'Layout context flags, which control how the export will be created.', 'textRenderFormat': 'Text rendering format, which controls how text should be rendered in the export (e.g.\nas paths or real text objects).\n\n.. versionadded:: 3.4.3', 'simplifyGeometries': 'Indicates whether vector geometries should be simplified to avoid redundant extraneous detail,\nsuch as vertices which are not visible at the specified dpi of the output.\n\n.. versionadded:: 3.10', 'writeGeoPdf': '``True`` if GeoPDF files should be created, instead of normal PDF files.\n\nWhilst GeoPDF files can include some desirable properties like the ability to interactively\nquery map features, they also can result in lower-quality output files, or forced rasterization\nof layers.\n\n.. note::\n\n Requires builds based on GDAL 3.0 or greater.\n\n.. versionadded:: 3.10', 'exportLayersAsSeperateFiles': '``True`` if individual layers from the layout should be rendered to separate PDF files.\n\nThis option allows for separation of logic layout layers to individual PDF files. For instance,\nif this option is ``True``, then a separate PDF file will be created per layer per map item in the\nlayout. Additionally, separate PDF files may be created for other complex layout items, resulting\nin a set of PDF files which contain logical atomic components of the layout.\n\nThis option is designed to allow the PDF files to be composited back together in an external\napplication (e.g. Adobe Illustrator) as a non-QGIS, post-production step.\n\n.. versionadded:: 3.14', 'useIso32000ExtensionFormatGeoreferencing': '``True`` if ISO3200 extension format georeferencing should be used.\n\nThis is a recommended setting which results in Geospatial PDF files compatible\nwith the built-in Acrobat geospatial tools.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'useOgcBestPracticeFormatGeoreferencing': '``True`` if OGC "best practice" format georeferencing should be used.\n\n.. warning::\n\n This results in GeoPDF files compatible with the TerraGo suite of tools, but\n can break compatibility with the built-in Acrobat geospatial tools (yes, GeoPDF\n format is a mess!).\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'includeGeoPdfFeatures': '``True`` if feature vector information (such as attributes) should be exported during GeoPDF exports.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'exportThemes': "Optional list of map themes to export as GeoPDF layer groups.\n\nIf set, map item's which are not assigned a specific map theme will iterate through all listed\nthemes and a GeoPDF layer group will be created for each.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.", 'predefinedMapScales': 'A list of predefined scales to use with the layout. This is used\nfor maps which are set to the predefined atlas scaling mode.\n\n.. versionadded:: 3.10'} + QgsLayoutExporter.PdfExportSettings.__attribute_docs__ = {'dpi': 'Resolution to export layout at. If dpi <= 0 the default layout dpi will be used.', 'rasterizeWholeImage': 'Set to ``True`` to force whole layout to be rasterized while exporting.\n\nThis option is mutually exclusive with forceVectorOutput.', 'forceVectorOutput': 'Set to ``True`` to force vector object exports, even when the resultant appearance will differ\nfrom the layout. If ``False``, some items may be rasterized in order to maintain their\ncorrect appearance in the output.\n\nThis option is mutually exclusive with rasterizeWholeImage.', 'appendGeoreference': 'Indicates whether PDF export should append georeference data\n\n.. versionadded:: 3.10', 'exportMetadata': "Indicates whether PDF export should include metadata generated\nfrom the layout's project's metadata.\n\n.. versionadded:: 3.2", 'flags': 'Layout context flags, which control how the export will be created.', 'textRenderFormat': 'Text rendering format, which controls how text should be rendered in the export (e.g.\nas paths or real text objects).\n\n.. versionadded:: 3.4.3', 'simplifyGeometries': 'Indicates whether vector geometries should be simplified to avoid redundant extraneous detail,\nsuch as vertices which are not visible at the specified dpi of the output.\n\n.. versionadded:: 3.10', 'writeGeoPdf': '``True`` if geospatial PDF files should be created, instead of normal PDF files.\n\nWhilst geospatial PDF files can include some desirable properties like the ability to interactively\nquery map features, they also can result in lower-quality output files, or forced rasterization\nof layers.\n\n.. note::\n\n Requires builds based on GDAL 3.0 or greater.\n\n.. versionadded:: 3.10', 'exportLayersAsSeperateFiles': '``True`` if individual layers from the layout should be rendered to separate PDF files.\n\nThis option allows for separation of logic layout layers to individual PDF files. For instance,\nif this option is ``True``, then a separate PDF file will be created per layer per map item in the\nlayout. Additionally, separate PDF files may be created for other complex layout items, resulting\nin a set of PDF files which contain logical atomic components of the layout.\n\nThis option is designed to allow the PDF files to be composited back together in an external\napplication (e.g. Adobe Illustrator) as a non-QGIS, post-production step.\n\n.. versionadded:: 3.14', 'useIso32000ExtensionFormatGeoreferencing': '``True`` if ISO3200 extension format georeferencing should be used.\n\nThis is a recommended setting which results in Geospatial PDF files compatible\nwith the built-in Acrobat geospatial tools.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'useOgcBestPracticeFormatGeoreferencing': '``True`` if OGC "best practice" format georeferencing should be used.\n\n.. warning::\n\n This results in geospatial PDF files compatible with a unnamed suite of tools starting with Terra and ending with Go, but\n can break compatibility with the built-in Acrobat geospatial tools (yes, Geospatial PDF\n format is a mess!).\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'includeGeoPdfFeatures': '``True`` if feature vector information (such as attributes) should be exported during Geospatial PDF exports.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.', 'exportThemes': "Optional list of map themes to export as Geospatial PDF layer groups.\n\nIf set, map item's which are not assigned a specific map theme will iterate through all listed\nthemes and a Geospatial PDF layer group will be created for each.\n\nIf PdfExportSettings.writeGeoPdf is ``False`` than this option has no effect.", 'predefinedMapScales': 'A list of predefined scales to use with the layout. This is used\nfor maps which are set to the predefined atlas scaling mode.\n\n.. versionadded:: 3.10'} QgsLayoutExporter.PdfExportSettings.__doc__ = """Contains settings relating to exporting layouts to PDF""" QgsLayoutExporter.PdfExportSettings.__group__ = ['layout'] except NameError: diff --git a/python/core/auto_additions/qgsmapsettingsutils.py b/python/core/auto_additions/qgsmapsettingsutils.py index ac70d86e3514..fe0cc5474592 100644 --- a/python/core/auto_additions/qgsmapsettingsutils.py +++ b/python/core/auto_additions/qgsmapsettingsutils.py @@ -1,11 +1,11 @@ # 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` .. versionadded:: 3.14 -* ``IgnoreGeoPdfSupportedEffects``: Ignore advanced effects which are supported in GeoPDF exports +* ``IgnoreGeoPdfSupportedEffects``: Ignore advanced effects which are supported in geospatial PDF exports """ # -- diff --git a/python/core/auto_generated/layout/qgslayoutitem.sip.in b/python/core/auto_generated/layout/qgslayoutitem.sip.in index d04120dea9f9..b47212273977 100644 --- a/python/core/auto_generated/layout/qgslayoutitem.sip.in +++ b/python/core/auto_generated/layout/qgslayoutitem.sip.in @@ -432,7 +432,7 @@ Sets the item's parent ``group``. virtual ExportLayerBehavior exportLayerBehavior() const; %Docstring -Returns the behavior of this item during exporting to layered exports (e.g. SVG or GeoPDF). +Returns the behavior of this item during exporting to layered exports (e.g. SVG or geospatial PDF). .. seealso:: :py:func:`numberExportLayers` diff --git a/python/core/auto_generated/providers/qgsprovidersublayerdetails.sip.in b/python/core/auto_generated/providers/qgsprovidersublayerdetails.sip.in index 12d0c8048c5d..4c0e80babbce 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 23a8701aadb2..2c8a552953c9 100644 --- a/src/app/layout/qgslayoutdesignerdialog.cpp +++ b/src/app/layout/qgslayoutdesignerdialog.cpp @@ -3384,16 +3384,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 ); @@ -4529,7 +4529,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; @@ -4537,11 +4537,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(); @@ -4551,14 +4551,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 ) @@ -4569,7 +4569,7 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport } // open options dialog - QString dialogGeoPdfReason = geoPdfReason; + QString dialogGeospatialPdfReason = geospatialPdfReason; QList< QgsLayoutItemMap * > maps; if ( mLayout ) mLayout->layoutItems( maps ); @@ -4578,20 +4578,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::DataDefinedProperty::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 ); @@ -4600,7 +4600,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 ); @@ -4615,10 +4615,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() ); @@ -4631,11 +4631,11 @@ 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( "pdfGroupOrder" ), dialog.geoPdfGroupOrder() ); + mLayout->setCustomProperty( QStringLiteral( "pdfLayerOrder" ), geospatialPdfLayerOrder.join( QLatin1String( "~~~" ) ) ); + mLayout->setCustomProperty( QStringLiteral( "pdfGroupOrder" ), dialog.geospatialPdfGroupOrder() ); mLayout->setCustomProperty( QStringLiteral( "pdfLosslessImages" ), losslessImages ? 1 : 0 ); } @@ -4644,7 +4644,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 ec6a7715ec11..9868e73f37f9 100644 --- a/src/app/layout/qgslayoutdesignerdialog.h +++ b/src/app/layout/qgslayoutdesignerdialog.h @@ -566,7 +566,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 5c1ae7d778f8..a01d16e3f294 100644 --- a/src/app/qgsmapsavedialog.cpp +++ b/src/app/qgsmapsavedialog.cpp @@ -112,27 +112,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; } @@ -140,7 +140,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" ) ); @@ -533,35 +533,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() ) { @@ -599,7 +599,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 05b3b64cf1f2..c4771d6623c7 100644 --- a/src/core/layout/qgslayoutexporter.cpp +++ b/src/core/layout/qgslayoutexporter.cpp @@ -565,9 +565,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 ); @@ -596,17 +596,17 @@ 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 QSet mutuallyExclusiveGroups; - auto exportFunc = [this, &subSettings, &pdfComponents, &geoPdfExporter, &settings, &baseDir, &baseFileName, &mutuallyExclusiveGroups]( unsigned int layerId, const QgsLayoutItem::ExportLayerDetail & layerDetail )->QgsLayoutExporter::ExportResult + auto exportFunc = [this, &subSettings, &pdfComponents, &geospatialPdfExporter, &settings, &baseDir, &baseFileName, &mutuallyExclusiveGroups]( 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; @@ -618,7 +618,7 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToPdf( const QString &f mutuallyExclusiveGroups.insert( 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 ); @@ -644,7 +644,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(); @@ -654,7 +654,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 = getCreator(); details.creator = getCreator(); @@ -677,7 +677,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 ) ); @@ -702,26 +702,26 @@ 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.layerTreeGroupOrder = geoPdfExporter->layerTreeGroupOrder(); + details.customLayerTreeGroups = geospatialPdfExporter->customLayerTreeGroups(); + details.initialLayerVisibility = geospatialPdfExporter->initialLayerVisibility(); + details.layerOrder = geospatialPdfExporter->layerOrder(); + details.layerTreeGroupOrder = geospatialPdfExporter->layerTreeGroupOrder(); 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; - mErrorMessage = geoPdfExporter->errorMessage(); + mErrorMessage = geospatialPdfExporter->errorMessage(); } } else diff --git a/src/core/layout/qgslayoutexporter.h b/src/core/layout/qgslayoutexporter.h index 834a6a18e956..e15f6b6692c1 100644 --- a/src/core/layout/qgslayoutexporter.h +++ b/src/core/layout/qgslayoutexporter.h @@ -324,9 +324,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. * @@ -364,8 +364,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. @@ -373,17 +373,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 072c11a59798..6585a46ba0c6 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,7 +137,7 @@ 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 ); } @@ -145,13 +145,13 @@ QgsLayoutGeoPdfExporter::QgsLayoutGeoPdfExporter( QgsLayout *layout ) mLayerTreeGroupOrder = mLayout->customProperty( QStringLiteral( "pdfGroupOrder" ) ).toStringList(); // 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 ) { @@ -167,7 +167,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 ) @@ -177,7 +177,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 9c32018f37e2..2ce8ed1a7e26 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. @@ -71,8 +71,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. * * \see layerTreeGroupOrder() * \since QGIS 3.14 @@ -80,9 +80,9 @@ class CORE_EXPORT QgsLayoutGeoPdfExporter : public QgsAbstractGeoPdfExporter QStringList layerOrder() const { return mLayerOrder; } /** - * Specifies the ordering of layer tree groups in the generated GeoPDF file. + * Specifies the ordering of layer tree groups in the generated geospatial PDF file. * - * Groups appearing earlier in the list will show earlier in the GeoPDF layer tree list. + * Groups appearing earlier in the list will show earlier in the geospatial PDF layer tree list. * * \see layerOrder() * \see customLayerTreeGroups() @@ -96,14 +96,14 @@ 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; QStringList mLayerTreeGroupOrder; - friend class TestQgsLayoutGeoPdfExport; + friend class TestQgsLayoutGeospatialPdfExport; }; #endif //QGSLAYOUTGEOPDFEXPORTER_H diff --git a/src/core/layout/qgslayoutitem.h b/src/core/layout/qgslayoutitem.h index 95d5545d4e26..6f62e660aa42 100644 --- a/src/core/layout/qgslayoutitem.h +++ b/src/core/layout/qgslayoutitem.h @@ -462,7 +462,7 @@ class CORE_EXPORT QgsLayoutItem : public QgsLayoutObject, public QGraphicsRectIt }; /** - * Returns the behavior of this item during exporting to layered exports (e.g. SVG or GeoPDF). + * Returns the behavior of this item during exporting to layered exports (e.g. SVG or geospatial PDF). * * \see numberExportLayers() * \see exportLayerDetails() diff --git a/src/core/layout/qgslayoutitemmap.h b/src/core/layout/qgslayoutitemmap.h index 38c4a8015797..a681f013990c 100644 --- a/src/core/layout/qgslayoutitemmap.h +++ b/src/core/layout/qgslayoutitemmap.h @@ -1245,7 +1245,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 67c742e1dfab..bd922a1beecd 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 4e8f624c6f3f..9390bcc3a61d 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 @@ -59,8 +59,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. */ @@ -68,7 +68,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 @@ -142,7 +142,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; @@ -157,8 +157,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 86c349b0f874..f77f06bee406 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 6d364aa89223..03178ed7660f 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,7 +69,7 @@ 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." ); } void CPL_STDCALL collectErrors( CPLErr, int, const char *msg ) @@ -81,7 +81,7 @@ void CPL_STDCALL collectErrors( CPLErr, int, const char *msg ) } } -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; @@ -111,7 +111,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; } @@ -153,12 +153,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 ) { @@ -183,7 +183,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 ); @@ -194,7 +194,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 ) { @@ -299,7 +299,7 @@ struct TreeNode }; ///@endcond -QString QgsAbstractGeoPdfExporter::createCompositionXml( const QList &components, const ExportDetails &details ) +QString QgsAbstractGeospatialPdfExporter::createCompositionXml( const QList &components, const ExportDetails &details ) { QDomDocument doc; @@ -526,7 +526,7 @@ QString QgsAbstractGeoPdfExporter::createCompositionXml( const QList controlPoints; + QList< QgsAbstractGeospatialPdfExporter::ControlPoint > controlPoints; }; @@ -187,7 +187,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 { @@ -198,7 +198,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; @@ -233,8 +233,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; @@ -274,9 +274,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. * * \see layerTreeGroupOrder * @@ -285,9 +285,9 @@ class CORE_EXPORT QgsAbstractGeoPdfExporter QStringList layerOrder; /** - * Specifies the ordering of layer tree groups in the generated GeoPDF file. + * Specifies the ordering of layer tree groups in the generated Geospatial PDF file. * - * Groups appearing earlier in the list will show earlier in the GeoPDF layer tree list. + * Groups appearing earlier in the list will show earlier in the Geospatial PDF layer tree list. * * \see layerOrder * \see customLayerTreeGroups @@ -312,13 +312,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. @@ -326,13 +326,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 */ @@ -341,7 +341,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 { @@ -383,15 +383,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 93d24ac141c0..b0892a9a7806 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 1391749deb73..e3fdbf68f31c 100644 --- a/src/core/qgsmapsettingsutils.h +++ b/src/core/qgsmapsettingsutils.h @@ -39,7 +39,7 @@ class CORE_EXPORT QgsMapSettingsUtils */ enum class EffectsCheckFlag : int SIP_ENUM_BASETYPE( IntFlag ) { - 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 c97a55d445a5..88ea74ebf0e7 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 57a3058938c8..df55c7a13845 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,25 +251,25 @@ 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 ), static_cast< int >( QgsMapLayerModel::CustomRole::LayerId ) ).toString(); + order << mGeospatialPdfStructureProxyModel->data( mGeospatialPdfStructureProxyModel->index( row, 0 ), static_cast< int >( QgsMapLayerModel::CustomRole::LayerId ) ).toString(); } return order; } -QStringList QgsLayoutPdfExportOptionsDialog::geoPdfGroupOrder() const +QStringList QgsLayoutPdfExportOptionsDialog::geospatialPdfGroupOrder() const { // we don't explicitly expose a "group order" widget in the dialog -- rather // we use the ordering of the layers, and build the group ordering based // on grouped layers which appear first QStringList groupOrder; - for ( int row = 0; row < mGeoPdfStructureProxyModel->rowCount(); ++row ) + for ( int row = 0; row < mGeospatialPdfStructureProxyModel->rowCount(); ++row ) { - const QString group = mGeoPdfStructureProxyModel->data( mGeoPdfStructureProxyModel->index( row, QgsGeoPdfLayerTreeModel::GroupColumn ), Qt::DisplayRole ).toString().trimmed(); + const QString group = mGeospatialPdfStructureProxyModel->data( mGeospatialPdfStructureProxyModel->index( row, QgsGeospatialPdfLayerTreeModel::GroupColumn ), Qt::DisplayRole ).toString().trimmed(); if ( !group.isEmpty() && !groupOrder.contains( group ) ) groupOrder << group; } @@ -291,26 +291,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; } @@ -319,8 +319,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 68c39c5aec44..a3ec93bafd20 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,11 +104,11 @@ 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; - //! Returns a list of groups in the desired order they should appear in a generated GeoPDF file - QStringList geoPdfGroupOrder() const; + //! Returns a list of groups in the desired order they should appear in a generated Geospatial PDF file + QStringList geospatialPdfGroupOrder() const; //! Sets whether to open the pdf after exporting it void setOpenAfterExporting( bool enabled ); @@ -118,14 +118,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 f01a6b926f06..8061e6e453c2 100644 --- a/src/server/services/wms/qgswmsparameters.cpp +++ b/src/server/services/wms/qgswmsparameters.cpp @@ -2280,15 +2280,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 63d85d9ca9aa..2627c3fa415f 100644 --- a/src/server/services/wms/qgswmsparameters.h +++ b/src/server/services/wms/qgswmsparameters.h @@ -1418,10 +1418,10 @@ namespace QgsWms bool exportLinesWithZeroWidth() const; /** - * Returns if a GeoPDF shall be exported + * Returns if a geospatial PDF shall be exported * \since QGIS 3.32 */ - bool writeGeoPdf() const; + bool writeGeospatialPdf() const; /** * Returns if pdf should be exported as vector @@ -1478,7 +1478,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 86e1a5c844af..ed5d0bcb9253 100644 --- a/src/server/services/wms/qgswmsrenderer.cpp +++ b/src/server/services/wms/qgswmsrenderer.cpp @@ -718,7 +718,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(); @@ -1228,7 +1228,7 @@ namespace QgsWms ms.setOutputSize( QSize( mWmsParameters.widthAsInt(), mWmsParameters.heightAsInt() ) ); ms.setDpiTarget( mWmsParameters.dpiAsDouble() ); - QgsAbstractGeoPdfExporter::ExportDetails pdfExportDetails; + QgsAbstractGeospatialPdfExporter::ExportDetails pdfExportDetails; if ( mWmsParameters.pdfExportMetadata() ) { pdfExportDetails.author = QgsProject::instance()->metadata().author(); @@ -1241,8 +1241,8 @@ namespace QgsWms } pdfExportDetails.useIso32000ExtensionFormatGeoreferencing = mWmsParameters.pdfUseIso32000ExtensionFormatGeoreferencing(); pdfExportDetails.useOgcBestPracticeFormatGeoreferencing = mWmsParameters.pdfUseOgcBestPracticeFormatGeoreferencing(); - const bool geoPdf = mWmsParameters.pdfAppendGeoreference(); - std::unique_ptr pdf = std::make_unique( ms, tmpFileName, QStringLiteral( "PDF" ), false, QgsTask::Hidden, geoPdf, pdfExportDetails ); + const bool geospatialPdf = mWmsParameters.pdfAppendGeoreference(); + std::unique_ptr pdf = std::make_unique( ms, tmpFileName, QStringLiteral( "PDF" ), false, QgsTask::Hidden, geospatialPdf, pdfExportDetails ); if ( mWmsParameters.pdfAppendGeoreference() ) { pdf->setSaveWorldFile( true ); diff --git a/src/ui/layout/qgslayoutitemwidgetbase.ui b/src/ui/layout/qgslayoutitemwidgetbase.ui index 199ee7ed0d7b..1294e2729592 100644 --- a/src/ui/layout/qgslayoutitemwidgetbase.ui +++ b/src/ui/layout/qgslayoutitemwidgetbase.ui @@ -752,7 +752,7 @@ - GeoPDF group + Geospatial PDF group 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 26e9446e2ccc..e666b8ec47fa 100644 --- a/src/ui/qgsmapsavedialog.ui +++ b/src/ui/qgsmapsavedialog.ui @@ -67,9 +67,9 @@ - + - Create Geospatial PDF (GeoPDF) + Create Geospatial PDF true @@ -79,7 +79,7 @@ - + 1 @@ -98,7 +98,7 @@ 0 - + @@ -121,7 +121,7 @@ 0 - + @@ -131,7 +131,7 @@ - + Include vector feature information @@ -428,9 +428,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 744c00008129..09eadee7af14 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. @@ -61,28 +61,28 @@ class TestQgsGeoPdfExport : public QgsTest void testMutuallyExclusiveGroupsCustom(); }; -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" ), QMetaType::Type::Int ) ); @@ -92,20 +92,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" ) ) { @@ -132,7 +132,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" ) ) { @@ -155,12 +155,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" ), QMetaType::Type::Int ) ); @@ -170,20 +170,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" ) ) { @@ -198,8 +198,8 @@ 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.name = QStringLiteral( "xxx" ); detail.opacity = 0.7; @@ -207,12 +207,12 @@ void TestQgsGeoPdfExport::testComposition() 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 ); @@ -262,14 +262,14 @@ void TestQgsGeoPdfExport::testComposition() } -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 ); @@ -290,7 +290,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" ) ); @@ -303,30 +303,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" ) ); @@ -353,28 +353,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 ); @@ -399,12 +399,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" ), QMetaType::Type::Int ) ); @@ -414,20 +414,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" ) ) { @@ -442,9 +442,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 ); @@ -483,9 +483,9 @@ void TestQgsGeoPdfExport::testGroups() } -void TestQgsGeoPdfExport::testCustomGroups() +void TestQgsGeospatialPdfExport::testCustomGroups() { - TestGeoPdfExporter geoPdfExporter; + TestGeospatialPdfExporter geospatialPdfExporter; QgsFields fields; fields.append( QgsField( QStringLiteral( "a1" ), QMetaType::Type::Int ) ); @@ -495,20 +495,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" ) ) { @@ -523,15 +523,15 @@ 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" ) ); // this group is empty, since layer3 doesn't exist details.customLayerTreeGroups.insert( QStringLiteral( "layer3" ), QStringLiteral( "my empty group" ) ); - QString composition = geoPdfExporter.createCompositionXml( renderedLayers, details ); + QString composition = geospatialPdfExporter.createCompositionXml( renderedLayers, details ); QgsDebugMsgLevel( composition, 1 ); QDomDocument doc; doc.setContent( composition ); @@ -578,9 +578,9 @@ void TestQgsGeoPdfExport::testCustomGroups() QCOMPARE( contentList.at( layer2Idx ).toElement().firstChildElement().elementsByTagName( QStringLiteral( "LogicalStructure" ) ).at( 0 ).toElement().attribute( QStringLiteral( "displayLayerName" ) ), QStringLiteral( "name layer2" ) ); } -void TestQgsGeoPdfExport::testGroupOrder() +void TestQgsGeospatialPdfExport::testGroupOrder() { - TestGeoPdfExporter geoPdfExporter; + TestGeospatialPdfExporter geospatialPdfExporter; QgsFields fields; fields.append( QgsField( QStringLiteral( "a1" ), QMetaType::Type::Int ) ); @@ -590,20 +590,20 @@ void TestQgsGeoPdfExport::testGroupOrder() 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" ) ) { @@ -618,14 +618,14 @@ void TestQgsGeoPdfExport::testGroupOrder() } // 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" ) ); details.layerTreeGroupOrder = QStringList{ QStringLiteral( "my group2" ), QStringLiteral( "my group" )}; - QString composition = geoPdfExporter.createCompositionXml( renderedLayers, details ); + QString composition = geospatialPdfExporter.createCompositionXml( renderedLayers, details ); QgsDebugMsgLevel( composition, 1 ); QDomDocument doc; doc.setContent( composition ); @@ -637,7 +637,7 @@ void TestQgsGeoPdfExport::testGroupOrder() details.layerTreeGroupOrder = QStringList{ QStringLiteral( "my group" ), QStringLiteral( "my group2" )}; - composition = geoPdfExporter.createCompositionXml( renderedLayers, details ); + composition = geospatialPdfExporter.createCompositionXml( renderedLayers, details ); QgsDebugMsgLevel( composition, 1 ); doc.setContent( composition ); @@ -649,7 +649,7 @@ void TestQgsGeoPdfExport::testGroupOrder() // incomplete list details.layerTreeGroupOrder = QStringList{ QStringLiteral( "my group2" )}; - composition = geoPdfExporter.createCompositionXml( renderedLayers, details ); + composition = geospatialPdfExporter.createCompositionXml( renderedLayers, details ); QgsDebugMsgLevel( composition, 1 ); doc.setContent( composition ); @@ -661,7 +661,7 @@ void TestQgsGeoPdfExport::testGroupOrder() // list with extra groups which don't have content details.layerTreeGroupOrder = QStringList{ QStringLiteral( "aaa" ), QStringLiteral( "my group" )}; - composition = geoPdfExporter.createCompositionXml( renderedLayers, details ); + composition = geospatialPdfExporter.createCompositionXml( renderedLayers, details ); QgsDebugMsgLevel( composition, 1 ); doc.setContent( composition ); @@ -671,9 +671,9 @@ void TestQgsGeoPdfExport::testGroupOrder() QCOMPARE( layerTreeList.at( 1 ).toElement().attribute( QStringLiteral( "name" ) ), QStringLiteral( "my group2" ) ); } -void TestQgsGeoPdfExport::testMutuallyExclusiveGroupsLayers() +void TestQgsGeospatialPdfExport::testMutuallyExclusiveGroupsLayers() { - TestGeoPdfExporter geoPdfExporter; + TestGeospatialPdfExporter geospatialPdfExporter; QgsFields fields; fields.append( QgsField( QStringLiteral( "a1" ), QMetaType::Type::Int ) ); @@ -683,18 +683,18 @@ void TestQgsGeoPdfExport::testMutuallyExclusiveGroupsLayers() 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 ) ); f.setAttributes( QgsAttributes() << 41 << 42 ); f.setGeometry( QgsGeometry( new QgsPoint( 6, 7 ) ) ); renderedBounds = QgsGeometry::fromWkt( QStringLiteral( "LineString(6 6, 7 7)" ) ); - geoPdfExporter.pushRenderedFeature( QStringLiteral( "layer3" ), QgsAbstractGeoPdfExporter::RenderedFeature( f, renderedBounds ) ); + geospatialPdfExporter.pushRenderedFeature( QStringLiteral( "layer3" ), QgsAbstractGeospatialPdfExporter::RenderedFeature( f, renderedBounds ) ); - QVERIFY( geoPdfExporter.saveTemporaryLayers() ); - QgsAbstractGeoPdfExporter::VectorComponentDetail component; + QVERIFY( geospatialPdfExporter.saveTemporaryLayers() ); + QgsAbstractGeospatialPdfExporter::VectorComponentDetail component; QString layer1Path; QString layer1Layer; QString layer2Path; @@ -702,7 +702,7 @@ void TestQgsGeoPdfExport::testMutuallyExclusiveGroupsLayers() QString layer3Path; QString layer3Layer; - for ( const auto &it : std::as_const( geoPdfExporter.mVectorComponents ) ) + for ( const auto &it : std::as_const( geospatialPdfExporter.mVectorComponents ) ) { if ( it.mapLayerId == QLatin1String( "layer1" ) ) { @@ -722,8 +722,8 @@ void TestQgsGeoPdfExport::testMutuallyExclusiveGroupsLayers() } // 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" ) ); details.customLayerTreeGroups.insert( QStringLiteral( "layer3" ), QStringLiteral( "my group3" ) ); @@ -731,7 +731,7 @@ void TestQgsGeoPdfExport::testMutuallyExclusiveGroupsLayers() details.mutuallyExclusiveGroups.insert( QStringLiteral( "my group" ) ); details.mutuallyExclusiveGroups.insert( QStringLiteral( "my group2" ) ); - QString composition = geoPdfExporter.createCompositionXml( renderedLayers, details ); + QString composition = geospatialPdfExporter.createCompositionXml( renderedLayers, details ); QgsDebugMsgLevel( composition, 1 ); QDomDocument doc; doc.setContent( composition ); @@ -803,29 +803,29 @@ void TestQgsGeoPdfExport::testMutuallyExclusiveGroupsLayers() QCOMPARE( contentList.at( layer3Idx ).toElement().firstChildElement().elementsByTagName( QStringLiteral( "LogicalStructure" ) ).at( 0 ).toElement().attribute( QStringLiteral( "displayLayerName" ) ), QStringLiteral( "name layer3" ) ); } -void TestQgsGeoPdfExport::testMutuallyExclusiveGroupsCustom() +void TestQgsGeospatialPdfExport::testMutuallyExclusiveGroupsCustom() { - TestGeoPdfExporter geoPdfExporter; + TestGeospatialPdfExporter geospatialPdfExporter; // test creation of the composition xml - QgsAbstractGeoPdfExporter::ComponentLayerDetail group1; + QgsAbstractGeospatialPdfExporter::ComponentLayerDetail group1; group1.group = QStringLiteral( "my group" ); group1.sourcePdfPath = QStringLiteral( "group1.pdf" ); - QgsAbstractGeoPdfExporter::ComponentLayerDetail group2; + QgsAbstractGeospatialPdfExporter::ComponentLayerDetail group2; group2.group = QStringLiteral( "my group2" ); group2.sourcePdfPath = QStringLiteral( "group2.pdf" ); - QgsAbstractGeoPdfExporter::ComponentLayerDetail group3; + QgsAbstractGeospatialPdfExporter::ComponentLayerDetail group3; group3.group = QStringLiteral( "my group3" ); group3.sourcePdfPath = QStringLiteral( "group3.pdf" ); - QgsAbstractGeoPdfExporter::ComponentLayerDetail object4; + QgsAbstractGeospatialPdfExporter::ComponentLayerDetail object4; object4.sourcePdfPath = QStringLiteral( "object4.pdf" ); - QgsAbstractGeoPdfExporter::ExportDetails details; + QgsAbstractGeospatialPdfExporter::ExportDetails details; // groups 1 & 2 should be mutually exclusive details.mutuallyExclusiveGroups.insert( QStringLiteral( "my group" ) ); details.mutuallyExclusiveGroups.insert( QStringLiteral( "my group2" ) ); - QString composition = geoPdfExporter.createCompositionXml( { group1, group2, group3, object4 }, details ); + QString composition = geospatialPdfExporter.createCompositionXml( { group1, group2, group3, object4 }, details ); QgsDebugError( composition ); QDomDocument doc; @@ -871,37 +871,37 @@ void TestQgsGeoPdfExport::testMutuallyExclusiveGroupsCustom() QCOMPARE( contentList.at( 3 ).toElement().attribute( QStringLiteral( "dataset" ) ), QStringLiteral( "object4.pdf" ) ); } -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 82aef71cd52b..61ef9a90846d 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. @@ -44,38 +44,38 @@ class TestQgsLayoutGeoPdfExport : public QgsTest void groupOrder(); }; -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" ) ); @@ -132,19 +132,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; @@ -163,7 +163,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; @@ -186,7 +186,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; @@ -206,14 +206,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; @@ -224,7 +224,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; @@ -233,7 +233,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; @@ -247,7 +247,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; @@ -255,41 +255,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; @@ -300,8 +300,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; @@ -312,8 +312,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; @@ -322,8 +322,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; @@ -332,8 +332,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; @@ -344,7 +344,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" ) ); @@ -377,27 +377,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" ) ); @@ -427,17 +427,17 @@ 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() ); } -void TestQgsLayoutGeoPdfExport::groupOrder() +void TestQgsLayoutGeospatialPdfExport::groupOrder() { QgsProject p; @@ -449,14 +449,14 @@ void TestQgsLayoutGeoPdfExport::groupOrder() l.addLayoutItem( map ); // no group ordering for layout - const QgsLayoutGeoPdfExporter geoPdfExporter( &l ); - QVERIFY( geoPdfExporter.layerTreeGroupOrder().isEmpty() ); + const QgsLayoutGeospatialPdfExporter geospatialPdfExporter( &l ); + QVERIFY( geospatialPdfExporter.layerTreeGroupOrder().isEmpty() ); // custom group order is specified, respect that l.setCustomProperty( QStringLiteral( "pdfGroupOrder" ), QStringList{ QStringLiteral( "group 1" ), QStringLiteral( "GROUP C" ), QStringLiteral( "group 2" ) } ); - const QgsLayoutGeoPdfExporter geoPdfExporter2( &l ); - QCOMPARE( geoPdfExporter2.layerTreeGroupOrder(), QStringList() << QStringLiteral( "group 1" ) << QStringLiteral( "GROUP C" ) << QStringLiteral( "group 2" ) ); + const QgsLayoutGeospatialPdfExporter geospatialPdfExporter2( &l ); + QCOMPARE( geospatialPdfExporter2.layerTreeGroupOrder(), QStringList() << QStringLiteral( "group 1" ) << QStringLiteral( "GROUP C" ) << QStringLiteral( "group 2" ) ); } -QGSTEST_MAIN( TestQgsLayoutGeoPdfExport ) +QGSTEST_MAIN( TestQgsLayoutGeospatialPdfExport ) #include "testqgslayoutgeopdfexport.moc"