Skip to content

Commit 85cc180

Browse files
committed
Merge pull request #2468 from spono/patch-12
[processing] Update ClipData.py
2 parents bbde581 + c622457 commit 85cc180

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

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

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
__revision__ = '$Format:%H$'
2727

2828
import os
29-
import subprocess
29+
from processing.core.parameters import ParameterBoolean
3030
from processing.core.parameters import ParameterFile
3131
from processing.core.parameters import ParameterExtent
3232
from processing.core.parameters import ParameterSelection
@@ -41,6 +41,8 @@ class ClipData(FusionAlgorithm):
4141
OUTPUT = 'OUTPUT'
4242
EXTENT = 'EXTENT'
4343
SHAPE = 'SHAPE'
44+
DTM = 'DTM'
45+
HEIGHT = 'HEIGHT'
4446

4547
def defineCharacteristics(self):
4648
self.name, self.i18n_name = self.trAlgorithm('Clip Data')
@@ -52,29 +54,38 @@ def defineCharacteristics(self):
5254
self.SHAPE, self.tr('Shape'), ['Rectangle', 'Circle']))
5355
self.addOutput(OutputFile(
5456
self.OUTPUT, self.tr('Output clipped LAS file')))
57+
dtm = ParameterFile(
58+
self.DTM, self.tr('Ground file for height normalization'))
59+
dtm.isAdvanced = True
60+
self.addParameter(dtm)
61+
height = ParameterBoolean(
62+
self.HEIGHT, self.tr("Convert point elevations into heights above ground (used with the above command)"), False)
63+
height.isAdvanced = True
64+
self.addParameter(height)
5565
self.addAdvancedModifiers()
5666

5767
def processAlgorithm(self, progress):
58-
commands = [os.path.join(FusionUtils.FusionPath(), 'FilterData.exe')]
68+
commands = [os.path.join(FusionUtils.FusionPath(), 'ClipData.exe')]
5969
commands.append('/verbose')
6070
self.addAdvancedModifiersToCommand(commands)
6171
commands.append('/shape:' + unicode(self.getParameterValue(self.SHAPE)))
72+
dtm = self.getParameterValue(self.DTM)
73+
if dtm:
74+
commands.append('/dtm:'+unicode(dtm))
75+
height = self.getParameterValue(self.HEIGHT)
76+
if height:
77+
commands.append('/height')
6278
files = self.getParameterValue(self.INPUT).split(';')
6379
if len(files) == 1:
6480
commands.append(self.getParameterValue(self.INPUT))
6581
else:
6682
FusionUtils.createFileList(files)
6783
commands.append(FusionUtils.tempFileListFilepath())
68-
outFile = self.getOutputValue(self.OUTPUT) + '.lda'
84+
outFile = self.getOutputValue(self.OUTPUT)
6985
commands.append(outFile)
7086
extent = unicode(self.getParameterValue(self.EXTENT)).split(',')
7187
commands.append(extent[0])
7288
commands.append(extent[2])
7389
commands.append(extent[1])
7490
commands.append(extent[3])
7591
FusionUtils.runFusion(commands, progress)
76-
commands = [os.path.join(FusionUtils.FusionPath(), 'LDA2LAS.exe')]
77-
commands.append(outFile)
78-
commands.append(self.getOutputValue(self.OUTPUT))
79-
p = subprocess.Popen(commands, shell=True)
80-
p.wait()

0 commit comments

Comments
 (0)