Skip to content
Permalink
Browse files

Merge pull request #2468 from spono/patch-12

[processing] Update ClipData.py
  • Loading branch information
volaya committed Dec 3, 2015
2 parents bbde581 + c622457 commit 85cc1807df9465441fb9de581ec2c703cc915f58
Showing with 19 additions and 8 deletions.
  1. +19 −8 python/plugins/processing/algs/lidar/fusion/ClipData.py
@@ -26,7 +26,7 @@
__revision__ = '$Format:%H$'

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
@@ -41,6 +41,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')
@@ -52,29 +54,38 @@ 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 the above command)"), False)
height.isAdvanced = True
self.addParameter(height)
self.addAdvancedModifiers()

def processAlgorithm(self, progress):
commands = [os.path.join(FusionUtils.FusionPath(), 'FilterData.exe')]
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))
else:
FusionUtils.createFileList(files)
commands.append(FusionUtils.tempFileListFilepath())
outFile = self.getOutputValue(self.OUTPUT) + '.lda'
outFile = self.getOutputValue(self.OUTPUT)
commands.append(outFile)
extent = unicode(self.getParameterValue(self.EXTENT)).split(',')
commands.append(extent[0])
commands.append(extent[2])
commands.append(extent[1])
commands.append(extent[3])
FusionUtils.runFusion(commands, progress)
commands = [os.path.join(FusionUtils.FusionPath(), 'LDA2LAS.exe')]
commands.append(outFile)
commands.append(self.getOutputValue(self.OUTPUT))
p = subprocess.Popen(commands, shell=True)
p.wait()

0 comments on commit 85cc180

Please sign in to comment.
You can’t perform that action at this time.