Skip to content

Commit

Permalink
[processing] fixed saga algorithms when input is an sdat file
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed Jun 24, 2015
1 parent 848cd44 commit feb8d38
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
15 changes: 10 additions & 5 deletions python/plugins/processing/algs/saga/SagaAlgorithm212.py
Expand Up @@ -111,9 +111,10 @@ def processAlgorithm(self, progress):
if isinstance(param, ParameterRaster): if isinstance(param, ParameterRaster):
if param.value is None: if param.value is None:
continue continue
value = param.value if param.value.endswith('sdat'):
if not value.endswith('sgrd'): param.value = param.value[:-4] + "sgrd"
exportCommand = self.exportRasterLayer(value) elif not param.value.endswith('sgrd'):
exportCommand = self.exportRasterLayer(param.value)
if exportCommand is not None: if exportCommand is not None:
commands.append(exportCommand) commands.append(exportCommand)
if isinstance(param, ParameterVector): if isinstance(param, ParameterVector):
Expand Down Expand Up @@ -143,11 +144,15 @@ def processAlgorithm(self, progress):
if layers is None or len(layers) == 0: if layers is None or len(layers) == 0:
continue continue
if param.datatype == ParameterMultipleInput.TYPE_RASTER: if param.datatype == ParameterMultipleInput.TYPE_RASTER:
for layerfile in layers: for i, layerfile in enumerate(layers):
if not layerfile.endswith('sgrd'): if layerfile.endswith('sdat'):
layerfile = param.value[:-4] + "sgrd"
layers[i] = layerfile
elif not layerfile.endswith('sgrd'):
exportCommand = self.exportRasterLayer(layerfile) exportCommand = self.exportRasterLayer(layerfile)
if exportCommand is not None: if exportCommand is not None:
commands.append(exportCommand) commands.append(exportCommand)
param.value = ";".join(layers)
elif param.datatype == ParameterMultipleInput.TYPE_VECTOR_ANY: elif param.datatype == ParameterMultipleInput.TYPE_VECTOR_ANY:
for layerfile in layers: for layerfile in layers:
layer = dataobjects.getObjectFromUri(layerfile, False) layer = dataobjects.getObjectFromUri(layerfile, False)
Expand Down
15 changes: 10 additions & 5 deletions python/plugins/processing/algs/saga/SagaAlgorithm213.py
Expand Up @@ -61,9 +61,10 @@ def processAlgorithm(self, progress):
if isinstance(param, ParameterRaster): if isinstance(param, ParameterRaster):
if param.value is None: if param.value is None:
continue continue
value = param.value if param.value.endswith('sdat'):
if not value.endswith('sgrd'): param.value = param.value[:-4] + "sgrd"
exportCommand = self.exportRasterLayer(value) elif not param.value.endswith('sgrd'):
exportCommand = self.exportRasterLayer(param.value)
if exportCommand is not None: if exportCommand is not None:
commands.append(exportCommand) commands.append(exportCommand)
if isinstance(param, ParameterVector): if isinstance(param, ParameterVector):
Expand Down Expand Up @@ -93,11 +94,15 @@ def processAlgorithm(self, progress):
if layers is None or len(layers) == 0: if layers is None or len(layers) == 0:
continue continue
if param.datatype == ParameterMultipleInput.TYPE_RASTER: if param.datatype == ParameterMultipleInput.TYPE_RASTER:
for layerfile in layers: for i, layerfile in enumerate(layers):
if not layerfile.endswith('sgrd'): if layerfile.endswith('sdat'):
layerfile = param.value[:-4] + "sgrd"
layers[i] = layerfile
elif not layerfile.endswith('sgrd'):
exportCommand = self.exportRasterLayer(layerfile) exportCommand = self.exportRasterLayer(layerfile)
if exportCommand is not None: if exportCommand is not None:
commands.append(exportCommand) commands.append(exportCommand)
param.value = ";".join(layers)
elif param.datatype == ParameterMultipleInput.TYPE_VECTOR_ANY: elif param.datatype == ParameterMultipleInput.TYPE_VECTOR_ANY:
for layerfile in layers: for layerfile in layers:
layer = dataobjects.getObjectFromUri(layerfile, False) layer = dataobjects.getObjectFromUri(layerfile, False)
Expand Down

0 comments on commit feb8d38

Please sign in to comment.