2012-10-04 19:33:47 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
"""
|
|
|
|
***************************************************************************
|
|
|
|
FusionAlgorithm.py
|
|
|
|
---------------------
|
|
|
|
Date : August 2012
|
|
|
|
Copyright : (C) 2012 by Victor Olaya
|
|
|
|
Email : volayaf at gmail dot 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()
|
|
|
|
from builtins import str
|
2012-10-04 19:33:47 +02:00
|
|
|
|
|
|
|
__author__ = 'Victor Olaya'
|
|
|
|
__date__ = 'August 2012'
|
|
|
|
__copyright__ = '(C) 2012, Victor Olaya'
|
2013-10-01 20:52:22 +03:00
|
|
|
|
2012-10-04 19:33:47 +02:00
|
|
|
# This will get replaced with a git SHA1 when you do a git archive
|
2013-10-01 20:52:22 +03:00
|
|
|
|
2012-10-04 19:33:47 +02:00
|
|
|
__revision__ = '$Format:%H$'
|
|
|
|
|
2012-09-15 18:25:25 +03:00
|
|
|
import os
|
2016-04-22 10:38:48 +02:00
|
|
|
from qgis.PyQt.QtGui import QIcon
|
2013-10-01 20:52:22 +03:00
|
|
|
from processing.core.GeoAlgorithm import GeoAlgorithm
|
2014-07-14 14:19:09 +02:00
|
|
|
from processing.core.parameters import ParameterString
|
2016-03-21 04:58:12 +01:00
|
|
|
from .FusionUtils import FusionUtils
|
2012-09-15 18:25:25 +03:00
|
|
|
|
2013-10-01 20:52:22 +03:00
|
|
|
|
2012-09-15 18:25:25 +03:00
|
|
|
class FusionAlgorithm(GeoAlgorithm):
|
|
|
|
|
2013-10-01 20:52:22 +03:00
|
|
|
ADVANCED_MODIFIERS = 'ADVANCED_MODIFIERS'
|
2012-09-15 18:25:25 +03:00
|
|
|
|
|
|
|
def getIcon(self):
|
2014-05-19 19:58:33 +02:00
|
|
|
filepath = os.path.dirname(__file__) + '/../../../images/tool.png'
|
2016-03-14 20:26:58 +01:00
|
|
|
return QIcon(filepath)
|
2012-09-15 18:25:25 +03:00
|
|
|
|
|
|
|
def checkBeforeOpeningParametersDialog(self):
|
2013-10-01 20:52:22 +03:00
|
|
|
path = FusionUtils.FusionPath()
|
|
|
|
if path == '':
|
2015-01-14 20:57:56 +02:00
|
|
|
return self.tr('Fusion folder is not configured.\nPlease '
|
|
|
|
'configure it before running Fusion algorithms.')
|
2012-09-15 18:25:25 +03:00
|
|
|
|
|
|
|
def addAdvancedModifiers(self):
|
2015-01-14 20:57:56 +02:00
|
|
|
param = ParameterString(
|
|
|
|
self.ADVANCED_MODIFIERS, self.tr('Additional modifiers'), '')
|
2012-09-15 18:25:25 +03:00
|
|
|
param.isAdvanced = True
|
|
|
|
self.addParameter(param)
|
|
|
|
|
|
|
|
def addAdvancedModifiersToCommand(self, commands):
|
2016-09-21 18:24:26 +02:00
|
|
|
s = str(self.getParameterValue(self.ADVANCED_MODIFIERS)).strip()
|
2013-10-01 20:52:22 +03:00
|
|
|
if s != '':
|
2012-09-15 18:25:25 +03:00
|
|
|
commands.append(s)
|