Skip to content

Commit

Permalink
[processing] i18n support for lastools provider
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Jan 17, 2015
1 parent f3f09fa commit c5cb2f8
Show file tree
Hide file tree
Showing 89 changed files with 810 additions and 454 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,13 @@ def initializeSettings(self):
AlgorithmProvider.initializeSettings(self)
ProcessingConfig.addSetting(Setting(self.getDescription(),
LAStoolsUtils.LASTOOLS_FOLDER,
'LAStools folder', LAStoolsUtils.LAStoolsPath()))
self.tr('LAStools folder'), LAStoolsUtils.LAStoolsPath()))
ProcessingConfig.addSetting(Setting(self.getDescription(),
FusionUtils.FUSION_FOLDER,
'Fusion folder', FusionUtils.FusionPath()))
self.tr('Fusion folder'), FusionUtils.FusionPath()))
ProcessingConfig.addSetting(Setting(self.getDescription(),
LAStoolsUtils.WINE_FOLDER,
'Wine folder', ''))
self.tr('Wine folder'), ''))

def getName(self):
return 'lidartools'
Expand Down
24 changes: 14 additions & 10 deletions python/plugins/processing/algs/lidar/fusion/ASCII2DTM.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,20 @@ class ASCII2DTM(FusionAlgorithm):
def defineCharacteristics(self):
self.name = 'ASCII to DTM'
self.group = 'Conversion'
self.addParameter(ParameterFile(self.INPUT, 'Input ESRI ASCII layer'))
self.addParameter(ParameterSelection(self.XYUNITS, 'XY Units',
self.UNITS))
self.addParameter(ParameterSelection(self.ZUNITS, 'Z Units',
self.UNITS))
self.addParameter(ParameterSelection(self.COORDSYS, 'Coordinate system',
['unknown', 'UTM', 'state plane']))
self.addParameter(ParameterNumber(self.ZONE, "Coordinate system zone ('0' for unknown)", 0, None,
0))
self.addOutput(OutputFile(self.OUTPUT, 'Output surface', 'dtm'))
self.addParameter(ParameterFile(
self.INPUT, self.tr('Input ESRI ASCII layer')))
self.addParameter(ParameterSelection(
self.XYUNITS, self.tr('XY Units'), self.UNITS))
self.addParameter(ParameterSelection(
self.ZUNITS, self.tr('Z Units'), self.UNITS))
self.addParameter(ParameterSelection(self.COORDSYS,
self.tr('Coordinate system'), ['unknown', 'UTM', 'state plane']))
self.addParameter(ParameterNumber(self.ZONE,
self.tr("Coordinate system zone ('0' for unknown)"), 0, None, 0))

self.addOutput(OutputFile(
self.OUTPUT, self.tr('Output surface'), 'dtm'))

self.addAdvancedModifiers()

def processAlgorithm(self, progress):
Expand Down
26 changes: 14 additions & 12 deletions python/plugins/processing/algs/lidar/fusion/CanopyMaxima.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,24 @@ class CanopyMaxima(FusionAlgorithm):
def defineCharacteristics(self):
self.name = 'Canopy Maxima'
self.group = 'Points'
self.addParameter(ParameterFile(self.INPUT, 'Input FUSION canopy height model'))
self.addParameter(ParameterFile(self.GROUND, 'Input ground .dtm layer [optional]'))
self.addParameter(ParameterNumber(self.THRESHOLD, 'Height threshold',
0, None, 10.0))
self.addParameter(ParameterFile(self.INPUT,
self.tr('Input FUSION canopy height model')))
self.addParameter(ParameterFile(self.GROUND,
self.tr('Input ground .dtm layer [optional]')))
self.addParameter(ParameterNumber(self.THRESHOLD,
self.tr('Height threshold'), 0, None, 10.0))
### begin
self.addParameter(ParameterNumber(self.PARAM_A, 'Variable window size: parameter A',
0, None, 2.51503))
self.addParameter(ParameterNumber(self.PARAM_C, 'Parameter C',
0, None, 0.00901))
self.addParameter(ParameterBoolean(self.SUMMARY, 'Summary (tree height summary statistics)',
False))
self.addParameter(ParameterNumber(self.PARAM_A,
self.tr('Variable window size: parameter A'), 0, None, 2.51503))
self.addParameter(ParameterNumber(self.PARAM_C,
self.tr('Parameter C'), 0, None, 0.00901))
self.addParameter(ParameterBoolean(self.SUMMARY,
self.tr('Summary (tree height summary statistics)'), False))
### end
self.addOutput(OutputTable(self.OUTPUT, 'Output file with maxima'))
self.addOutput(OutputTable(self.OUTPUT,
self.tr('Output file with maxima')))
self.addAdvancedModifiers()


def processAlgorithm(self, progress):
commands = [os.path.join(FusionUtils.FusionPath(), 'CanopyMaxima.exe')]
commands.append('/verbose')
Expand Down
33 changes: 22 additions & 11 deletions python/plugins/processing/algs/lidar/fusion/CanopyModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,38 @@ class CanopyModel(FusionAlgorithm):
def defineCharacteristics(self):
self.name = 'Canopy Model'
self.group = 'Points'
self.addParameter(ParameterFile(self.INPUT, 'Input las layer'))
self.addParameter(ParameterNumber(self.CELLSIZE, 'Cellsize', 0, None, 10.0))
self.addParameter(ParameterSelection(self.XYUNITS, 'XY Units', self.UNITS))
self.addParameter(ParameterSelection(self.ZUNITS, 'Z Units', self.UNITS))
self.addOutput(OutputFile(self.OUTPUT_DTM, 'DTM Output Surface', 'dtm'))
ground = ParameterFile(self.GROUND, 'Input ground DTM layer', False, True)
self.addParameter(ParameterFile(
self.INPUT, self.tr('Input las layer')))
self.addParameter(ParameterNumber(self.CELLSIZE,
self.tr('Cellsize'), 0, None, 10.0))
self.addParameter(ParameterSelection(self.XYUNITS,
self.tr('XY Units'), self.UNITS))
self.addParameter(ParameterSelection(self.ZUNITS,
self.tr('Z Units'), self.UNITS))
self.addOutput(OutputFile(self.OUTPUT_DTM,
self.tr('DTM Output Surface'), 'dtm'))
ground = ParameterFile(self.GROUND,
self.tr('Input ground DTM layer'), False, True)
ground.isAdvanced = True
self.addParameter(ground)
median = ParameterString(self.MEDIAN, 'Median', '', False, True)
median = ParameterString(self.MEDIAN,
self.tr('Median'), '', False, True)
median.isAdvanced = True
self.addParameter(median)
smooth = ParameterString(self.SMOOTH, 'Smooth', '', False, True)
smooth = ParameterString(self.SMOOTH,
self.tr('Smooth'), '', False, True)
smooth.isAdvanced = True
self.addParameter(smooth)
slope = ParameterString(self.SLOPE, 'Slope', '', False, True)
slope = ParameterString(self.SLOPE,
self.tr('Slope'), '', False, True)
slope.isAdvanced = True
self.addParameter(slope)
class_var = ParameterString(self.CLASS, 'Class', '', False, True)
class_var = ParameterString(self.CLASS,
self.tr('Class'), '', False, True)
class_var.isAdvanced = True
self.addParameter(class_var)
advance_modifiers = ParameterString(self.ADVANCED_MODIFIERS, 'Additional modifiers', '', False, True)
advance_modifiers = ParameterString(self.ADVANCED_MODIFIERS,
self.tr('Additional modifiers'), '', False, True)
advance_modifiers.isAdvanced = True
self.addParameter(advance_modifiers)

Expand Down
22 changes: 15 additions & 7 deletions python/plugins/processing/algs/lidar/fusion/Catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,26 @@ class Catalog(FusionAlgorithm):
def defineCharacteristics(self):
self.name = 'Catalog'
self.group = 'Points'
self.addParameter(ParameterFile(self.INPUT, 'Input las layer'))
self.addOutput(OutputFile(self.OUTPUT, 'Output files'))
density = ParameterString(self.DENSITY, 'Density - area, min, max (set blank if not used)', '', False, True)
self.addParameter(ParameterFile(
self.INPUT, self.tr('Input las layer')))
self.addOutput(OutputFile(self.OUTPUT, self.tr('Output files')))
density = ParameterString(self.DENSITY,
self.tr('Density - area, min, max (set blank if not used)'),
'', False, True)
density.isAdvanced = True
self.addParameter(density)
firest_density = ParameterString(self.FIRSTDENSITY, 'First Density - area, min, max (set blank if not used)', '', False, True)
firest_density = ParameterString(self.FIRSTDENSITY,
self.tr('First Density - area, min, max (set blank if not used)'),
'', False, True)
firest_density.isAdvanced = True
self.addParameter(firest_density)
intensity = ParameterString(self.INTENSITY, 'Intensity - area, min, max (set blank if not used)', '', False, True)
intensity = ParameterString(self.INTENSITY,
self.tr('Intensity - area, min, max (set blank if not used)'),
'', False, True)
intensity.isAdvanced = True
self.addParameter(intensity)
advanced_modifiers = ParameterString(self.ADVANCED_MODIFIERS, 'Additional modifiers', '', False, True)
advanced_modifiers = ParameterString(self.ADVANCED_MODIFIERS,
self.tr('Additional modifiers'), '', False, True)
advanced_modifiers.isAdvanced = True
self.addParameter(advanced_modifiers)

Expand All @@ -81,4 +89,4 @@ def processAlgorithm(self, progress):
FusionUtils.createFileList(files)
commands.append(FusionUtils.tempFileListFilepath())
commands.append(self.getOutputValue(self.OUTPUT))
FusionUtils.runFusion(commands, progress)
FusionUtils.runFusion(commands, progress)
12 changes: 7 additions & 5 deletions python/plugins/processing/algs/lidar/fusion/ClipData.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ class ClipData(FusionAlgorithm):
def defineCharacteristics(self):
self.name = 'Clip Data'
self.group = 'Points'
self.addParameter(ParameterFile(self.INPUT, 'Input las layer'))
self.addParameter(ParameterExtent(self.EXTENT, 'Extent'))
self.addParameter(ParameterSelection(self.SHAPE, 'Shape',
['Rectangle', 'Circle']))
self.addOutput(OutputFile(self.OUTPUT, 'Output clipped las file'))
self.addParameter(ParameterFile(
self.INPUT, self.tr('Input las layer')))
self.addParameter(ParameterExtent(self.EXTENT, self.tr('Extent')))
self.addParameter(ParameterSelection(self.SHAPE,
self.tr('Shape'), ['Rectangle', 'Circle']))
self.addOutput(OutputFile(self.OUTPUT,
self.tr('Output clipped las file')))
self.addAdvancedModifiers()

def processAlgorithm(self, progress):
Expand Down
16 changes: 10 additions & 6 deletions python/plugins/processing/algs/lidar/fusion/CloudMetrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,22 @@ class CloudMetrics(FusionAlgorithm):
def defineCharacteristics(self):
self.name = 'Cloud Metrics'
self.group = 'Points'
self.addParameter(ParameterFile(self.INPUT, 'Input las layer'))
self.addOutput(OutputFile(self.OUTPUT, 'Output file with tabular metric information', 'dtm'))
above = ParameterString(self.ABOVE, 'Above', '', False)
self.addParameter(ParameterFile(
self.INPUT, self.tr('Input las layer')))
self.addOutput(OutputFile(self.OUTPUT,
self.tr('Output file with tabular metric information'), 'dtm'))
above = ParameterString(self.ABOVE, self.tr('Above'), '', False)
above.isAdvanced = True
self.addParameter(above)
firstImpulse = ParameterBoolean(self.FIRSTIMPULSE, 'First Impulse', False)
firstImpulse = ParameterBoolean(
self.FIRSTIMPULSE, self.tr('First Impulse'), False)
firstImpulse.isAdvanced = True
self.addParameter(firstImpulse)
firstReturn = ParameterBoolean(self.FIRSTRETURN, 'First Return', False)
firstReturn = ParameterBoolean(
self.FIRSTRETURN, self.tr('First Return'), False)
firstReturn.isAdvanced = True
self.addParameter(firstReturn)
htmin = ParameterString(self.HTMIN, 'Htmin', '', False, True)
htmin = ParameterString(self.HTMIN, self.tr('Htmin'), '', False, True)
htmin.isAdvanced = True
self.addParameter(htmin)

Expand Down
24 changes: 13 additions & 11 deletions python/plugins/processing/algs/lidar/fusion/Cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,19 @@ class Cover(FusionAlgorithm):
def defineCharacteristics(self):
self.name = 'Cover'
self.group = 'Points'
self.addParameter(ParameterFile(self.INPUT, 'Input las layer'))
self.addParameter(ParameterFile(self.GROUND, 'Input ground DTM layer'))
self.addParameter(ParameterNumber(self.CELLSIZE, 'Cellsize', 0, None,
10.0))
self.addParameter(ParameterNumber(self.HEIGHTBREAK, 'Heightbreak', 0,
None, 10.0))
self.addParameter(ParameterSelection(self.XYUNITS, 'XY Units',
self.UNITS))
self.addParameter(ParameterSelection(self.ZUNITS, 'Z Units',
self.UNITS))
self.addOutput(OutputRaster(self.OUTPUT, 'Cover'))
self.addParameter(ParameterFile(
self.INPUT, self.tr('Input las layer')))
self.addParameter(ParameterFile(
self.GROUND, self.tr('Input ground DTM layer')))
self.addParameter(ParameterNumber(
self.CELLSIZE, self.tr('Cellsize'), 0, None, 10.0))
self.addParameter(ParameterNumber(self.HEIGHTBREAK,
self.tr('Heightbreak'), 0, None, 10.0))
self.addParameter(ParameterSelection(self.XYUNITS,
self.tr('XY Units'), self.UNITS))
self.addParameter(ParameterSelection(self.ZUNITS,
self.tr('Z Units'), self.UNITS))
self.addOutput(OutputRaster(self.OUTPUT, self.tr('Cover')))
self.addAdvancedModifiers()

def processAlgorithm(self, progress):
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/processing/algs/lidar/fusion/Csv2Grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ class Csv2Grid(FusionAlgorithm):
def defineCharacteristics(self):
self.name = 'Csv2Grid'
self.group = 'Points'
self.addParameter(ParameterFile(self.INPUT, 'CSV Files'))
self.addParameter(ParameterString(self.COLUMN, 'Column'))
self.addOutput(OutputFile(self.OUTPUT, 'Raster Output file', 'asc'))

self.addParameter(ParameterFile(self.INPUT, self.tr('CSV Files')))
self.addParameter(ParameterString(self.COLUMN, self.tr('Column')))
self.addOutput(OutputFile(self.OUTPUT,
self.tr('Raster Output file'), 'asc'))

def processAlgorithm(self, progress):
commands = [os.path.join(FusionUtils.FusionPath(), 'CSV2Grid.exe')]
Expand Down
5 changes: 3 additions & 2 deletions python/plugins/processing/algs/lidar/fusion/DTM2TIF.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ class DTM2TIF(FusionAlgorithm):
def defineCharacteristics(self):
self.name = "DTM to TIF"
self.group = "Conversion"
self.addParameter(ParameterFile(self.INPUT, "Input .dtm layer"))
self.addOutput(OutputRaster(self.OUTPUT, 'Output file name'))
self.addParameter(ParameterFile(
self.INPUT, self.tr("Input .dtm layer")))
self.addOutput(OutputRaster(self.OUTPUT, self.tr('Output file name')))
self.addAdvancedModifiers()

def processAlgorithm(self, progress):
Expand Down
12 changes: 7 additions & 5 deletions python/plugins/processing/algs/lidar/fusion/FilterData.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ class FilterData(FusionAlgorithm):
def defineCharacteristics(self):
self.name = 'Filter Data outliers'
self.group = 'Points'
self.addParameter(ParameterFile(self.INPUT, 'Input las layer'))
self.addParameter(ParameterFile(
self.INPUT, self.tr('Input las layer')))
self.addParameter(ParameterNumber(
self.VALUE, self.tr('Standard Deviation multiplier')))
self.addParameter(ParameterNumber(self.VALUE,
'Standard Deviation multiplier'))
self.addParameter(ParameterNumber(self.VALUE, 'Window size', None,
None, 10))
self.addOutput(OutputFile(self.OUTPUT, 'Output filtered las file'))
self.tr('Window size'), None, None, 10))
self.addOutput(OutputFile(
self.OUTPUT, self.tr('Output filtered las file')))
self.addAdvancedModifiers()

def processAlgorithm(self, progress):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ class FirstLastReturn(FusionAlgorithm):
def defineCharacteristics(self):
self.name = 'First&Last Return'
self.group = 'Points'
self.addParameter(ParameterFile(self.INPUT, 'Input .las'))
self.addParameter(ParameterBoolean(self.SWITCH, 'Use LAS info', True))
self.addOutput(OutputFile(self.OUTPUT, 'Output layers'))
self.addParameter(ParameterFile(self.INPUT, self.tr('Input .las')))
self.addParameter(ParameterBoolean(
self.SWITCH, self.tr('Use LAS info'), True))
self.addOutput(OutputFile(self.OUTPUT, self.tr('Output layers')))
self.addAdvancedModifiers()

def processAlgorithm(self, progress):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ def getIcon(self):
def checkBeforeOpeningParametersDialog(self):
path = FusionUtils.FusionPath()
if path == '':
return 'Fusion folder is not configured.\nPlease configure it \
before running Fusion algorithms.'
return self.tr('Fusion folder is not configured.\nPlease '
'configure it before running Fusion algorithms.')

def addAdvancedModifiers(self):
param = ParameterString(self.ADVANCED_MODIFIERS, 'Additional modifiers'
, '')
param = ParameterString(
self.ADVANCED_MODIFIERS, self.tr('Additional modifiers'), '')
param.isAdvanced = True
self.addParameter(param)

Expand Down
4 changes: 3 additions & 1 deletion python/plugins/processing/algs/lidar/fusion/FusionUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ def createFileList(files):
@staticmethod
def runFusion(commands, progress):
loglines = []
loglines.append('Fusion execution console output')
loglines.append(
QCoreApplication.translate('FusionUtils',
'Fusion execution console output')
proc = subprocess.Popen(
commands,
shell=True,
Expand Down
Loading

0 comments on commit c5cb2f8

Please sign in to comment.