Skip to content

Commit

Permalink
Don't use the The Word Which Must Not Be Used
Browse files Browse the repository at this point in the history
I limited the renaming to things that are not in the public API and
are not setting names. This is probably more than we strictly need to
do, but at least this will help doing potential future similar 'grep'
exercises.

(cherry picked from commit 9f605a6)
  • Loading branch information
rouault authored and troopa81 committed Oct 9, 2024
1 parent 271d4dd commit 0450678
Show file tree
Hide file tree
Showing 29 changed files with 486 additions and 488 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion python/core/auto_additions/qgsmapsettingsutils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# The following has been generated automatically from src/core/qgsmapsettingsutils.h
# monkey patching scoped based enum
QgsMapSettingsUtils.EffectsCheckFlag.IgnoreGeoPdfSupportedEffects.__doc__ = "Ignore advanced effects which are supported in GeoPDF exports"
QgsMapSettingsUtils.EffectsCheckFlag.IgnoreGeoPdfSupportedEffects.__doc__ = "Ignore advanced effects which are supported in geospatial PDF exports"
QgsMapSettingsUtils.EffectsCheckFlag.__doc__ = "Flags for controlling the behavior of :py:func:`~QgsMapSettingsUtils.containsAdvancedEffects`\n\n.. versionadded:: 3.14\n\n" + '* ``IgnoreGeoPdfSupportedEffects``: ' + QgsMapSettingsUtils.EffectsCheckFlag.IgnoreGeoPdfSupportedEffects.__doc__
# --
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
44 changes: 22 additions & 22 deletions src/app/layout/qgslayoutdesignerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3339,16 +3339,16 @@ void QgsLayoutDesignerDialog::exportAtlasToPdf()
outputFileName = QDir( dir ).filePath( QStringLiteral( "atlas" ) ); // filename is overridden by atlas
}

bool allowGeoPdfExport = true;
QString geoPdfReason;
bool allowGeospatialPdfExport = true;
QString geospatialPdfReason;
if ( singleFile )
{
allowGeoPdfExport = false;
geoPdfReason = tr( "GeoPDF export is not available when exporting an atlas to a single PDF file." );
allowGeospatialPdfExport = false;
geospatialPdfReason = tr( "Geospatial PDF export is not available when exporting an atlas to a single PDF file." );
}

QgsLayoutExporter::PdfExportSettings pdfSettings;
if ( !getPdfExportSettings( pdfSettings, allowGeoPdfExport, geoPdfReason ) )
if ( !getPdfExportSettings( pdfSettings, allowGeospatialPdfExport, geospatialPdfReason ) )
return;

mView->setPaintingEnabled( false );
Expand Down Expand Up @@ -4477,19 +4477,19 @@ 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;
bool appendGeoreference = true;
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();
Expand All @@ -4499,14 +4499,14 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport
includeMetadata = mLayout->customProperty( QStringLiteral( "pdfIncludeMetadata" ), 1 ).toBool();
disableRasterTiles = mLayout->customProperty( QStringLiteral( "pdfDisableRasterTiles" ), 0 ).toBool();
simplify = mLayout->customProperty( QStringLiteral( "pdfSimplify" ), 1 ).toBool();
geoPdf = mLayout->customProperty( QStringLiteral( "pdfCreateGeoPdf" ), 0 ).toBool();
geospatialPdf = mLayout->customProperty( QStringLiteral( "pdfCreateGeoPdf" ), 0 ).toBool();
useOgcBestPracticeFormat = mLayout->customProperty( QStringLiteral( "pdfOgcBestPracticeFormat" ), 0 ).toBool();
const QString themes = mLayout->customProperty( QStringLiteral( "pdfExportThemes" ) ).toString();
if ( !themes.isEmpty() )
exportThemes = themes.split( QStringLiteral( "~~~" ) );
const QString layerOrder = mLayout->customProperty( QStringLiteral( "pdfLayerOrder" ) ).toString();
if ( !layerOrder.isEmpty() )
geoPdfLayerOrder = layerOrder.split( QStringLiteral( "~~~" ) );
geospatialPdfLayerOrder = layerOrder.split( QStringLiteral( "~~~" ) );

const int prevLayoutSettingLabelsAsOutlines = mLayout->customProperty( QStringLiteral( "pdfTextFormat" ), -1 ).toInt();
if ( prevLayoutSettingLabelsAsOutlines >= 0 )
Expand All @@ -4517,7 +4517,7 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport
}

// open options dialog
QString dialogGeoPdfReason = geoPdfReason;
QString dialogGeospatialPdfReason = geospatialPdfReason;
QList< QgsLayoutItemMap * > maps;
if ( mLayout )
mLayout->layoutItems( maps );
Expand All @@ -4526,20 +4526,20 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport
{
if ( !map->crs().isValid() )
{
allowGeoPdfExport = false;
dialogGeoPdfReason = tr( "One or more map items do not have a valid CRS set. This is required for GeoPDF export." );
allowGeospatialPdfExport = false;
dialogGeospatialPdfReason = tr( "One or more map items do not have a valid CRS set. This is required for geospatial PDF export." );
break;
}

if ( map->mapRotation() != 0 || map->itemRotation() != 0 || map->dataDefinedProperties().isActive( QgsLayoutObject::MapRotation ) )
{
allowGeoPdfExport = false;
dialogGeoPdfReason = tr( "One or more map items are rotated. This is not supported for GeoPDF export." );
allowGeospatialPdfExport = false;
dialogGeospatialPdfReason = tr( "One or more map items are rotated. This is not supported for geospatial PDF export." );
break;
}
}

QgsLayoutPdfExportOptionsDialog dialog( this, allowGeoPdfExport, dialogGeoPdfReason, geoPdfLayerOrder );
QgsLayoutPdfExportOptionsDialog dialog( this, allowGeospatialPdfExport, dialogGeospatialPdfReason, geospatialPdfLayerOrder );

dialog.setTextRenderFormat( prevTextRenderFormat );
dialog.setForceVector( forceVector );
Expand All @@ -4548,7 +4548,7 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport
dialog.setMetadataEnabled( includeMetadata );
dialog.setRasterTilingDisabled( disableRasterTiles );
dialog.setGeometriesSimplified( simplify );
dialog.setExportGeoPdf( geoPdf );
dialog.setExportGeospatialPdf( geospatialPdf );
dialog.setUseOgcBestPracticeFormat( useOgcBestPracticeFormat );
dialog.setExportThemes( exportThemes );
dialog.setLosslessImageExport( losslessImages );
Expand All @@ -4563,10 +4563,10 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport
disableRasterTiles = dialog.rasterTilingDisabled();
simplify = dialog.geometriesSimplified();
Qgis::TextRenderFormat textRenderFormat = dialog.textRenderFormat();
geoPdf = dialog.exportGeoPdf();
geospatialPdf = dialog.exportGeospatialPdf();
useOgcBestPracticeFormat = dialog.useOgcBestPracticeFormat();
exportThemes = dialog.exportThemes();
geoPdfLayerOrder = dialog.geoPdfLayerOrder();
geospatialPdfLayerOrder = dialog.geospatialPdfLayerOrder();
losslessImages = dialog.losslessImageExport();
QgsLayoutExporter::settingOpenAfterExportingPdf->setValue( dialog.openAfterExporting() );

Expand All @@ -4579,10 +4579,10 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport
mLayout->setCustomProperty( QStringLiteral( "pdfDisableRasterTiles" ), disableRasterTiles ? 1 : 0 );
mLayout->setCustomProperty( QStringLiteral( "pdfTextFormat" ), static_cast< int >( textRenderFormat ) );
mLayout->setCustomProperty( QStringLiteral( "pdfSimplify" ), simplify ? 1 : 0 );
mLayout->setCustomProperty( QStringLiteral( "pdfCreateGeoPdf" ), geoPdf ? 1 : 0 );
mLayout->setCustomProperty( QStringLiteral( "pdfCreateGeoPdf" ), geospatialPdf ? 1 : 0 );
mLayout->setCustomProperty( QStringLiteral( "pdfOgcBestPracticeFormat" ), useOgcBestPracticeFormat ? 1 : 0 );
mLayout->setCustomProperty( QStringLiteral( "pdfExportThemes" ), exportThemes.join( QLatin1String( "~~~" ) ) );
mLayout->setCustomProperty( QStringLiteral( "pdfLayerOrder" ), geoPdfLayerOrder.join( QLatin1String( "~~~" ) ) );
mLayout->setCustomProperty( QStringLiteral( "pdfLayerOrder" ), geospatialPdfLayerOrder.join( QLatin1String( "~~~" ) ) );
mLayout->setCustomProperty( QStringLiteral( "pdfLosslessImages" ), losslessImages ? 1 : 0 );
}

Expand All @@ -4591,7 +4591,7 @@ bool QgsLayoutDesignerDialog::getPdfExportSettings( QgsLayoutExporter::PdfExport
settings.exportMetadata = includeMetadata;
settings.textRenderFormat = textRenderFormat;
settings.simplifyGeometries = simplify;
settings.writeGeoPdf = geoPdf;
settings.writeGeoPdf = geospatialPdf;
settings.useOgcBestPracticeFormatGeoreferencing = useOgcBestPracticeFormat;
settings.useIso32000ExtensionFormatGeoreferencing = !useOgcBestPracticeFormat;
settings.exportThemes = exportThemes;
Expand Down
2 changes: 1 addition & 1 deletion src/app/layout/qgslayoutdesignerdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ class QgsLayoutDesignerDialog: public QMainWindow, public Ui::QgsLayoutDesignerB
bool showFileSizeWarning();
bool getRasterExportSettings( QgsLayoutExporter::ImageExportSettings &settings, QSize &imageSize );
bool getSvgExportSettings( QgsLayoutExporter::SvgExportSettings &settings );
bool getPdfExportSettings( QgsLayoutExporter::PdfExportSettings &settings, bool allowGeoPdfExport = true, const QString &geoPdfReason = QString() );
bool getPdfExportSettings( QgsLayoutExporter::PdfExportSettings &settings, bool allowGeospatialPdfExport = true, const QString &geospatialPdfReason = QString() );

void toggleAtlasActions( bool enabled );

Expand Down
64 changes: 32 additions & 32 deletions src/app/qgsmapsavedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,35 +115,35 @@ 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;
}

case Image:
{
mExportMetadataCheckBox->hide();
mGeoPDFGroupBox->hide();
mGeospatialPDFGroupBox->hide();
mAdvancedPdfSettings->hide();
mTextExportLabel->hide();
QPushButton *button = new QPushButton( tr( "Copy to Clipboard" ) );
Expand Down Expand Up @@ -520,35 +520,35 @@ void QgsMapSaveDialog::onAccepted()

ms.setTextRenderFormat( static_cast< Qgis::TextRenderFormat >( mTextRenderFormatComboBox->currentData().toInt() ) );

QgsAbstractGeoPdfExporter::ExportDetails geoPdfExportDetails;
QgsAbstractGeospatialPdfExporter::ExportDetails geospatialPdfExportDetails;
if ( mExportMetadataCheckBox->isChecked() )
{
// These details will be used on non-GeoPDF exports is the export metadata checkbox is checked
geoPdfExportDetails.author = QgsProject::instance()->metadata().author();
geoPdfExportDetails.producer = QStringLiteral( "QGIS %1" ).arg( Qgis::version() );
geoPdfExportDetails.creator = QStringLiteral( "QGIS %1" ).arg( Qgis::version() );
geoPdfExportDetails.creationDateTime = QDateTime::currentDateTime();
geoPdfExportDetails.subject = QgsProject::instance()->metadata().abstract();
geoPdfExportDetails.title = QgsProject::instance()->metadata().title();
geoPdfExportDetails.keywords = QgsProject::instance()->metadata().keywords();
// These details will be used on non-Geospatial PDF exports is the export metadata checkbox is checked
geospatialPdfExportDetails.author = QgsProject::instance()->metadata().author();
geospatialPdfExportDetails.producer = QStringLiteral( "QGIS %1" ).arg( Qgis::version() );
geospatialPdfExportDetails.creator = QStringLiteral( "QGIS %1" ).arg( Qgis::version() );
geospatialPdfExportDetails.creationDateTime = QDateTime::currentDateTime();
geospatialPdfExportDetails.subject = QgsProject::instance()->metadata().abstract();
geospatialPdfExportDetails.title = QgsProject::instance()->metadata().title();
geospatialPdfExportDetails.keywords = QgsProject::instance()->metadata().keywords();
}

if ( mGeoPDFGroupBox->isChecked() )
if ( mGeospatialPDFGroupBox->isChecked() )
{
if ( mGeoPdfFormatComboBox->currentIndex() == 0 )
if ( mGeospatialPdfFormatComboBox->currentIndex() == 0 )
{
geoPdfExportDetails.useIso32000ExtensionFormatGeoreferencing = true;
geoPdfExportDetails.useOgcBestPracticeFormatGeoreferencing = false;
geospatialPdfExportDetails.useIso32000ExtensionFormatGeoreferencing = true;
geospatialPdfExportDetails.useOgcBestPracticeFormatGeoreferencing = false;
}
else
{
geoPdfExportDetails.useIso32000ExtensionFormatGeoreferencing = false;
geoPdfExportDetails.useOgcBestPracticeFormatGeoreferencing = true;
geospatialPdfExportDetails.useIso32000ExtensionFormatGeoreferencing = false;
geospatialPdfExportDetails.useOgcBestPracticeFormatGeoreferencing = true;
}

geoPdfExportDetails.includeFeatures = mExportGeoPdfFeaturesCheckBox->isChecked();
geospatialPdfExportDetails.includeFeatures = mExportGeospatialPdfFeaturesCheckBox->isChecked();
}
QgsMapRendererTask *mapRendererTask = new QgsMapRendererTask( ms, fileName, QStringLiteral( "PDF" ), saveAsRaster(), QgsTask::CanCancel, mGeoPDFGroupBox->isChecked(), geoPdfExportDetails );
QgsMapRendererTask *mapRendererTask = new QgsMapRendererTask( ms, fileName, QStringLiteral( "PDF" ), saveAsRaster(), QgsTask::CanCancel, mGeospatialPDFGroupBox->isChecked(), geospatialPdfExportDetails );

if ( drawAnnotations() )
{
Expand Down Expand Up @@ -586,7 +586,7 @@ void QgsMapSaveDialog::onAccepted()

void QgsMapSaveDialog::updatePdfExportWarning()
{
const QStringList layers = QgsMapSettingsUtils::containsAdvancedEffects( mMapCanvas->mapSettings(), mGeoPDFGroupBox->isChecked() ? QgsMapSettingsUtils::EffectsCheckFlags( QgsMapSettingsUtils::EffectsCheckFlag::IgnoreGeoPdfSupportedEffects ) : QgsMapSettingsUtils::EffectsCheckFlags() );
const QStringList layers = QgsMapSettingsUtils::containsAdvancedEffects( mMapCanvas->mapSettings(), mGeospatialPDFGroupBox->isChecked() ? QgsMapSettingsUtils::EffectsCheckFlags( QgsMapSettingsUtils::EffectsCheckFlag::IgnoreGeoPdfSupportedEffects ) : QgsMapSettingsUtils::EffectsCheckFlags() );
if ( !layers.isEmpty() )
{
mInfoDetails = tr( "The following layer(s) use advanced effects:\n\n%1\n\nRasterizing map is recommended for proper rendering." ).arg(
Expand Down
Loading

0 comments on commit 0450678

Please sign in to comment.