Skip to content

Commit

Permalink
Update ClipData.py
Browse files Browse the repository at this point in the history
  • Loading branch information
spono committed Nov 20, 2015
1 parent 2fafaac commit fb568c3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions python/plugins/processing/algs/lidar/fusion/ClipData.py
Expand Up @@ -27,6 +27,7 @@

import os
import subprocess
from processing.core.parameters import ParameterBoolean
from processing.core.parameters import ParameterFile
from processing.core.parameters import ParameterExtent
from processing.core.parameters import ParameterSelection
Expand All @@ -41,6 +42,8 @@ class ClipData(FusionAlgorithm):
OUTPUT = 'OUTPUT'
EXTENT = 'EXTENT'
SHAPE = 'SHAPE'
DTM = 'DTM'
HEIGHT = 'HEIGHT'

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Clip Data')
Expand All @@ -52,13 +55,27 @@ def defineCharacteristics(self):
self.SHAPE, self.tr('Shape'), ['Rectangle', 'Circle']))
self.addOutput(OutputFile(
self.OUTPUT, self.tr('Output clipped LAS file')))
dtm = ParameterFile(
self.DTM, self.tr('Ground file for height normalization'))
dtm.isAdvanced = True
self.addParameter(dtm)
height = ParameterBoolean(
self.HEIGHT, self.tr("Convert point elevations into heights above ground (used with 'DTM')"), False)
height.isAdvanced = True
self.addParameter(height)
self.addAdvancedModifiers()

def processAlgorithm(self, progress):
commands = [os.path.join(FusionUtils.FusionPath(), 'ClipData.exe')]
commands.append('/verbose')
self.addAdvancedModifiersToCommand(commands)
commands.append('/shape:' + unicode(self.getParameterValue(self.SHAPE)))
dtm = self.getParameterValue(self.DTM)
if dtm:
commands.append('/dtm:'+unicode(dtm))
height = self.getParameterValue(self.HEIGHT)
if height:
commands.append('/height')
files = self.getParameterValue(self.INPUT).split(';')
if len(files) == 1:
commands.append(self.getParameterValue(self.INPUT))
Expand Down

0 comments on commit fb568c3

Please sign in to comment.