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 );
|
mMapThemeStyleOverrides = context.project()->mapThemeCollection()->mapThemeStyleOverrides( mapTheme );
|
||||||
}
|
}
|
||||||
|
mScaleMethod = context.project()->scaleMethod();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,6 +97,7 @@ QVariantMap QgsDxfExportAlgorithm::processAlgorithm( const QVariantMap ¶mete
|
|||||||
QgsMapSettings mapSettings;
|
QgsMapSettings mapSettings;
|
||||||
mapSettings.setTransformContext( context.transformContext() );
|
mapSettings.setTransformContext( context.transformContext() );
|
||||||
mapSettings.setLayerStyleOverrides( mMapThemeStyleOverrides );
|
mapSettings.setLayerStyleOverrides( mMapThemeStyleOverrides );
|
||||||
|
mapSettings.setScaleMethod( mScaleMethod );
|
||||||
|
|
||||||
QList<QgsVectorLayer *> mapLayers;
|
QList<QgsVectorLayer *> mapLayers;
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ class QgsDxfExportAlgorithm : public QgsProcessingAlgorithm
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<QString, QString> mMapThemeStyleOverrides;
|
QMap<QString, QString> mMapThemeStyleOverrides;
|
||||||
|
Qgis::ScaleCalculationMethod mScaleMethod = Qgis::ScaleCalculationMethod::HorizontalMiddle;
|
||||||
};
|
};
|
||||||
|
|
||||||
///@endcond PRIVATE
|
///@endcond PRIVATE
|
||||||
|
@ -398,6 +398,7 @@ QVariantMap QgsExtractLabelsAlgorithm::processAlgorithm( const QVariantMap ¶
|
|||||||
mapSettings.setLayers( mMapLayers );
|
mapSettings.setLayers( mMapLayers );
|
||||||
mapSettings.setLayerStyleOverrides( mMapThemeStyleOverrides );
|
mapSettings.setLayerStyleOverrides( mMapThemeStyleOverrides );
|
||||||
mapSettings.setLabelingEngineSettings( mLabelSettings );
|
mapSettings.setLabelingEngineSettings( mLabelSettings );
|
||||||
|
mapSettings.setScaleMethod( mScaleMethod );
|
||||||
|
|
||||||
//build the expression context
|
//build the expression context
|
||||||
QgsExpressionContext expressionContext;
|
QgsExpressionContext expressionContext;
|
||||||
@ -613,6 +614,8 @@ bool QgsExtractLabelsAlgorithm::prepareAlgorithm( const QVariantMap ¶meters,
|
|||||||
mLabelSettings.setFlag( Qgis::LabelingFlag::DrawUnplacedLabels, includeUnplaced );
|
mLabelSettings.setFlag( Qgis::LabelingFlag::DrawUnplacedLabels, includeUnplaced );
|
||||||
mLabelSettings.setFlag( Qgis::LabelingFlag::CollectUnplacedLabels, includeUnplaced );
|
mLabelSettings.setFlag( Qgis::LabelingFlag::CollectUnplacedLabels, includeUnplaced );
|
||||||
|
|
||||||
|
mScaleMethod = context.project()->scaleMethod();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ class QgsExtractLabelsAlgorithm : public QgsProcessingAlgorithm
|
|||||||
QMap<QString, QString> mMapThemeStyleOverrides;
|
QMap<QString, QString> mMapThemeStyleOverrides;
|
||||||
QgsLabelingEngineSettings mLabelSettings;
|
QgsLabelingEngineSettings mLabelSettings;
|
||||||
QgsCoordinateReferenceSystem mCrs;
|
QgsCoordinateReferenceSystem mCrs;
|
||||||
|
Qgis::ScaleCalculationMethod mScaleMethod = Qgis::ScaleCalculationMethod::HorizontalMiddle;
|
||||||
};
|
};
|
||||||
|
|
||||||
///@endcond PRIVATE
|
///@endcond PRIVATE
|
||||||
|
@ -411,6 +411,8 @@ bool QgsRasterizeAlgorithm::prepareAlgorithm( const QVariantMap ¶meters, Qgs
|
|||||||
}
|
}
|
||||||
mMapSettings.setBackgroundColor( bgColor );
|
mMapSettings.setBackgroundColor( bgColor );
|
||||||
|
|
||||||
|
mMapSettings.setScaleMethod( context.project()->scaleMethod() );
|
||||||
|
|
||||||
return mMapLayers.size() > 0;
|
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" ) );
|
feedback->pushWarning( QObject::tr( "Background color setting ignored, the JPG format only supports fully opaque colors" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mScaleMethod = project->scaleMethod();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,6 +243,7 @@ void QgsXyzTilesBaseAlgorithm::startJobs()
|
|||||||
settings.setLayers( mLayers );
|
settings.setLayers( mLayers );
|
||||||
settings.setOutputDpi( mDpi );
|
settings.setOutputDpi( mDpi );
|
||||||
settings.setFlag( Qgis::MapSettingsFlag::Antialiasing, mAntialias );
|
settings.setFlag( Qgis::MapSettingsFlag::Antialiasing, mAntialias );
|
||||||
|
settings.setScaleMethod( mScaleMethod );
|
||||||
if ( mTileFormat == QLatin1String( "PNG" ) || mBackgroundColor.alpha() == 255 )
|
if ( mTileFormat == QLatin1String( "PNG" ) || mBackgroundColor.alpha() == 255 )
|
||||||
{
|
{
|
||||||
settings.setBackgroundColor( mBackgroundColor );
|
settings.setBackgroundColor( mBackgroundColor );
|
||||||
|
@ -130,6 +130,7 @@ class QgsXyzTilesBaseAlgorithm : public QgsProcessingAlgorithm
|
|||||||
QPointer<QEventLoop> mEventLoop;
|
QPointer<QEventLoop> mEventLoop;
|
||||||
QList<MetaTile> mMetaTiles;
|
QList<MetaTile> mMetaTiles;
|
||||||
QMap<QgsMapRendererSequentialJob *, MetaTile> mRendererJobs;
|
QMap<QgsMapRendererSequentialJob *, MetaTile> mRendererJobs;
|
||||||
|
Qgis::ScaleCalculationMethod mScaleMethod = Qgis::ScaleCalculationMethod::HorizontalMiddle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user