Skip to content
Permalink
Browse files

Disable some more algs

  • Loading branch information
elpaso authored and nyalldawson committed Sep 14, 2018
1 parent e01449f commit 0626a0ff5d7119c4d03190cc66fb4e47df3168a3
@@ -79,6 +79,9 @@ def inputLayerTypes(self):
def parameterAsFieldsMapping(self, parameters, name, context):
return parameters[name]

def supportInPlaceEdit(self, layer):
return False

def prepareAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, 'INPUT', context)
if source is None:
@@ -77,6 +77,9 @@ def prepareAlgorithm(self, parameters, context, feedback):
self.field_name = self.parameterAsString(parameters, self.FIELD, context)
return True

def supportInPlaceEdit(self, layer):
return False

def sourceFlags(self):
return QgsProcessingFeatureSource.FlagSkipGeometryValidityChecks

@@ -143,14 +143,7 @@ def fetchResults(self, string, context, feedback):
if not a.flags() & QgsProcessingAlgorithm.FlagSupportsInPlaceEdits:
continue

if a.inputLayerTypes() and \
QgsProcessing.TypeVector not in a.inputLayerTypes() \
and QgsProcessing.TypeVectorAnyGeometry not in a.inputLayerTypes() \
and (QgsWkbTypes.geometryType(iface.activeLayer().wkbType()) == QgsWkbTypes.PolygonGeometry and QgsProcessing.TypeVectorPolygon not in a.inputLayerTypes() or
QgsWkbTypes.geometryType(
iface.activeLayer().wkbType()) == QgsWkbTypes.LineGeometry and QgsProcessing.TypeVectorLine not in a.inputLayerTypes() or
QgsWkbTypes.geometryType(
iface.activeLayer().wkbType()) == QgsWkbTypes.PointGeometry and QgsProcessing.TypeVectorPoint not in a.inputLayerTypes()):
if not a.supportInPlaceEdit(iface.activeLayer()):
continue

if QgsLocatorFilter.stringMatches(a.displayName(), string) or [t for t in a.tags() if QgsLocatorFilter.stringMatches(t, string)] or \
@@ -229,8 +229,7 @@ def executeAlgorithm(self):
dlg.exec_()
return

if self.in_place_mode and len(alg.parameterDefinitions()) <= 2:
# hack
if self.in_place_mode and not [d for d in alg.parameterDefinitions() if d.name() not in ('INPUT', 'OUTPUT')]:
parameters = {}
execute_in_place(alg, parameters)
return
@@ -162,4 +162,10 @@ QgsFeatureList QgsAddIncrementalFieldAlgorithm::processFeature( const QgsFeature
return QgsFeatureList() << f;
}

bool QgsAddIncrementalFieldAlgorithm::supportInPlaceEdit( const QgsVectorLayer *layer ) const
{
Q_UNUSED( layer );
return false;
}

///@endcond
@@ -53,6 +53,7 @@ class QgsAddIncrementalFieldAlgorithm : public QgsProcessingFeatureBasedAlgorith
bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
QgsFeatureRequest request() const override;
QgsFeatureList processFeature( const QgsFeature &feature, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
bool supportInPlaceEdit( const QgsVectorLayer *layer ) const override;

private:

@@ -68,7 +69,6 @@ class QgsAddIncrementalFieldAlgorithm : public QgsProcessingFeatureBasedAlgorith
bool mSortAscending = true;
bool mSortNullsFirst = false;


};

///@endcond PRIVATE

0 comments on commit 0626a0f

Please sign in to comment.
You can’t perform that action at this time.