2013-09-24 22:06:50 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
"""
|
|
|
|
***************************************************************************
|
|
|
|
lastile.py
|
|
|
|
---------------------
|
|
|
|
Date : September 2013
|
|
|
|
Copyright : (C) 2013 by Martin Isenburg
|
|
|
|
Email : martin near rapidlasso point com
|
|
|
|
***************************************************************************
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
***************************************************************************
|
|
|
|
"""
|
|
|
|
|
|
|
|
__author__ = 'Martin Isenburg'
|
|
|
|
__date__ = 'September 2013'
|
|
|
|
__copyright__ = '(C) 2013, Martin Isenburg'
|
|
|
|
# This will get replaced with a git SHA1 when you do a git archive
|
|
|
|
__revision__ = '$Format:%H$'
|
|
|
|
|
|
|
|
import os
|
2014-04-17 01:41:25 +02:00
|
|
|
from LAStoolsUtils import LAStoolsUtils
|
|
|
|
from LAStoolsAlgorithm import LAStoolsAlgorithm
|
2013-09-24 22:06:50 +02:00
|
|
|
|
2014-07-14 14:19:09 +02:00
|
|
|
from processing.core.parameters import ParameterNumber
|
2013-09-24 22:06:50 +02:00
|
|
|
|
2015-08-22 14:29:41 +02:00
|
|
|
|
2013-09-24 22:06:50 +02:00
|
|
|
class lastile(LAStoolsAlgorithm):
|
|
|
|
|
2014-05-19 19:58:33 +02:00
|
|
|
TILE_SIZE = "TILE_SIZE"
|
|
|
|
BUFFER = "BUFFER"
|
|
|
|
REVERSIBLE = "REVERSIBLE"
|
2013-09-24 22:06:50 +02:00
|
|
|
|
|
|
|
def defineCharacteristics(self):
|
2015-07-26 03:48:27 +02:00
|
|
|
self.name, self.i18n_name = self.trAlgorithm('lastile')
|
|
|
|
self.group, self.i18n_group = self.trAlgorithm('LAStools')
|
2013-09-24 22:06:50 +02:00
|
|
|
self.addParametersVerboseGUI()
|
|
|
|
self.addParametersPointInputGUI()
|
|
|
|
self.addParametersFilesAreFlightlinesGUI()
|
2014-12-22 12:32:37 +01:00
|
|
|
self.addParametersApplyFileSourceIdGUI()
|
2015-01-14 20:57:56 +02:00
|
|
|
self.addParameter(ParameterNumber(lastile.TILE_SIZE,
|
2015-08-22 14:29:41 +02:00
|
|
|
self.tr("tile size (side length of square tile)"),
|
|
|
|
None, None, 1000.0))
|
2015-01-14 20:57:56 +02:00
|
|
|
self.addParameter(ParameterNumber(lastile.BUFFER,
|
2015-08-22 14:29:41 +02:00
|
|
|
self.tr("buffer around each tile"), None, None, 0.0))
|
2015-01-14 20:57:56 +02:00
|
|
|
self.addParameter(ParameterNumber(lastile.REVERSIBLE,
|
2015-08-22 14:29:41 +02:00
|
|
|
self.tr("make tiling reversible (advanced, usually not needed)"), False))
|
2013-09-24 22:06:50 +02:00
|
|
|
self.addParametersPointOutputGUI()
|
2014-12-22 12:32:37 +01:00
|
|
|
self.addParametersAdditionalGUI()
|
2013-09-24 22:06:50 +02:00
|
|
|
|
|
|
|
def processAlgorithm(self, progress):
|
2014-12-22 12:32:37 +01:00
|
|
|
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lastile")]
|
2013-09-24 22:06:50 +02:00
|
|
|
self.addParametersVerboseCommands(commands)
|
|
|
|
self.addParametersPointInputCommands(commands)
|
|
|
|
self.addParametersFilesAreFlightlinesCommands(commands)
|
2014-12-22 12:32:37 +01:00
|
|
|
self.addParametersApplyFileSourceIdCommands(commands)
|
2013-09-24 22:06:50 +02:00
|
|
|
tile_size = self.getParameterValue(lastile.TILE_SIZE)
|
2014-05-19 19:58:33 +02:00
|
|
|
commands.append("-tile_size")
|
2015-08-16 20:57:24 +02:00
|
|
|
commands.append(unicode(tile_size))
|
2013-09-24 22:06:50 +02:00
|
|
|
buffer = self.getParameterValue(lastile.BUFFER)
|
|
|
|
if buffer != 0.0:
|
2014-05-19 19:58:33 +02:00
|
|
|
commands.append("-buffer")
|
2015-08-16 20:57:24 +02:00
|
|
|
commands.append(unicode(buffer))
|
2013-09-24 22:06:50 +02:00
|
|
|
if self.getParameterValue(lastile.REVERSIBLE):
|
2014-05-19 19:58:33 +02:00
|
|
|
commands.append("-reversible")
|
2013-09-24 22:06:50 +02:00
|
|
|
self.addParametersPointOutputCommands(commands)
|
2014-12-22 12:32:37 +01:00
|
|
|
self.addParametersAdditionalCommands(commands)
|
2013-09-24 22:06:50 +02:00
|
|
|
|
|
|
|
LAStoolsUtils.runLAStools(commands, progress)
|