26
26
__revision__ = '$Format:%H$'
27
27
28
28
import os
29
- import subprocess
29
+ from processing . core . parameters import ParameterBoolean
30
30
from processing .core .parameters import ParameterFile
31
31
from processing .core .parameters import ParameterExtent
32
32
from processing .core .parameters import ParameterSelection
@@ -41,6 +41,8 @@ class ClipData(FusionAlgorithm):
41
41
OUTPUT = 'OUTPUT'
42
42
EXTENT = 'EXTENT'
43
43
SHAPE = 'SHAPE'
44
+ DTM = 'DTM'
45
+ HEIGHT = 'HEIGHT'
44
46
45
47
def defineCharacteristics (self ):
46
48
self .name , self .i18n_name = self .trAlgorithm ('Clip Data' )
@@ -52,29 +54,38 @@ def defineCharacteristics(self):
52
54
self .SHAPE , self .tr ('Shape' ), ['Rectangle' , 'Circle' ]))
53
55
self .addOutput (OutputFile (
54
56
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 )
55
65
self .addAdvancedModifiers ()
56
66
57
67
def processAlgorithm (self , progress ):
58
- commands = [os .path .join (FusionUtils .FusionPath (), 'FilterData .exe' )]
68
+ commands = [os .path .join (FusionUtils .FusionPath (), 'ClipData .exe' )]
59
69
commands .append ('/verbose' )
60
70
self .addAdvancedModifiersToCommand (commands )
61
71
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' )
62
78
files = self .getParameterValue (self .INPUT ).split (';' )
63
79
if len (files ) == 1 :
64
80
commands .append (self .getParameterValue (self .INPUT ))
65
81
else :
66
82
FusionUtils .createFileList (files )
67
83
commands .append (FusionUtils .tempFileListFilepath ())
68
- outFile = self .getOutputValue (self .OUTPUT ) + '.lda'
84
+ outFile = self .getOutputValue (self .OUTPUT )
69
85
commands .append (outFile )
70
86
extent = unicode (self .getParameterValue (self .EXTENT )).split (',' )
71
87
commands .append (extent [0 ])
72
88
commands .append (extent [2 ])
73
89
commands .append (extent [1 ])
74
90
commands .append (extent [3 ])
75
91
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