From c32611b2c4a8dd2fe8e1b563de3da914ca0bd196 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 1 May 2018 15:33:26 +1000 Subject: [PATCH] [processing] Remove unused code --- .../processing/core/ProcessingConfig.py | 7 +-- .../plugins/processing/gui/AlgorithmDialog.py | 47 +------------------ 2 files changed, 2 insertions(+), 52 deletions(-) diff --git a/python/plugins/processing/core/ProcessingConfig.py b/python/plugins/processing/core/ProcessingConfig.py index 296374b5a27..63689ec24c1 100644 --- a/python/plugins/processing/core/ProcessingConfig.py +++ b/python/plugins/processing/core/ProcessingConfig.py @@ -61,7 +61,6 @@ class ProcessingConfig: POST_EXECUTION_SCRIPT = 'POST_EXECUTION_SCRIPT' SHOW_CRS_DEF = 'SHOW_CRS_DEF' WARN_UNMATCHING_CRS = 'WARN_UNMATCHING_CRS' - WARN_UNMATCHING_EXTENT_CRS = 'WARN_UNMATCHING_EXTENT_CRS' DEFAULT_OUTPUT_RASTER_LAYER_EXT = 'DEFAULT_OUTPUT_RASTER_LAYER_EXT' DEFAULT_OUTPUT_VECTOR_LAYER_EXT = 'DEFAULT_OUTPUT_VECTOR_LAYER_EXT' SHOW_PROVIDERS_TOOLTIP = 'SHOW_PROVIDERS_TOOLTIP' @@ -106,11 +105,7 @@ class ProcessingConfig: ProcessingConfig.addSetting(Setting( ProcessingConfig.tr('General'), ProcessingConfig.WARN_UNMATCHING_CRS, - ProcessingConfig.tr("Warn before executing if layer CRS's do not match"), True)) - ProcessingConfig.addSetting(Setting( - ProcessingConfig.tr('General'), - ProcessingConfig.WARN_UNMATCHING_EXTENT_CRS, - ProcessingConfig.tr("Warn before executing if extent CRS might not match layers CRS"), True)) + ProcessingConfig.tr("Warn before executing if parameter CRS's do not match"), True)) ProcessingConfig.addSetting(Setting( ProcessingConfig.tr('General'), ProcessingConfig.RASTER_STYLE, diff --git a/python/plugins/processing/gui/AlgorithmDialog.py b/python/plugins/processing/gui/AlgorithmDialog.py index d842a3601e8..c004b79b9d3 100644 --- a/python/plugins/processing/gui/AlgorithmDialog.py +++ b/python/plugins/processing/gui/AlgorithmDialog.py @@ -118,39 +118,6 @@ class AlgorithmDialog(QgsProcessingAlgorithmDialogBase): return self.algorithm().preprocessParameters(parameters) - def checkExtentCRS(self): - unmatchingCRS = False - hasExtent = False - context = dataobjects.createContext() - projectCRS = iface.mapCanvas().mapSettings().destinationCrs() - layers = QgsProcessingUtils.compatibleLayers(QgsProject.instance()) - for param in self.algorithm().parameterDefinitions(): - if isinstance(param, (ParameterRaster, ParameterVector, ParameterMultipleInput)): - if param.value: - if isinstance(param, ParameterMultipleInput): - inputlayers = param.value.split(';') - else: - inputlayers = [param.value] - for inputlayer in inputlayers: - for layer in layers: - if layer.source() == inputlayer: - if layer.crs() != projectCRS: - unmatchingCRS = True - - p = QgsProcessingUtils.mapLayerFromString(inputlayer, context) - if p is not None: - if p.crs() != projectCRS: - unmatchingCRS = True - if isinstance(param, ParameterExtent): - if param.skip_crs_check: - continue - - value = self.mainWidget().wrappers[param.name()].widget.leText.text().strip() - if value: - hasExtent = True - - return hasExtent and unmatchingCRS - def accept(self): feedback = self.createFeedback() context = dataobjects.createContext(feedback) @@ -161,25 +128,13 @@ class AlgorithmDialog(QgsProcessingAlgorithmDialogBase): if checkCRS and not self.algorithm().validateInputCrs(parameters, context): reply = QMessageBox.question(self, self.tr("Unmatching CRS's"), - self.tr('Layers do not all use the same CRS. This can ' + self.tr('Parameters do not all use the same CRS. This can ' 'cause unexpected results.\nDo you want to ' 'continue?'), QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if reply == QMessageBox.No: return - checkExtentCRS = ProcessingConfig.getSetting(ProcessingConfig.WARN_UNMATCHING_EXTENT_CRS) - # TODO - if False and checkExtentCRS and self.checkExtentCRS(): - reply = QMessageBox.question(self, self.tr("Extent CRS"), - self.tr('Extent parameters must use the same CRS as the input layers.\n' - 'Your input layers do not have the same extent as the project, ' - 'so the extent might be in a wrong CRS if you have selected it from the canvas.\n' - 'Do you want to continue?'), - QMessageBox.Yes | QMessageBox.No, - QMessageBox.No) - if reply == QMessageBox.No: - return ok, msg = self.algorithm().checkParameterValues(parameters, context) if msg: QMessageBox.warning(