Skip to content

Commit ec9f086

Browse files
committed
Update CanopyModel.py
fixed some syntax errors and added an output option (ASCII)
1 parent 57eb409 commit ec9f086

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

python/plugins/processing/algs/lidar/fusion/CanopyModel.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class CanopyModel(FusionAlgorithm):
5050
SMOOTH = 'SMOOTH'
5151
SLOPE = 'SLOPE'
5252
CLASS = 'CLASS'
53-
ADVANCED_MODIFIERS = 'ADVANCED_MODIFIERS'
53+
ASCII = 'ASCII'
5454

5555
def defineCharacteristics(self):
5656
self.name, self.i18n_name = self.trAlgorithm('Canopy Model')
@@ -77,18 +77,17 @@ def defineCharacteristics(self):
7777
self.SMOOTH, self.tr('Smooth'), '', False, True)
7878
smooth.isAdvanced = True
7979
self.addParameter(smooth)
80-
slope = ParameterString(
81-
self.SLOPE, self.tr('Slope'), '', False, True)
82-
slope.isAdvanced = True
83-
self.addParameter(slope)
8480
class_var = ParameterString(
8581
self.CLASS, self.tr('Class'), '', False, True)
8682
class_var.isAdvanced = True
8783
self.addParameter(class_var)
88-
advance_modifiers = ParameterString(
89-
self.ADVANCED_MODIFIERS, self.tr('Additional modifiers'), '', False, True)
90-
advance_modifiers.isAdvanced = True
91-
self.addParameter(advance_modifiers)
84+
slope = ParameterBoolean(
85+
self.SLOPE, self.tr('Calculate slope'), False)
86+
slope.isAdvanced = True
87+
self.addParameter(slope)
88+
self.addParameter(ParameterBoolean(
89+
self.ASCII, self.tr('Add an ASCII output'), False))
90+
self.addAdvancedModifiers()
9291

9392
def processAlgorithm(self, progress):
9493
commands = [os.path.join(FusionUtils.FusionPath(), 'CanopyModel.exe')]
@@ -103,14 +102,15 @@ def processAlgorithm(self, progress):
103102
if unicode(smooth).strip():
104103
commands.append('/smooth:' + unicode(smooth))
105104
slope = self.getParameterValue(self.SLOPE)
106-
if unicode(slope).strip():
107-
commands.append('/slope:' + unicode(slope))
105+
if slope:
106+
commands.append('/slope')
108107
class_var = self.getParameterValue(self.CLASS)
109108
if unicode(class_var).strip():
110109
commands.append('/class:' + unicode(class_var))
111-
advance_modifiers = unicode(self.getParameterValue(self.ADVANCED_MODIFIERS)).strip()
112-
if advance_modifiers:
113-
commands.append(advance_modifiers)
110+
ascii = self.getParameterValue(self.ASCII)
111+
if ascii:
112+
commands.append('/ascii')
113+
self.addAdvancedModifiersToCommand(commands)
114114
commands.append(self.getOutputValue(self.OUTPUT_DTM))
115115
commands.append(unicode(self.getParameterValue(self.CELLSIZE)))
116116
commands.append(self.UNITS[self.getParameterValue(self.XYUNITS)][0])

0 commit comments

Comments
 (0)