2014-12-22 12:32:37 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
"""
|
|
|
|
***************************************************************************
|
|
|
|
lasduplicate.py
|
|
|
|
---------------------
|
|
|
|
Date : October 2014
|
|
|
|
Copyright : (C) 2014 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. *
|
|
|
|
* *
|
|
|
|
***************************************************************************
|
|
|
|
"""
|
2016-09-21 18:24:26 +02:00
|
|
|
from future import standard_library
|
|
|
|
standard_library.install_aliases()
|
2014-12-22 12:32:37 +01:00
|
|
|
|
|
|
|
__author__ = 'Martin Isenburg'
|
|
|
|
__date__ = 'October 2014'
|
|
|
|
__copyright__ = '(C) 2014, Martin Isenburg'
|
|
|
|
# This will get replaced with a git SHA1 when you do a git archive
|
|
|
|
__revision__ = '$Format:%H$'
|
|
|
|
|
|
|
|
import os
|
2016-03-21 04:58:12 +01:00
|
|
|
from .LAStoolsUtils import LAStoolsUtils
|
|
|
|
from .LAStoolsAlgorithm import LAStoolsAlgorithm
|
2014-12-22 12:32:37 +01:00
|
|
|
|
|
|
|
from processing.core.parameters import ParameterBoolean
|
|
|
|
|
2015-08-22 14:29:41 +02:00
|
|
|
|
2014-12-22 12:32:37 +01:00
|
|
|
class lasduplicatePro(LAStoolsAlgorithm):
|
|
|
|
|
|
|
|
LOWEST_Z = "LOWEST_Z"
|
|
|
|
UNIQUE_XYZ = "UNIQUE_XYZ"
|
|
|
|
SINGLE_RETURNS = "SINGLE_RETURNS"
|
|
|
|
RECORD_REMOVED = "RECORD_REMOVED"
|
|
|
|
|
|
|
|
def defineCharacteristics(self):
|
2015-07-26 03:48:27 +02:00
|
|
|
self.name, self.i18n_name = self.trAlgorithm('lasduplicatePro')
|
|
|
|
self.group, self.i18n_group = self.trAlgorithm('LAStools Production')
|
2014-12-22 12:32:37 +01:00
|
|
|
self.addParametersPointInputFolderGUI()
|
2015-01-14 20:57:56 +02:00
|
|
|
self.addParameter(ParameterBoolean(lasduplicatePro.LOWEST_Z,
|
2015-08-22 14:29:41 +02:00
|
|
|
self.tr("keep duplicate with lowest z coordinate"), False))
|
2015-01-14 20:57:56 +02:00
|
|
|
self.addParameter(ParameterBoolean(lasduplicatePro.UNIQUE_XYZ,
|
2015-08-22 14:29:41 +02:00
|
|
|
self.tr("only remove duplicates in x y and z"), False))
|
2015-01-14 20:57:56 +02:00
|
|
|
self.addParameter(ParameterBoolean(lasduplicatePro.SINGLE_RETURNS,
|
2015-08-22 14:29:41 +02:00
|
|
|
self.tr("mark surviving duplicate as single return"), False))
|
2015-01-14 20:57:56 +02:00
|
|
|
self.addParameter(ParameterBoolean(lasduplicatePro.RECORD_REMOVED,
|
2015-08-22 14:29:41 +02:00
|
|
|
self.tr("record removed duplicates"), False))
|
2014-12-22 12:32:37 +01:00
|
|
|
self.addParametersOutputDirectoryGUI()
|
|
|
|
self.addParametersOutputAppendixGUI()
|
|
|
|
self.addParametersPointOutputFormatGUI()
|
|
|
|
self.addParametersAdditionalGUI()
|
|
|
|
self.addParametersCoresGUI()
|
|
|
|
self.addParametersVerboseGUI()
|
|
|
|
|
|
|
|
def processAlgorithm(self, progress):
|
|
|
|
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasduplicate")]
|
|
|
|
self.addParametersVerboseCommands(commands)
|
|
|
|
self.addParametersPointInputFolderCommands(commands)
|
|
|
|
if self.getParameterValue(lasduplicatePro.LOWEST_Z):
|
|
|
|
commands.append("-lowest_z")
|
|
|
|
if self.getParameterValue(lasduplicatePro.UNIQUE_XYZ):
|
|
|
|
commands.append("-unique_xyz")
|
|
|
|
if self.getParameterValue(lasduplicatePro.SINGLE_RETURNS):
|
|
|
|
commands.append("-single_returns")
|
|
|
|
if self.getParameterValue(lasduplicatePro.RECORD_REMOVED):
|
|
|
|
commands.append("-record_removed")
|
|
|
|
self.addParametersOutputDirectoryCommands(commands)
|
|
|
|
self.addParametersOutputAppendixCommands(commands)
|
|
|
|
self.addParametersPointOutputFormatCommands(commands)
|
|
|
|
self.addParametersAdditionalCommands(commands)
|
|
|
|
self.addParametersCoresCommands(commands)
|
|
|
|
|
|
|
|
LAStoolsUtils.runLAStools(commands, progress)
|