mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-04 00:04:03 -04:00
Respect project scale method in processing algorithms
Algorithms which use map settings now respect the current project scale method
This commit is contained in:
parent
d3c6a09702
commit
9e1ba962f5
@ -88,6 +88,7 @@ bool QgsDxfExportAlgorithm::prepareAlgorithm( const QVariantMap ¶meters, Qgs
|
||||
{
|
||||
mMapThemeStyleOverrides = context.project()->mapThemeCollection()->mapThemeStyleOverrides( mapTheme );
|
||||
}
|
||||
mScaleMethod = context.project()->scaleMethod();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -96,6 +97,7 @@ QVariantMap QgsDxfExportAlgorithm::processAlgorithm( const QVariantMap ¶mete
|
||||
QgsMapSettings mapSettings;
|
||||
mapSettings.setTransformContext( context.transformContext() );
|
||||
mapSettings.setLayerStyleOverrides( mMapThemeStyleOverrides );
|
||||
mapSettings.setScaleMethod( mScaleMethod );
|
||||
|
||||
QList<QgsVectorLayer *> mapLayers;
|
||||
|
||||
|
@ -41,6 +41,7 @@ class QgsDxfExportAlgorithm : public QgsProcessingAlgorithm
|
||||
|
||||
private:
|
||||
QMap<QString, QString> mMapThemeStyleOverrides;
|
||||
Qgis::ScaleCalculationMethod mScaleMethod = Qgis::ScaleCalculationMethod::HorizontalMiddle;
|
||||
};
|
||||
|
||||
///@endcond PRIVATE
|
||||
|
@ -398,6 +398,7 @@ QVariantMap QgsExtractLabelsAlgorithm::processAlgorithm( const QVariantMap ¶
|
||||
mapSettings.setLayers( mMapLayers );
|
||||
mapSettings.setLayerStyleOverrides( mMapThemeStyleOverrides );
|
||||
mapSettings.setLabelingEngineSettings( mLabelSettings );
|
||||
mapSettings.setScaleMethod( mScaleMethod );
|
||||
|
||||
//build the expression context
|
||||
QgsExpressionContext expressionContext;
|
||||
@ -613,6 +614,8 @@ bool QgsExtractLabelsAlgorithm::prepareAlgorithm( const QVariantMap ¶meters,
|
||||
mLabelSettings.setFlag( Qgis::LabelingFlag::DrawUnplacedLabels, includeUnplaced );
|
||||
mLabelSettings.setFlag( Qgis::LabelingFlag::CollectUnplacedLabels, includeUnplaced );
|
||||
|
||||
mScaleMethod = context.project()->scaleMethod();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,7 @@ class QgsExtractLabelsAlgorithm : public QgsProcessingAlgorithm
|
||||
QMap<QString, QString> mMapThemeStyleOverrides;
|
||||
QgsLabelingEngineSettings mLabelSettings;
|
||||
QgsCoordinateReferenceSystem mCrs;
|
||||
Qgis::ScaleCalculationMethod mScaleMethod = Qgis::ScaleCalculationMethod::HorizontalMiddle;
|
||||
};
|
||||
|
||||
///@endcond PRIVATE
|
||||
|
@ -411,6 +411,8 @@ bool QgsRasterizeAlgorithm::prepareAlgorithm( const QVariantMap ¶meters, Qgs
|
||||
}
|
||||
mMapSettings.setBackgroundColor( bgColor );
|
||||
|
||||
mMapSettings.setScaleMethod( context.project()->scaleMethod() );
|
||||
|
||||
return mMapLayers.size() > 0;
|
||||
}
|
||||
|
||||
|
@ -200,6 +200,8 @@ bool QgsXyzTilesBaseAlgorithm::prepareAlgorithm( const QVariantMap ¶meters,
|
||||
feedback->pushWarning( QObject::tr( "Background color setting ignored, the JPG format only supports fully opaque colors" ) );
|
||||
}
|
||||
|
||||
mScaleMethod = project->scaleMethod();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -241,6 +243,7 @@ void QgsXyzTilesBaseAlgorithm::startJobs()
|
||||
settings.setLayers( mLayers );
|
||||
settings.setOutputDpi( mDpi );
|
||||
settings.setFlag( Qgis::MapSettingsFlag::Antialiasing, mAntialias );
|
||||
settings.setScaleMethod( mScaleMethod );
|
||||
if ( mTileFormat == QLatin1String( "PNG" ) || mBackgroundColor.alpha() == 255 )
|
||||
{
|
||||
settings.setBackgroundColor( mBackgroundColor );
|
||||
|
@ -130,6 +130,7 @@ class QgsXyzTilesBaseAlgorithm : public QgsProcessingAlgorithm
|
||||
QPointer<QEventLoop> mEventLoop;
|
||||
QList<MetaTile> mMetaTiles;
|
||||
QMap<QgsMapRendererSequentialJob *, MetaTile> mRendererJobs;
|
||||
Qgis::ScaleCalculationMethod mScaleMethod = Qgis::ScaleCalculationMethod::HorizontalMiddle;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user