Skip to content

Commit

Permalink
Merge pull request #2514 from spono/patch-14
Browse files Browse the repository at this point in the history
[Processing] Update CanopyModel.py
  • Loading branch information
volaya committed Dec 3, 2015
2 parents 85cc180 + ec9f086 commit 6f26d9a
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions python/plugins/processing/algs/lidar/fusion/CanopyModel.py
Expand Up @@ -50,7 +50,7 @@ class CanopyModel(FusionAlgorithm):
SMOOTH = 'SMOOTH'
SLOPE = 'SLOPE'
CLASS = 'CLASS'
ADVANCED_MODIFIERS = 'ADVANCED_MODIFIERS'
ASCII = 'ASCII'

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Canopy Model')
Expand All @@ -77,18 +77,17 @@ def defineCharacteristics(self):
self.SMOOTH, self.tr('Smooth'), '', False, True)
smooth.isAdvanced = True
self.addParameter(smooth)
slope = ParameterString(
self.SLOPE, self.tr('Slope'), '', False, True)
slope.isAdvanced = True
self.addParameter(slope)
class_var = ParameterString(
self.CLASS, self.tr('Class'), '', False, True)
class_var.isAdvanced = True
self.addParameter(class_var)
advance_modifiers = ParameterString(
self.ADVANCED_MODIFIERS, self.tr('Additional modifiers'), '', False, True)
advance_modifiers.isAdvanced = True
self.addParameter(advance_modifiers)
slope = ParameterBoolean(
self.SLOPE, self.tr('Calculate slope'), False)
slope.isAdvanced = True
self.addParameter(slope)
self.addParameter(ParameterBoolean(
self.ASCII, self.tr('Add an ASCII output'), False))
self.addAdvancedModifiers()

def processAlgorithm(self, progress):
commands = [os.path.join(FusionUtils.FusionPath(), 'CanopyModel.exe')]
Expand All @@ -103,14 +102,15 @@ def processAlgorithm(self, progress):
if unicode(smooth).strip():
commands.append('/smooth:' + unicode(smooth))
slope = self.getParameterValue(self.SLOPE)
if unicode(slope).strip():
commands.append('/slope:' + unicode(slope))
if slope:
commands.append('/slope')
class_var = self.getParameterValue(self.CLASS)
if unicode(class_var).strip():
commands.append('/class:' + unicode(class_var))
advance_modifiers = unicode(self.getParameterValue(self.ADVANCED_MODIFIERS)).strip()
if advance_modifiers:
commands.append(advance_modifiers)
ascii = self.getParameterValue(self.ASCII)
if ascii:
commands.append('/ascii')
self.addAdvancedModifiersToCommand(commands)
commands.append(self.getOutputValue(self.OUTPUT_DTM))
commands.append(unicode(self.getParameterValue(self.CELLSIZE)))
commands.append(self.UNITS[self.getParameterValue(self.XYUNITS)][0])
Expand Down

0 comments on commit 6f26d9a

Please sign in to comment.