Skip to content
Permalink
Browse files

added option to add hardcoded params to GRASS algorithms

  • Loading branch information
volaya committed Oct 24, 2015
1 parent 5575d04 commit 455089025ec5742b2c337bb2a958073c64865446
@@ -66,6 +66,7 @@ class GrassAlgorithm(GeoAlgorithm):

def __init__(self, descriptionfile):
GeoAlgorithm.__init__(self)
self.hardcodedStrings = []
self.descriptionFile = descriptionfile
self.defineCharacteristicsFromFile()
self.numExportedLayers = 0
@@ -121,7 +122,9 @@ def defineCharacteristicsFromFile(self):
while line != '':
try:
line = line.strip('\n').strip()
if line.startswith('Parameter'):
if line.startswith('Hardcoded'):
self.hardcodedStrings.append(line[len('Hardcoded|'):])
elif line.startswith('Parameter'):
parameter = getParameterFromString(line)
self.addParameter(parameter)
if isinstance(parameter, ParameterVector):
@@ -297,6 +300,8 @@ def processAlgorithm(self, progress):
# 2: Set parameters and outputs

command = self.grassName
command += ' ' + ' '.join(self.hardcodedStrings)

for param in self.parameters:
if param.value is None or param.value == '':
continue
@@ -65,6 +65,7 @@ class Grass7Algorithm(GeoAlgorithm):

def __init__(self, descriptionfile):
GeoAlgorithm.__init__(self)
self.hardcodedStrings = []
self.descriptionFile = descriptionfile
self.defineCharacteristicsFromFile()
self.numExportedLayers = 0
@@ -120,7 +121,9 @@ def defineCharacteristicsFromFile(self):
while line != '':
try:
line = line.strip('\n').strip()
if line.startswith('Parameter'):
if line.startswith('Hardcoded'):
self.hardcodedStrings.append(line[len('Hardcoded|'):])
elif line.startswith('Parameter'):
parameter = getParameterFromString(line)
self.addParameter(parameter)
if isinstance(parameter, ParameterVector):
@@ -297,6 +300,8 @@ def processAlgorithm(self, progress):
# 2: Set parameters and outputs

command = self.grass7Name
command += ' ' + ' '.join(self.hardcodedStrings)

for param in self.parameters:
if param.value is None or param.value == '':
continue

0 comments on commit 4550890

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