17#include "moc_qgsprocessingmeshdatasetwidget.cpp"
38 : QWidget( parent ), mParam( param )
40 QHBoxLayout *hl =
new QHBoxLayout();
41 hl->setContentsMargins( 0, 0, 0, 0 );
43 mLineEdit =
new QLineEdit();
44 mLineEdit->setEnabled(
false );
45 hl->addWidget( mLineEdit, 1 );
47 mToolButton =
new QToolButton();
48 mToolButton->setText( QString( QChar( 0x2026 ) ) );
49 hl->addWidget( mToolButton );
53 mLineEdit->setText( tr(
"%1 dataset groups selected" ).arg( 0 ) );
55 mToolButton->setPopupMode( QToolButton::InstantPopup );
56 QMenu *toolButtonMenu =
new QMenu(
this );
57 mActionCurrentActiveDatasetGroups = toolButtonMenu->addAction( tr(
"Current Active Dataset Group" ) );
58 connect( mActionCurrentActiveDatasetGroups, &QAction::triggered,
this, &QgsProcessingMeshDatasetGroupsWidget::selectCurrentActiveDatasetGroup );
60 mActionAvailableDatasetGroups = toolButtonMenu->addAction( tr(
"Select in Available Dataset Groups" ) );
61 connect( mActionAvailableDatasetGroups, &QAction::triggered,
this, &QgsProcessingMeshDatasetGroupsWidget::showDialog );
63 mToolButton->setMenu( toolButtonMenu );
66void QgsProcessingMeshDatasetGroupsWidget::setMeshLayer(
QgsMeshLayer *layer,
bool layerFromProject )
68 mActionCurrentActiveDatasetGroups->setEnabled( layer && layerFromProject );
69 mActionAvailableDatasetGroups->setEnabled( layer );
71 if ( mMeshLayer == layer )
74 mDatasetGroupsNames.clear();
76 if ( layerFromProject )
84 for (
int i : datasetGroupsIndexes )
87 if ( mParam->isDataTypeSupported( meta.
dataType() ) )
89 mDatasetGroupsNames[i] = meta.
name();
99void QgsProcessingMeshDatasetGroupsWidget::setValue(
const QVariant &value )
101 if ( value.isValid() )
102 mValue = value.userType() == QMetaType::Type::QVariantList ? value.toList() : QVariantList() << value;
110QVariant QgsProcessingMeshDatasetGroupsWidget::value()
const
115void QgsProcessingMeshDatasetGroupsWidget::showDialog()
117 QList<int> datasetGroupsIndexes;
119 QVariantList availableOptions;
122 datasetGroupsIndexes = mMeshLayer->datasetGroupsIndexes();
123 for (
int i : std::as_const( datasetGroupsIndexes ) )
126 if ( mParam->isDataTypeSupported( meta.
dataType() ) )
128 availableOptions.append( i );
129 options.append( meta.
name() );
135 for (
auto it = mDatasetGroupsNames.constBegin(); it != mDatasetGroupsNames.constEnd(); it++ )
137 availableOptions.append( it.key() );
138 options.append( it.value() );
145 QgsProcessingMultipleSelectionPanelWidget *widget =
new QgsProcessingMultipleSelectionPanelWidget( availableOptions, mValue );
146 widget->setPanelTitle( tr(
"Dataset Groups Available" ) );
148 widget->setValueFormatter( [availableOptions, options](
const QVariant &v ) -> QString {
149 const int index = v.toInt();
150 const int pos = availableOptions.indexOf( index );
151 return ( pos >= 0 && pos < options.size() ) ? options.at( pos ) : QString();
154 connect( widget, &QgsProcessingMultipleSelectionPanelWidget::selectionChanged,
this, [=]() {
155 setValue( widget->selectedOptions() );
162 QgsProcessingMultipleSelectionDialog dlg( availableOptions, mValue,
this, Qt::WindowFlags() );
164 dlg.setValueFormatter( [datasetGroupsIndexes, options](
const QVariant &v ) -> QString {
165 const int index = v.toInt();
166 const int pos = datasetGroupsIndexes.indexOf( index );
167 return ( pos >= 0 && pos < options.size() ) ? options.at( pos ) : QString();
171 setValue( dlg.selectedOptions() );
176void QgsProcessingMeshDatasetGroupsWidget::selectCurrentActiveDatasetGroup()
178 QVariantList options;
179 if ( mMeshLayer && mParam )
181 int scalarDatasetGroup = mMeshLayer->rendererSettings().activeScalarDatasetGroup();
182 int vectorDatasetGroup = mMeshLayer->rendererSettings().activeVectorDatasetGroup();
184 if ( scalarDatasetGroup >= 0 && mParam->isDataTypeSupported( mMeshLayer->datasetGroupMetadata( scalarDatasetGroup ).dataType() ) )
185 options.append( scalarDatasetGroup );
187 if ( vectorDatasetGroup >= 0
188 && mParam->isDataTypeSupported( mMeshLayer->datasetGroupMetadata( vectorDatasetGroup ).dataType() )
189 && vectorDatasetGroup != scalarDatasetGroup )
190 options.append( vectorDatasetGroup );
200QString QgsProcessingMeshDatasetGroupsWidgetWrapper::parameterType()
const
207 return new QgsProcessingMeshDatasetGroupsWidgetWrapper( parameter, type );
212 return new QgsProcessingMeshDatasetGroupsParameterDefinitionWidget( context, widgetContext, definition,
algorithm );
215void QgsProcessingMeshDatasetGroupsWidgetWrapper::postInitialize(
const QList<QgsAbstractProcessingParameterWidgetWrapper *> &wrappers )
227 setMeshLayerWrapperValue( wrapper );
229 setMeshLayerWrapperValue( wrapper );
248 if ( mProcessingContextGenerator )
249 context = mProcessingContextGenerator->processingContext();
251 bool layerFromProject;
257 layerFromProject =
false;
266 mWidget->setMeshLayer( meshLayer, layerFromProject );
269QStringList QgsProcessingMeshDatasetGroupsWidgetWrapper::compatibleParameterTypes()
const
276QStringList QgsProcessingMeshDatasetGroupsWidgetWrapper::compatibleOutputTypes()
const
282QWidget *QgsProcessingMeshDatasetGroupsWidgetWrapper::createWidget()
SIP_FACTORY
285 connect( mWidget, &QgsProcessingMeshDatasetGroupsWidget::changed,
this, [=] {
286 emit widgetValueHasChanged(
this );
292void QgsProcessingMeshDatasetGroupsWidgetWrapper::setWidgetValue(
const QVariant &value,
QgsProcessingContext &context )
297 QList<int> datasetGroupIndexes;
298 if ( value.userType() == QMetaType::Type::QVariantList )
306 QVariantList varList;
307 for (
const int index : std::as_const( datasetGroupIndexes ) )
308 varList.append( index );
310 mWidget->setValue( varList );
313QVariant QgsProcessingMeshDatasetGroupsWidgetWrapper::widgetValue()
const
316 return mWidget->value();
321void QgsProcessingMeshDatasetGroupsWidget::updateSummaryText()
323 mLineEdit->setText( tr(
"%n option(s) selected",
nullptr, mValue.count() ) );
331QString QgsProcessingMeshDatasetTimeWidgetWrapper::parameterType()
const
338 return new QgsProcessingMeshDatasetTimeWidgetWrapper( parameter, type );
341void QgsProcessingMeshDatasetTimeWidgetWrapper::postInitialize(
const QList<QgsAbstractProcessingParameterWidgetWrapper *> &wrappers )
354 layerParameterWrapper = wrapper;
357 datasetGroupsParameterWrapper = wrapper;
359 setMeshLayerWrapperValue( layerParameterWrapper );
360 setDatasetGroupIndexesWrapperValue( datasetGroupsParameterWrapper );
362 setMeshLayerWrapperValue( layerParameterWrapper );
363 setDatasetGroupIndexesWrapperValue( datasetGroupsParameterWrapper );
376 return new QgsProcessingMeshDatasetTimeParameterDefinitionWidget( context, widgetContext, definition,
algorithm );
381 if ( !mWidget || !wrapper )
386 if ( mProcessingContextGenerator )
387 context = mProcessingContextGenerator->processingContext();
389 bool layerFromProject;
395 layerFromProject =
false;
403 mWidget->setMeshLayer( meshLayer, layerFromProject );
408 if ( !mWidget || !wrapper )
413 if ( !datasetGroupsVariant.isValid() || datasetGroupsVariant.userType() != QMetaType::Type::QVariantList )
414 mWidget->setDatasetGroupIndexes( QList<int>() );
416 QVariantList datasetGroupsListVariant = datasetGroupsVariant.toList();
418 QList<int> datasetGroupsIndexes;
419 for (
const QVariant &variantIndex : datasetGroupsListVariant )
420 datasetGroupsIndexes << variantIndex.toInt();
422 mWidget->setDatasetGroupIndexes( datasetGroupsIndexes );
425QStringList QgsProcessingMeshDatasetTimeWidgetWrapper::compatibleParameterTypes()
const
433QStringList QgsProcessingMeshDatasetTimeWidgetWrapper::compatibleOutputTypes()
const
439QWidget *QgsProcessingMeshDatasetTimeWidgetWrapper::createWidget()
448 connect( mWidget, &QgsProcessingMeshDatasetTimeWidget::changed,
this, [=] {
449 emit widgetValueHasChanged(
this );
455void QgsProcessingMeshDatasetTimeWidgetWrapper::setWidgetValue(
const QVariant &value,
QgsProcessingContext &context )
459 mWidget->setValue( value );
462QVariant QgsProcessingMeshDatasetTimeWidgetWrapper::widgetValue()
const
465 return mWidget->value();
470 : QWidget( parent ), mParam( param )
474 mValue.insert( QStringLiteral(
"type" ), QStringLiteral(
"static" ) );
476 dateTimeEdit->setDisplayFormat(
"yyyy-MM-dd HH:mm:ss" );
480 connect( radioButtonCurrentCanvasTime, &QRadioButton::toggled,
this, [
this](
bool isChecked ) {
if ( isChecked ) this->updateValue(); } );
481 connect( radioButtonDefinedDateTime, &QRadioButton::toggled,
this, [
this](
bool isChecked ) {
if ( isChecked ) this->updateValue(); } );
482 connect( radioButtonDatasetGroupTimeStep, &QRadioButton::toggled,
this, [
this](
bool isChecked ) {
if ( isChecked ) this->updateValue(); } );
483 connect( dateTimeEdit, &QgsDateTimeEdit::dateTimeChanged,
this, &QgsProcessingMeshDatasetTimeWidget::updateValue );
484 connect( comboBoxDatasetTimeStep, qOverload<int>( &QComboBox::currentIndexChanged ),
this, &QgsProcessingMeshDatasetTimeWidget::updateValue );
489void QgsProcessingMeshDatasetTimeWidget::setMeshLayer(
QgsMeshLayer *layer,
bool layerFromProject )
491 if ( mMeshLayer == layer )
494 mReferenceTime = QDateTime();
496 if ( layerFromProject )
503 mMeshLayer =
nullptr;
506 storeTimeStepsFromLayer( layer );
509 if ( mReferenceTime.isValid() )
510 whileBlocking( dateTimeEdit )->setDateTime( mReferenceTime );
515void QgsProcessingMeshDatasetTimeWidget::setDatasetGroupIndexes(
const QList<int> datasetGroupIndexes )
517 if ( datasetGroupIndexes == mDatasetGroupIndexes )
519 mDatasetGroupIndexes = datasetGroupIndexes;
524void QgsProcessingMeshDatasetTimeWidget::setValue(
const QVariant &value )
526 if ( !value.isValid() || ( value.userType() != QMetaType::Type::QVariantMap && !value.toDateTime().isValid() ) )
530 if ( value.toDateTime().isValid() )
532 QDateTime dateTime = value.toDateTime();
533 dateTime.setTimeSpec( Qt::UTC );
534 mValue.insert( QStringLiteral(
"type" ), QStringLiteral(
"defined-date-time" ) );
535 mValue.insert( QStringLiteral(
"value" ), dateTime );
538 mValue = value.toMap();
540 if ( !mValue.contains( QStringLiteral(
"type" ) ) || !mValue.contains( QStringLiteral(
"value" ) ) )
543 QString type = mValue.value( QStringLiteral(
"type" ) ).toString();
546 if ( type == QLatin1String(
"static" ) )
550 else if ( type == QLatin1String(
"dataset-time-step" ) )
552 QVariantList dataset = mValue.value( QStringLiteral(
"value" ) ).toList();
553 whileBlocking( comboBoxDatasetTimeStep )->setCurrentIndex( comboBoxDatasetTimeStep->findData( dataset ) );
554 whileBlocking( radioButtonDatasetGroupTimeStep )->setChecked(
true );
556 else if ( type == QLatin1String(
"defined-date-time" ) )
558 whileBlocking( dateTimeEdit )->setDateTime( mValue.value( QStringLiteral(
"value" ) ).toDateTime() );
559 whileBlocking( radioButtonDefinedDateTime )->setChecked(
true );
561 else if ( type == QLatin1String(
"current-context-time" ) )
563 whileBlocking( radioButtonCurrentCanvasTime )->setChecked(
true );
570QVariant QgsProcessingMeshDatasetTimeWidget::value()
const
575void QgsProcessingMeshDatasetTimeWidget::updateWidget()
577 bool isStatic = !hasTemporalDataset();
578 setEnabled( !isStatic );
580 if ( mCanvas && mCanvas->mapSettings().isTemporal() )
582 whileBlocking( radioButtonCurrentCanvasTime )->setEnabled(
true && mReferenceTime.isValid() );
583 labelCurrentCanvasTime->setText( mCanvas->mapSettings().temporalRange().begin().toString(
"yyyy-MM-dd HH:mm:ss" ) );
587 whileBlocking( radioButtonCurrentCanvasTime )->setEnabled(
false );
588 if ( radioButtonCurrentCanvasTime->isChecked() )
589 whileBlocking( radioButtonDefinedDateTime )->setChecked(
true );
592 if ( !mReferenceTime.isValid() )
593 whileBlocking( radioButtonDatasetGroupTimeStep )->setChecked(
true );
595 whileBlocking( radioButtonDefinedDateTime )->setEnabled( mReferenceTime.isValid() );
597 dateTimeEdit->setVisible( radioButtonDefinedDateTime->isChecked() && !isStatic );
598 labelCurrentCanvasTime->setVisible( radioButtonCurrentCanvasTime->isChecked() && !isStatic );
599 comboBoxDatasetTimeStep->setVisible( radioButtonDatasetGroupTimeStep->isChecked() && !isStatic );
602bool QgsProcessingMeshDatasetTimeWidget::hasTemporalDataset()
const
604 for (
int index : mDatasetGroupIndexes )
606 if ( mMeshLayer && mMeshLayer->datasetGroupMetadata( index ).isTemporal() )
608 else if ( mDatasetTimeSteps.contains( index ) )
616void QgsProcessingMeshDatasetTimeWidget::populateTimeSteps()
620 populateTimeStepsFromLayer();
624 QMap<quint64, QgsMeshDatasetIndex> timeStep;
625 for (
int groupIndex : mDatasetGroupIndexes )
627 if ( !mDatasetTimeSteps.contains( groupIndex ) )
629 const QList<qint64> relativeTimeSteps = mDatasetTimeSteps.value( groupIndex );
630 for (
int index = 0; index < relativeTimeSteps.count(); ++index )
633 if ( timeStep.contains( relativeTimeSteps.at( index ) ) )
635 timeStep[relativeTimeSteps.at( index )] = datasetIndex;
639 for (
auto it = timeStep.constBegin(); it != timeStep.constEnd(); it++ )
641 QString stringTime = QgsMeshLayerUtils::formatTime(
static_cast<double>( it.key() ) / 1000. / 3600., mReferenceTime,
QgsMeshTimeSettings() );
645 whileBlocking( comboBoxDatasetTimeStep )->addItem( stringTime, data );
649void QgsProcessingMeshDatasetTimeWidget::populateTimeStepsFromLayer()
656 QMap<quint64, QgsMeshDatasetIndex> timeStep;
657 for (
int groupIndex : std::as_const( mDatasetGroupIndexes ) )
662 int datasetCount = mMeshLayer->datasetCount( groupIndex );
664 for (
int index = 0; index < datasetCount; ++index )
667 qint64 relativeTime = mMeshLayer->datasetRelativeTimeInMilliseconds( datasetIndex );
668 if ( timeStep.contains( relativeTime ) )
670 timeStep[relativeTime] = datasetIndex;
674 for (
auto it = timeStep.constBegin(); it != timeStep.constEnd(); it++ )
676 QString stringTime = mMeshLayer->formatTime(
static_cast<double>( it.key() ) / 1000.0 / 3600.0 );
680 whileBlocking( comboBoxDatasetTimeStep )->addItem( stringTime, data );
684void QgsProcessingMeshDatasetTimeWidget::storeTimeStepsFromLayer(
QgsMeshLayer *layer )
686 mDatasetTimeSteps.clear();
690 for (
int groupIndex : datasetGroupsList )
696 QList<qint64> relativeTimeSteps;
697 relativeTimeSteps.reserve( datasetCount );
698 for (
int index = 0; index < datasetCount; ++index )
700 mDatasetTimeSteps[groupIndex] = relativeTimeSteps;
704void QgsProcessingMeshDatasetTimeWidget::buildValue()
710 mValue[QStringLiteral(
"type" )] = QStringLiteral(
"static" );
712 else if ( radioButtonDatasetGroupTimeStep->isChecked() )
714 mValue[QStringLiteral(
"type" )] = QStringLiteral(
"dataset-time-step" );
715 mValue[QStringLiteral(
"value" )] = comboBoxDatasetTimeStep->currentData();
717 else if ( radioButtonDefinedDateTime->isChecked() )
719 mValue[QStringLiteral(
"type" )] = QStringLiteral(
"defined-date-time" );
720 mValue[QStringLiteral(
"value" )] = dateTimeEdit->dateTime();
722 else if ( radioButtonCurrentCanvasTime->isChecked() && mCanvas )
724 mValue[QStringLiteral(
"type" )] = QStringLiteral(
"current-context-time" );
730void QgsProcessingMeshDatasetTimeWidget::updateValue()
737QgsProcessingMeshDatasetGroupsParameterDefinitionWidget::QgsProcessingMeshDatasetGroupsParameterDefinitionWidget(
746 QVBoxLayout *vlayout =
new QVBoxLayout();
747 vlayout->setContentsMargins( 0, 0, 0, 0 );
749 vlayout->addWidget(
new QLabel( tr(
"Linked input" ) ) );
751 mParentLayerComboBox =
new QComboBox();
752 vlayout->addWidget( mParentLayerComboBox );
754 if ( QgsProcessingModelAlgorithm *model = widgetContext.
model() )
756 const QMap<QString, QgsProcessingModelParameter> components = model->parameterComponents();
757 for (
auto it = components.constBegin(); it != components.constEnd(); ++it )
768 if ( datasetGroupDef )
771 if ( currentIndex != -1 )
772 mParentLayerComboBox->setCurrentIndex( currentIndex );
777 mParentLayerComboBox->setCurrentIndex( mParentLayerComboBox->count() - 1 );
781 setLayout( vlayout );
786 const QString &description,
790 QSet<int> supportedDataType;
795 std::unique_ptr<QgsProcessingParameterMeshDatasetGroups> param = std::make_unique<QgsProcessingParameterMeshDatasetGroups>( name, description, mParentLayerComboBox->currentData().toString(), supportedDataType );
796 param->setFlags( flags );
797 return param.release();
800QgsProcessingMeshDatasetTimeParameterDefinitionWidget::QgsProcessingMeshDatasetTimeParameterDefinitionWidget(
815 QVBoxLayout *vlayout =
new QVBoxLayout();
816 vlayout->setContentsMargins( 0, 0, 0, 0 );
818 vlayout->addWidget(
new QLabel( tr(
"Linked input" ) ) );
820 mParentDatasetComboBox =
new QComboBox();
821 vlayout->addWidget( mParentDatasetComboBox );
823 QgsProcessingModelAlgorithm *model = widgetContext.
model();
826 const QMap<QString, QgsProcessingModelParameter> components = model->parameterComponents();
827 for (
auto it = components.constBegin(); it != components.constEnd(); ++it )
839 if ( currentIndex != -1 )
840 mParentDatasetComboBox->setCurrentIndex( currentIndex );
845 mParentDatasetComboBox->setCurrentIndex( mParentDatasetComboBox->count() - 1 );
855 connect( mParentDatasetComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, [
this, model] {
862 setLayout( vlayout );
867 std::unique_ptr<QgsProcessingParameterMeshDatasetTime> param = std::make_unique<QgsProcessingParameterMeshDatasetTime>(
868 name, description, mMeshLayerParameterName, mParentDatasetComboBox->currentData().toString()
871 param->setFlags( flags );
872 return param.release();
QFlags< ProcessingParameterFlag > ProcessingParameterFlags
Flags which dictate the behavior of Processing parameters.
Map canvas is a class for displaying all GIS data types on a canvas.
void temporalRangeChanged()
Emitted when the map canvas temporal range changes.
QVector< T > layers() const
Returns a list of registered map layers with a specified layer type.
QDateTime referenceTime() const
Returns the reference time.
QgsMeshDataProviderTemporalCapabilities * temporalCapabilities() override
Returns the provider's temporal capabilities.
QgsMeshDatasetIndex is index that identifies the dataset group (e.g.
int group() const
Returns a group index.
int dataset() const
Returns a dataset index within group()
Implementation of map layer temporal properties for mesh layers.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
int datasetCount(const QgsMeshDatasetIndex &index) const
Returns the dataset count in the dataset groups.
QList< int > datasetGroupsIndexes() const
Returns the list of indexes of dataset groups handled by the layer.
QgsMeshDataProvider * dataProvider() override
Returns the layer's data provider, it may be nullptr.
QgsMapLayerTemporalProperties * temporalProperties() override
Returns the layer's temporal properties.
qint64 datasetRelativeTimeInMilliseconds(const QgsMeshDatasetIndex &index)
Returns the relative time (in milliseconds) of the dataset from the reference time of its group.
QgsMeshDatasetGroupMetadata datasetGroupMetadata(const QgsMeshDatasetIndex &index) const
Returns the dataset groups metadata.
Represents a mesh time settings for mesh datasets.
Abstract base class for processing algorithms.
Contains information about the context in which a processing algorithm is executed.
QgsProject * project() const
Returns the project in which the algorithm is being executed.
WidgetType
Types of dialogs which Processing widgets can be created for.
@ Standard
Standard algorithm dialog.
@ Batch
Batch processing dialog.
static QString typeName()
Returns the type name for the output class.
static QString typeName()
Returns the type name for the output class.
static QString typeName()
Returns the type name for the parameter class.
Base class for the definition of processing parameters.
QString description() const
Returns the description for the parameter.
virtual QString type() const =0
Unique parameter type name.
QString name() const
Returns the name of the parameter.
A parameter for processing algorithms that need a list of mesh dataset groups.
static QString typeName()
Returns the type name for the parameter class.
QString meshLayerParameterName() const
Returns the name of the mesh layer parameter.
A parameter for processing algorithms that need a list of mesh dataset index from time parameter.
QString datasetGroupParameterName() const
Returns the name of the dataset groups parameter.
QString meshLayerParameterName() const
Returns the name of the mesh layer parameter.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
static QString typeName()
Returns the type name for the parameter class.
Contains settings which reflect the context in which a Processing parameter widget is shown,...
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
QgsProcessingModelAlgorithm * model() const
Returns the model which the parameter widget is associated with.
static QList< int > parameterAsInts(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a list of integer values.
static QgsMeshLayer * parameterAsMeshLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, QgsProcessingContext &context)
Evaluates the parameter with matching definition and value to a mesh layer.
static int parameterAsInt(const QgsProcessingParameterDefinition *definition, const QVariantMap ¶meters, const QgsProcessingContext &context)
Evaluates the parameter with matching definition to a static integer value.
QgsMapLayerStore * layerStore()
Returns a pointer to the project's internal layer store.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.