Skip to content

Commit

Permalink
[Processing] fixed handling of hardcoded params in SAGA
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed Oct 24, 2015
1 parent dacba06 commit 5575d04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
12 changes: 4 additions & 8 deletions python/plugins/processing/algs/saga/SagaAlgorithm212.py
Expand Up @@ -87,7 +87,7 @@ def defineCharacteristicsFromFile(self):
line = lines.readline().strip('\n').strip()
while line != '':
if line.startswith('Hardcoded'):
self.hardcodedStrings.append(line[len('Harcoded|') + 1:])
self.hardcodedStrings.append(line[len('Hardcoded|'):])
elif line.startswith('Parameter'):
self.addParameter(getParameterFromString(line))
elif line.startswith('AllowUnmatching'):
Expand Down Expand Up @@ -168,9 +168,7 @@ def processAlgorithm(self, progress):

# 2: Set parameters and outputs
command = self.undecoratedGroup + ' "' + self.cmdname + '"'
if self.hardcodedStrings:
for s in self.hardcodedStrings:
command += ' ' + s
command += ' ' + ' '.join(self.hardcodedStrings)

for param in self.parameters:
if param.value is None:
Expand All @@ -197,8 +195,7 @@ def processAlgorithm(self, progress):
f.write('\t'.join([col for col in param.cols]) + '\n')
values = param.value.split(',')
for i in range(0, len(values), 3):
s = values[i] + '\t' + values[i + 1] + '\t' + values[i
+ 2] + '\n'
s = values[i] + '\t' + values[i + 1] + '\t' + values[i+ 2] + '\n'
f.write(s)
f.close()
command += ' -' + param.name + ' "' + tempTableFile + '"'
Expand Down Expand Up @@ -229,8 +226,7 @@ def processAlgorithm(self, progress):
filename2 = filename + '.sgrd'
if self.cmdname == 'RGB Composite':
commands.append('io_grid_image 0 -IS_RGB -GRID:"' + filename2
+ '" -FILE:"' + filename
+ '"')
+ '" -FILE:"' + filename + '"')

# 3: Run SAGA
commands = self.editCommands(commands)
Expand Down
4 changes: 1 addition & 3 deletions python/plugins/processing/algs/saga/SagaAlgorithm213.py
Expand Up @@ -115,9 +115,7 @@ def processAlgorithm(self, progress):

# 2: Set parameters and outputs
command = self.undecoratedGroup + ' "' + self.cmdname + '"'
if self.hardcodedStrings:
for s in self.hardcodedStrings:
command += ' ' + s
command += ' ' + ' '.join(self.hardcodedStrings)

for param in self.parameters:
if param.value is None:
Expand Down

0 comments on commit 5575d04

Please sign in to comment.