Skip to content

Commit dd8dbc2

Browse files
committedJul 1, 2014
[processing] more changes to fusion lidar algorithms
1 parent b44a256 commit dd8dbc2

File tree

8 files changed

+331
-58
lines changed

8 files changed

+331
-58
lines changed
 
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
***************************************************************************
5+
ASCII2DTM.py
6+
---------------------
7+
Date : May 2014
8+
Copyright : (C) 2014 by Niccolo' Marchi
9+
Email : sciurusurbanus at hotmail dot it
10+
***************************************************************************
11+
* *
12+
* This program is free software; you can redistribute it and/or modify *
13+
* it under the terms of the GNU General Public License as published by *
14+
* the Free Software Foundation; either version 2 of the License, or *
15+
* (at your option) any later version. *
16+
* *
17+
***************************************************************************
18+
"""
19+
20+
__author__ = "Niccolo' Marchi"
21+
__date__ = 'May 2014'
22+
__copyright__ = "(C) 2014 by Niccolo' Marchi"
23+
24+
# This will get replaced with a git SHA1 when you do a git archive
25+
26+
__revision__ = '$Format:%H$'
27+
28+
import os
29+
import subprocess
30+
from processing.parameters.ParameterFile import ParameterFile
31+
from processing.parameters.ParameterSelection import ParameterSelection
32+
from processing.parameters.ParameterNumber import ParameterNumber
33+
from processing.outputs.OutputFile import OutputFile
34+
from FusionAlgorithm import FusionAlgorithm
35+
from FusionUtils import FusionUtils
36+
37+
38+
class ASCII2DTM(FusionAlgorithm):
39+
40+
INPUT = 'INPUT'
41+
OUTPUT = 'OUTPUT'
42+
COORDSYS = 'COORDSYS'
43+
XYUNITS = 'XYUNITS'
44+
ZUNITS = 'ZUNITS'
45+
UNITS = ['Meter', 'Feet']
46+
ZONE = 'ZONE'
47+
48+
def defineCharacteristics(self):
49+
self.name = 'ASCII to DTM'
50+
self.group = 'Conversion'
51+
self.addParameter(ParameterFile(self.INPUT, 'Input ESRI ASCII layer'))
52+
self.addParameter(ParameterSelection(self.XYUNITS, 'XY Units',
53+
self.UNITS))
54+
self.addParameter(ParameterSelection(self.ZUNITS, 'Z Units',
55+
self.UNITS))
56+
self.addParameter(ParameterSelection(self.COORDSYS, 'Coordinate system',
57+
['unknown', 'UTM', 'state plane']))
58+
self.addParameter(ParameterNumber(self.ZONE, "Coordinate system zone ('0' for unknown)", 0, None,
59+
0))
60+
self.addOutput(OutputFile(self.OUTPUT, 'Output surface', 'dtm'))
61+
self.addAdvancedModifiers()
62+
63+
def processAlgorithm(self, progress):
64+
commands = [os.path.join(FusionUtils.FusionPath(), 'ASCII2DTM.exe')]
65+
commands.append('/verbose')
66+
self.addAdvancedModifiersToCommand(commands)
67+
outFile = self.getOutputValue(self.OUTPUT)
68+
commands.append(outFile)
69+
commands.append(self.UNITS[self.getParameterValue(self.XYUNITS)][0])
70+
commands.append(self.UNITS[self.getParameterValue(self.ZUNITS)][0])
71+
commands.append(str(self.getParameterValue(self.COORDSYS)))
72+
commands.append(str(self.getParameterValue(self.ZONE)))
73+
commands.append('0')
74+
commands.append('0')
75+
files = self.getParameterValue(self.INPUT).split(';')
76+
if len(files) == 1:
77+
commands.append(self.getParameterValue(self.INPUT))
78+
else:
79+
FusionUtils.createFileList(files)
80+
commands.append(FusionUtils.tempFileListFilepath())
81+
FusionUtils.runFusion(commands, progress)

‎python/plugins/processing/algs/lidar/fusion/CanopyMaxima.py

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

2828
import os
29+
from PyQt4 import QtGui
30+
from processing.core.GeoAlgorithm import GeoAlgorithm
2931
from processing.parameters.ParameterFile import ParameterFile
3032
from processing.parameters.ParameterNumber import ParameterNumber
33+
from processing.parameters.ParameterBoolean import ParameterBoolean
3134
from processing.outputs.OutputTable import OutputTable
32-
from FusionUtils import FusionUtils
33-
from FusionAlgorithm import FusionAlgorithm
35+
from fusion.FusionUtils import FusionUtils
36+
from fusion.FusionAlgorithm import FusionAlgorithm
3437

3538

3639
class CanopyMaxima(FusionAlgorithm):
@@ -39,24 +42,41 @@ class CanopyMaxima(FusionAlgorithm):
3942
OUTPUT = 'OUTPUT'
4043
THRESHOLD = 'THRESHOLD'
4144
GROUND = 'GROUND'
45+
SUMMARY = 'SUMMARY'
46+
PARAM_A = 'PARAM_A'
47+
PARAM_C = 'PARAM_C'
4248

4349
def defineCharacteristics(self):
4450
self.name = 'Canopy Maxima'
4551
self.group = 'Points'
46-
self.addParameter(ParameterFile(self.INPUT, 'Input las layer'))
47-
self.addParameter(ParameterFile(self.GROUND,
48-
'Input ground DTM layer [optional, leave blank if not using it]'))
49-
self.addParameter(ParameterNumber(self.THRESHOLD, 'Minimum threshold',
52+
self.addParameter(ParameterFile(self.INPUT, 'Input FUSION canopy height model'))
53+
self.addParameter(ParameterFile(self.GROUND, 'Input ground .dtm layer [optional]'))
54+
self.addParameter(ParameterNumber(self.THRESHOLD, 'Height threshold',
5055
0, None, 10.0))
56+
### begin
57+
self.addParameter(ParameterNumber(self.PARAM_A, 'Variable window size: parameter A',
58+
0, None, 2.51503))
59+
self.addParameter(ParameterNumber(self.PARAM_C, 'Parameter C',
60+
0, None, 0.00901))
61+
self.addParameter(ParameterBoolean(self.SUMMARY, 'Summary (tree height summary statistics)',
62+
False))
63+
### end
5164
self.addOutput(OutputTable(self.OUTPUT, 'Output file with maxima'))
5265
self.addAdvancedModifiers()
5366

67+
5468
def processAlgorithm(self, progress):
5569
commands = [os.path.join(FusionUtils.FusionPath(), 'CanopyMaxima.exe')]
5670
commands.append('/verbose')
71+
### begin
72+
commands.append('/wse:' + str(self.getParameterValue(self.PARAM_A)) + ',0,' + str(self.getParameterValue(self.PARAM_C)) + ',0')
73+
if self.getParameterValue(self.SUMMARY) == True:
74+
commands.append('/summary')
75+
### end
5776
self.addAdvancedModifiersToCommand(commands)
5877
ground = self.getParameterValue(self.GROUND)
59-
if str(ground).strip() != '':
78+
## here it's necessary to have the support for multiple files like for INPUT.
79+
if str(ground).strip():
6080
commands.append('/ground:' + str(ground))
6181
commands.append('/threshold:'
6282
+ str(self.getParameterValue(self.THRESHOLD)))

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

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ class CanopyModel(FusionAlgorithm):
4343

4444
INPUT = 'INPUT'
4545
OUTPUT_DTM = 'OUTPUT_DTM'
46-
OUTPUT_ASCII = 'OUTPUT_ASCII'
4746
CELLSIZE = 'CELLSIZE'
4847
XYUNITS = 'XYUNITS'
4948
ZUNITS = 'ZUNITS'
@@ -53,7 +52,6 @@ class CanopyModel(FusionAlgorithm):
5352
SMOOTH = 'SMOOTH'
5453
SLOPE = 'SLOPE'
5554
CLASS = 'CLASS'
56-
ASCII = 'ASCII'
5755
ADVANCED_MODIFIERS = 'ADVANCED_MODIFIERS'
5856

5957
def defineCharacteristics(self):
@@ -63,22 +61,20 @@ def defineCharacteristics(self):
6361
self.addParameter(ParameterNumber(self.CELLSIZE, 'Cellsize', 0, None, 10.0))
6462
self.addParameter(ParameterSelection(self.XYUNITS, 'XY Units', self.UNITS))
6563
self.addParameter(ParameterSelection(self.ZUNITS, 'Z Units', self.UNITS))
66-
self.addParameter(ParameterBoolean(self.ASCII, 'ASCII Output?'))
67-
self.addOutput(OutputFile(self.OUTPUT_DTM, 'DTM Output Surface', 'dtm'))
68-
self.addOutput(OutputFile(self.OUTPUT_ASCII, 'ASCII Output Surface', 'asc'))
64+
self.addOutput(OutputFile(self.OUTPUT_DTM, 'DTM Output Surface', 'dtm'))
6965
ground = ParameterFile(self.GROUND, 'Input ground DTM layer', False, True)
7066
ground.isAdvanced = True
7167
self.addParameter(ground)
72-
median = ParameterString(self.MEDIAN, 'Median (set blank if not used)', '', False, True)
68+
median = ParameterString(self.MEDIAN, 'Median', '', False, True)
7369
median.isAdvanced = True
7470
self.addParameter(median)
75-
smooth = ParameterString(self.SMOOTH, 'Smooth (set blank if not used)', '', False, True)
71+
smooth = ParameterString(self.SMOOTH, 'Smooth', '', False, True)
7672
smooth.isAdvanced = True
7773
self.addParameter(smooth)
78-
slope = ParameterString(self.SLOPE, 'Slope (set blank if not used)', '', False, True)
74+
slope = ParameterString(self.SLOPE, 'Slope', '', False, True)
7975
slope.isAdvanced = True
8076
self.addParameter(slope)
81-
class_var = ParameterString(self.CLASS, 'Class (set blank if not used)', '', False, True)
77+
class_var = ParameterString(self.CLASS, 'Class', '', False, True)
8278
class_var.isAdvanced = True
8379
self.addParameter(class_var)
8480
advance_modifiers = ParameterString(self.ADVANCED_MODIFIERS, 'Additional modifiers', '', False, True)
@@ -89,23 +85,23 @@ def processAlgorithm(self, progress):
8985
commands = [os.path.join(FusionUtils.FusionPath(), 'CanopyModel.exe')]
9086
commands.append('/verbose')
9187
ground = self.getParameterValue(self.GROUND)
92-
if str(ground).strip() != '':
88+
if str(ground).strip():
9389
commands.append('/ground:' + str(ground))
9490
median = self.getParameterValue(self.MEDIAN)
95-
if str(median).strip() != '':
91+
if str(median).strip():
9692
commands.append('/median:' + str(median))
9793
smooth = self.getParameterValue(self.SMOOTH)
98-
if str(smooth).strip() != '':
94+
if str(smooth).strip():
9995
commands.append('/smooth:' + str(smooth))
10096
slope = self.getParameterValue(self.SLOPE)
101-
if str(slope).strip() != '':
97+
if str(slope).strip():
10298
commands.append('/slope:' + str(slope))
10399
class_var = self.getParameterValue(self.CLASS)
104-
if str(class_var).strip() != '':
100+
if str(class_var).strip():
105101
commands.append('/class:' + str(class_var))
106102
advance_modifiers = str(self.getParameterValue(self.ADVANCED_MODIFIERS)).strip()
107-
if advance_modifiers != '':
108-
commands.append(s)
103+
if advance_modifiers:
104+
commands.append(advance_modifiers)
109105
commands.append(self.getOutputValue(self.OUTPUT_DTM))
110106
commands.append(str(self.getParameterValue(self.CELLSIZE)))
111107
commands.append(self.UNITS[self.getParameterValue(self.XYUNITS)][0])
@@ -121,10 +117,3 @@ def processAlgorithm(self, progress):
121117
FusionUtils.createFileList(files)
122118
commands.append(FusionUtils.tempFileListFilepath())
123119
FusionUtils.runFusion(commands, progress)
124-
ascii = self.getParameterValue(self.ASCII)
125-
if ascii == 1:
126-
commands = [os.path.join(FusionUtils.FusionPath(), 'DTM2ASCII.exe')]
127-
commands.append(self.getOutputValue(self.OUTPUT_DTM))
128-
commands.append(self.getOutputValue(self.OUTPUT_ASCII))
129-
p = subprocess.Popen(commands, shell=True)
130-
p.wait()
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
***************************************************************************
5+
DTM2TIF.py
6+
---------------------
7+
Date : May 2014
8+
Copyright : (C) 2014 by Niccolo' Marchi
9+
Email : sciurusurbanus at hotmail dot it
10+
***************************************************************************
11+
* *
12+
* This program is free software; you can redistribute it and/or modify *
13+
* it under the terms of the GNU General Public License as published by *
14+
* the Free Software Foundation; either version 2 of the License, or *
15+
* (at your option) any later version. *
16+
* *
17+
***************************************************************************
18+
"""
19+
20+
__author__ = "Niccolo' Marchi"
21+
__date__ = 'May 2014'
22+
__copyright__ = "(C) 2014 by Niccolo' Marchi"
23+
24+
# This will get replaced with a git SHA1 when you do a git archive
25+
26+
__revision__ = '$Format:%H$'
27+
28+
import os
29+
from processing.parameters.ParameterFile import ParameterFile
30+
from processing.outputs.OutputRaster import OutputRaster
31+
from FusionAlgorithm import FusionAlgorithm
32+
from FusionUtils import FusionUtils
33+
34+
35+
class DTM2TIF(FusionAlgorithm):
36+
37+
INPUT = "INPUT"
38+
OUTPUT = "OUTPUT"
39+
CSV = 'CSV'
40+
41+
42+
def defineCharacteristics(self):
43+
self.name = "DTM to TIF"
44+
self.group = "Conversion"
45+
self.addParameter(ParameterFile(self.INPUT, "Input .dtm layer"))
46+
self.addOutput(OutputRaster(self.OUTPUT, 'Output file name'))
47+
self.addAdvancedModifiers()
48+
49+
def processAlgorithm(self, progress):
50+
commands = [os.path.join(FusionUtils.FusionPath(), "DTM2TIF.exe")]
51+
commands.append("/verbose")
52+
self.addAdvancedModifiersToCommand(commands)
53+
files = self.getParameterValue(self.INPUT).split(";")
54+
if len(files) == 1:
55+
commands.append(self.getParameterValue(self.INPUT))
56+
else:
57+
FusionUtils.createFileList(files)
58+
commands.append(FusionUtils.tempFileListFilepath())
59+
outFile = self.getOutputValue(self.OUTPUT)
60+
commands.append(outFile)
61+
62+
FusionUtils.runFusion(commands, progress)
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
***************************************************************************
5+
FirstLastReturn.py
6+
---------------------
7+
Date : May 2014
8+
Copyright : (C) 2014 by Niccolo' Marchi
9+
Email : sciurusurbanus at hotmail dot it
10+
***************************************************************************
11+
* *
12+
* This program is free software; you can redistribute it and/or modify *
13+
* it under the terms of the GNU General Public License as published by *
14+
* the Free Software Foundation; either version 2 of the License, or *
15+
* (at your option) any later version. *
16+
* *
17+
***************************************************************************
18+
"""
19+
20+
__author__ = "Niccolo' Marchi"
21+
__date__ = 'May 2014'
22+
__copyright__ = "(C) 2014 by Niccolo' Marchi"
23+
24+
# This will get replaced with a git SHA1 when you do a git archive
25+
26+
__revision__ = '$Format:%H$'
27+
28+
import os
29+
from processing.parameters.ParameterFile import ParameterFile
30+
from processing.parameters.ParameterBoolean import ParameterBoolean
31+
from processing.outputs.OutputFile import OutputFile
32+
from FusionAlgorithm import FusionAlgorithm
33+
from FusionUtils import FusionUtils
34+
35+
36+
class FirstLastReturn(FusionAlgorithm):
37+
38+
INPUT = 'INPUT'
39+
OUTPUT = 'OUTPUT'
40+
SWITCH = 'SWITCH'
41+
42+
43+
def defineCharacteristics(self):
44+
self.name = 'First&Last Return'
45+
self.group = 'Points'
46+
self.addParameter(ParameterFile(self.INPUT, 'Input .las'))
47+
self.addParameter(ParameterBoolean(self.SWITCH, 'Use LAS info', True))
48+
self.addOutput(OutputFile(self.OUTPUT, 'Output layers'))
49+
self.addAdvancedModifiers()
50+
51+
def processAlgorithm(self, progress):
52+
commands = [os.path.join(FusionUtils.FusionPath(), 'FirstLastReturn.exe')]
53+
commands.append('/verbose')
54+
if self.getParameterValue(self.SWITCH) == True:
55+
commands.append('/uselas')
56+
self.addAdvancedModifiersToCommand(commands)
57+
outFile = self.getOutputValue(self.OUTPUT)
58+
commands.append(outFile)
59+
files = self.getParameterValue(self.INPUT).split(';')
60+
if len(files) == 1:
61+
commands.append(self.getParameterValue(self.INPUT))
62+
else:
63+
FusionUtils.createFileList(files)
64+
commands.append(FusionUtils.tempFileListFilepath())
65+
FusionUtils.runFusion(commands, progress)

‎python/plugins/processing/algs/lidar/fusion/GridSurfaceCreate.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ class GridSurfaceCreate(FusionAlgorithm):
4343

4444
INPUT = 'INPUT'
4545
OUTPUT_DTM = 'OUTPUT_DTM'
46-
OUTPUT_ASCII = 'OUTPUT_ASCII'
4746
CELLSIZE = 'CELLSIZE'
4847
XYUNITS = 'XYUNITS'
4948
ZUNITS = 'ZUNITS'
@@ -54,7 +53,6 @@ class GridSurfaceCreate(FusionAlgorithm):
5453
SLOPE = 'SLOPE'
5554
MINIMUM = 'MINIMUM'
5655
CLASS = 'CLASS'
57-
ASCII = 'ASCII'
5856
ADVANCED_MODIFIERS = 'ADVANCED_MODIFIERS'
5957

6058
def defineCharacteristics(self):
@@ -64,25 +62,23 @@ def defineCharacteristics(self):
6462
self.addParameter(ParameterNumber(self.CELLSIZE, 'Cellsize', 0, None, 10.0))
6563
self.addParameter(ParameterSelection(self.XYUNITS, 'XY Units', self.UNITS))
6664
self.addParameter(ParameterSelection(self.ZUNITS, 'Z Units', self.UNITS))
67-
self.addParameter(ParameterBoolean(self.ASCII, 'ASCII Output?'))
6865
self.addOutput(OutputFile(self.OUTPUT_DTM, 'DTM Output Surface', 'dtm'))
69-
self.addOutput(OutputFile(self.OUTPUT_ASCII, 'ASCII Output Surface', 'asc'))
7066
spike = ParameterString(self.SPIKE, 'Spike (set blank if not used)', '', False, True)
7167
spike.isAdvanced = True
7268
self.addParameter(spike)
73-
median = ParameterString(self.MEDIAN, 'Median (set blank if not used)', '', False, True)
69+
median = ParameterString(self.MEDIAN, 'Median', '', False, True)
7470
median.isAdvanced = True
7571
self.addParameter(median)
76-
smooth = ParameterString(self.SMOOTH, 'Smooth (set blank if not used)', '', False, True)
72+
smooth = ParameterString(self.SMOOTH, 'Smooth', '', False, True)
7773
smooth.isAdvanced = True
7874
self.addParameter(smooth)
79-
slope = ParameterString(self.SLOPE, 'Slope (set blank if not used)', '', False, True)
75+
slope = ParameterString(self.SLOPE, 'Slope', '', False, True)
8076
slope.isAdvanced = True
8177
self.addParameter(slope)
8278
minimum = ParameterBoolean(self.MINIMUM, 'Minimum (set blank if not used)', False)
8379
minimum.isAdvanced = True
8480
self.addParameter(minimum)
85-
class_var = ParameterString(self.CLASS, 'Class - If multiple, separated by comma (set blank if not used)', 2, False, True)
81+
class_var = ParameterString(self.CLASS, 'Class(es)', 2, False, True)
8682
class_var.isAdvanced = True
8783
self.addParameter(class_var)
8884
advance_modifiers = ParameterString(self.ADVANCED_MODIFIERS, 'Additional modifiers', '', False, True)
@@ -112,7 +108,7 @@ def processAlgorithm(self, progress):
112108
commands.append('/class:' + str(class_var))
113109
advance_modifiers = str(self.getParameterValue(self.ADVANCED_MODIFIERS)).strip()
114110
if advance_modifiers:
115-
commands.append(s)
111+
commands.append(advance_modifiers)
116112
commands.append(self.getOutputValue(self.OUTPUT_DTM))
117113
commands.append(str(self.getParameterValue(self.CELLSIZE)))
118114
commands.append(self.UNITS[self.getParameterValue(self.XYUNITS)][0])
@@ -128,10 +124,3 @@ def processAlgorithm(self, progress):
128124
FusionUtils.createFileList(files)
129125
commands.append(FusionUtils.tempFileListFilepath())
130126
FusionUtils.runFusion(commands, progress)
131-
ascii = self.getParameterValue(self.ASCII)
132-
if ascii == 1:
133-
commands = [os.path.join(FusionUtils.FusionPath(), 'DTM2ASCII.exe')]
134-
commands.append(self.getOutputValue(self.OUTPUT_DTM))
135-
commands.append(self.getOutputValue(self.OUTPUT_ASCII))
136-
p = subprocess.Popen(commands, shell=True)
137-
p.wait()
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
***************************************************************************
5+
PolyClipData.py
6+
---------------------
7+
Date : May 2014
8+
Copyright : (C) 2014 by Niccolo' Marchi
9+
Email : sciurusurbanus at hotmail dot it
10+
***************************************************************************
11+
* *
12+
* This program is free software; you can redistribute it and/or modify *
13+
* it under the terms of the GNU General Public License as published by *
14+
* the Free Software Foundation; either version 2 of the License, or *
15+
* (at your option) any later version. *
16+
* *
17+
***************************************************************************
18+
"""
19+
20+
__author__ = "Niccolo' Marchi"
21+
__date__ = 'May 2014'
22+
__copyright__ = "(C) 2014 by Niccolo' Marchi"
23+
24+
# This will get replaced with a git SHA1 when you do a git archive
25+
26+
__revision__ = '$Format:%H$'
27+
28+
import os
29+
import subprocess
30+
from PyQt4 import QtGui
31+
from processing.parameters.ParameterFile import ParameterFile
32+
from processing.parameters.ParameterVector import ParameterVector
33+
from processing.parameters.ParameterBoolean import ParameterBoolean
34+
from processing.parameters.ParameterString import ParameterString
35+
from processing.outputs.OutputFile import OutputFile
36+
from FusionAlgorithm import FusionAlgorithm
37+
from FusionUtils import FusionUtils
38+
39+
40+
class PolyClipData(FusionAlgorithm):
41+
42+
INPUT = 'INPUT'
43+
OUTPUT = 'OUTPUT'
44+
SHAPE = 'SHAPE'
45+
MASK = 'MASK'
46+
FIELD ='FIELD'
47+
VALUE = 'VALUE'
48+
49+
def defineCharacteristics(self):
50+
self.name = 'Poly Clip Data'
51+
self.group = 'Points'
52+
self.addParameter(ParameterFile(self.INPUT, 'Input .las layer'))
53+
self.addParameter(ParameterFile(self.MASK, 'Mask layer'))
54+
self.addOutput(OutputFile(self.OUTPUT, 'Output clipped .las file', 'las'))
55+
self.addParameter(ParameterBoolean(self.SHAPE, 'Use Shape attribute ', False))
56+
## 'field' e 'value' box should appear or get activated if Shape attribute is switched ON
57+
self.addParameter(ParameterString(self.FIELD, 'Shape field index'))
58+
self.addParameter(ParameterString(self.VALUE, "Shape value"))
59+
self.addAdvancedModifiers()
60+
61+
62+
def processAlgorithm(self, progress):
63+
commands = [os.path.join(FusionUtils.FusionPath(), 'PolyClipData.exe')]
64+
commands.append('/verbose')
65+
if self.getParameterValue(self.SHAPE):
66+
commands.append('/shape:' + str(self.getParameterValue(self.FIELD)) + ',' + str(self.getParameterValue(self.VALUE)))
67+
self.addAdvancedModifiersToCommand(commands)
68+
commands.append(self.getParameterValue(self.MASK))
69+
outFile = self.getOutputValue(self.OUTPUT)
70+
commands.append(outFile)
71+
files = self.getParameterValue(self.INPUT).split(';')
72+
if len(files) == 1:
73+
commands.append(self.getParameterValue(self.INPUT))
74+
else:
75+
FusionUtils.createFileList(files)
76+
commands.append(FusionUtils.tempFileListFilepath())
77+
78+
FusionUtils.runFusion(commands, progress)

‎python/plugins/processing/algs/lidar/fusion/TinSurfaceCreate.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,11 @@ class TinSurfaceCreate(FusionAlgorithm):
3939

4040
INPUT = 'INPUT'
4141
OUTPUT_DTM = 'OUTPUT_DTM';
42-
OUTPUT_ASCII = 'OUTPUT_ASCII';
4342
CELLSIZE = 'CELLSIZE'
4443
XYUNITS = 'XYUNITS'
4544
ZUNITS = 'ZUNITS'
4645
UNITS = ['Meter', 'Feet']
4746
CLASS = 'CLASS'
48-
ASCII = 'ASCII'
4947

5048
def defineCharacteristics(self):
5149
self.name = 'Tin Surface Create'
@@ -55,9 +53,7 @@ def defineCharacteristics(self):
5553
self.addParameter(ParameterSelection(self.XYUNITS, 'XY Units', self.UNITS))
5654
self.addParameter(ParameterSelection(self.ZUNITS, 'Z Units', self.UNITS))
5755
self.addOutput(OutputFile(self.OUTPUT_DTM, 'DTM Output Surface', 'dtm'))
58-
self.addOutput(OutputFile(self.OUTPUT_ASCII, 'ASCII Output Surface', 'asc'))
59-
self.addParameter(ParameterBoolean(self.ASCII, 'ASCII Output?'))
60-
class_var = ParameterString(self.CLASS, 'Class(set blank if not used)', 2, False, True)
56+
class_var = ParameterString(self.CLASS, 'Class', 2, False, True)
6157
class_var.isAdvanced = True
6258
self.addParameter(class_var)
6359

@@ -82,10 +78,3 @@ def processAlgorithm(self, progress):
8278
else:
8379
commands.extend(files)
8480
FusionUtils.runFusion(commands, progress)
85-
ascii = self.getParameterValue(self.ASCII)
86-
if ascii == 1:
87-
commands = [os.path.join(FusionUtils.FusionPath(), 'DTM2ASCII.exe')]
88-
commands.append(self.getOutputValue(self.OUTPUT_DTM))
89-
commands.append(self.getOutputValue(self.OUTPUT_ASCII))
90-
p = subprocess.Popen(commands, shell=True)
91-
p.wait()

0 commit comments

Comments
 (0)
Please sign in to comment.