18 #ifndef QGSPROCESSINGCONTEXT_H
19 #define QGSPROCESSINGCONTEXT_H
21 #include "qgis_core.h"
56 Q_DECLARE_FLAGS( Flags, Flag )
87 mFlags = other.mFlags;
88 mProject = other.mProject;
89 mTransformContext = other.mTransformContext;
90 mExpressionContext = other.mExpressionContext;
91 mInvalidGeometryCallback = other.mInvalidGeometryCallback;
92 mUseDefaultInvalidGeometryCallback = other.mUseDefaultInvalidGeometryCallback;
93 mInvalidGeometryCheck = other.mInvalidGeometryCheck;
94 mTransformErrorCallback = other.mTransformErrorCallback;
95 mDefaultEncoding = other.mDefaultEncoding;
96 mFeedback = other.mFeedback;
97 mPreferredVectorFormat = other.mPreferredVectorFormat;
98 mPreferredRasterFormat = other.mPreferredRasterFormat;
99 mEllipsoid = other.mEllipsoid;
100 mDistanceUnit = other.mDistanceUnit;
101 mAreaUnit = other.mAreaUnit;
102 mLogLevel = other.mLogLevel;
109 QgsProcessingContext::Flags
flags()
const {
return mFlags; }
115 void setFlags( QgsProcessingContext::Flags flags ) { mFlags = flags; }
137 if ( mEllipsoid.isEmpty() )
138 mEllipsoid = mProject->ellipsoid();
140 mDistanceUnit = mProject->distanceUnits();
142 mAreaUnit = mProject->areaUnits();
183 QString ellipsoid()
const;
193 void setEllipsoid(
const QString &ellipsoid );
241 QgsDateTimeRange currentTimeRange()
const;
249 void setCurrentTimeRange(
const QgsDateTimeRange ¤tTimeRange );
271 , outputName( outputName )
272 , layerTypeHint( layerTypeHint )
292 bool forceName =
false;
328 void setOutputLayerName(
QgsMapLayer *layer )
const;
349 return mLayersToLoadOnCompletion;
363 return mLayersToLoadOnCompletion.contains( layer );
373 void setLayersToLoadOnCompletion(
const QMap< QString, QgsProcessingContext::LayerDetails > &layers );
400 return mLayersToLoadOnCompletion[ layer ];
427 void setInvalidGeometryCallback( SIP_PYCALLABLE / AllowNone / );
429 Py_BEGIN_ALLOW_THREADS
431 sipCpp->setInvalidGeometryCallback( [a0](
const QgsFeature &arg )
434 Py_XDECREF( sipCallMethod( NULL, a0,
"D", &arg, sipType_QgsFeature, NULL ) );
468 void setTransformErrorCallback( SIP_PYCALLABLE / AllowNone / );
470 Py_BEGIN_ALLOW_THREADS
472 sipCpp->setTransformErrorCallback( [a0](
const QgsFeature &arg )
475 Py_XDECREF( sipCallMethod( NULL, a0,
"D", &arg, sipType_QgsFeature, NULL ) );
524 QThread *
thread() {
return tempLayerStore.thread(); }
535 Q_ASSERT_X( QThread::currentThread() ==
QgsProcessingContext::thread(),
"QgsProcessingContext::pushToThread",
"Cannot push context to another thread unless the current thread matches the existing context thread affinity" );
536 tempLayerStore.moveToThread( thread );
558 QgsMapLayer *getMapLayer(
const QString &identifier );
650 LogLevel logLevel()
const;
658 void setLogLevel( LogLevel level );
665 QVariantMap exportToMap()
const;
674 IncludeProjectPath = 1 << 0,
676 Q_DECLARE_FLAGS( ProcessArgumentFlags, ProcessArgumentFlag )
683 QStringList asQgisProcessArguments( QgsProcessingContext::ProcessArgumentFlags flags = QgsProcessingContext::ProcessArgumentFlags() )
const;
687 QgsProcessingContext::Flags mFlags = QgsProcessingContext::Flags();
688 QPointer< QgsProject > mProject;
695 QgsDateTimeRange mCurrentTimeRange;
702 bool mUseDefaultInvalidGeometryCallback =
true;
703 std::function< void(
const QgsFeature & ) > mInvalidGeometryCallback;
705 std::function< void(
const QgsFeature & ) > mTransformErrorCallback;
706 QString mDefaultEncoding;
707 QMap< QString, LayerDetails > mLayersToLoadOnCompletion;
709 QPointer< QgsProcessingFeedback > mFeedback;
711 QString mPreferredVectorFormat;
712 QString mPreferredRasterFormat;
714 LogLevel mLogLevel = DefaultLevel;
762 #endif // QGSPROCESSINGPARAMETERS_H