mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
added option to add hardcoded params to GRASS algorithms
This commit is contained in:
parent
5575d04a80
commit
455089025e
@ -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 @@ class GrassAlgorithm(GeoAlgorithm):
|
||||
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 @@ class GrassAlgorithm(GeoAlgorithm):
|
||||
# 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 @@ class Grass7Algorithm(GeoAlgorithm):
|
||||
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 @@ class Grass7Algorithm(GeoAlgorithm):
|
||||
# 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user