Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Reset outputpixeltype parameter options
  • Loading branch information
Rashad Kanavath authored and nyalldawson committed Feb 22, 2019
1 parent 8afb80e commit 9a6a70a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions python/plugins/processing/algs/otb/OtbAlgorithm.py
Expand Up @@ -68,7 +68,8 @@ def __init__(self, group, name, descriptionfile, display_name='', groupId=''):
if not groupId:
self._groupId = ''.join(c for c in self._group if c in validChars)

self.pixelTypes = ['uint8', 'int', 'float', 'double']
self.pixelTypes = ['uint8', 'uint16', 'int16', 'uint32', 'int32',
'float', 'double', 'cint16', 'cint32', 'cfloat', 'cdouble']
self._descriptionfile = descriptionfile
self.defineCharacteristicsFromFile()

Expand Down Expand Up @@ -160,6 +161,11 @@ def defineCharacteristicsFromFile(self):
if name in ["elev.dem.geoid", "elev.geoid"]:
param.setDefaultValue(OtbUtils.geoidFile())

# outputpixeltype is a special parameter associated with raster output
# reset list of options to 'self.pixelTypes'.
if name == 'outputpixeltype':
param.setOptions(self.pixelTypes)

self.addParameter(param)
#parameter is added now and we must move to next line
line = lines.readline().strip('\n').strip()
Expand Down Expand Up @@ -248,7 +254,7 @@ def processAlgorithm(self, parameters, context, feedback):
filePath = self.parameterAsOutputLayer(parameters, out.name(), context)
output_files[out.name()] = filePath
if outputPixelType is not None:
command += ' -{} "{}" {}'.format(out.name(), filePath, outputPixelType)
command += ' -{} "{}" "{}"'.format(out.name(), filePath, outputPixelType)
else:
command += ' -{} "{}"'.format(out.name(), filePath)

Expand Down

0 comments on commit 9a6a70a

Please sign in to comment.