mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
[processing] cleaning and restructuring
This fixes some design errors (mainly the ModelerUtils class, which is not needed anymore to hold a copy of algs and providers in order to avoid circular dependencies) and removes unused code
This commit is contained in:
parent
b4b05bade7
commit
e6b76c4d7b
@ -43,6 +43,19 @@ from processing.gui.CommanderWindow import CommanderWindow
|
||||
from processing.modeler.ModelerDialog import ModelerDialog
|
||||
from processing.tools.system import tempFolder
|
||||
from processing.gui.menus import removeMenus, initializeMenus, createMenus
|
||||
from processing.modeler.ModelerAlgorithmProvider import ModelerAlgorithmProvider
|
||||
from processing.modeler.ModelerOnlyAlgorithmProvider import ModelerOnlyAlgorithmProvider
|
||||
from processing.algs.qgis.QGISAlgorithmProvider import QGISAlgorithmProvider
|
||||
from processing.algs.grass.GrassAlgorithmProvider import GrassAlgorithmProvider
|
||||
from processing.algs.grass7.Grass7AlgorithmProvider import Grass7AlgorithmProvider
|
||||
from processing.algs.lidar.LidarToolsAlgorithmProvider import LidarToolsAlgorithmProvider
|
||||
from processing.algs.gdal.GdalOgrAlgorithmProvider import GdalOgrAlgorithmProvider
|
||||
from processing.algs.otb.OTBAlgorithmProvider import OTBAlgorithmProvider
|
||||
from processing.algs.r.RAlgorithmProvider import RAlgorithmProvider
|
||||
from processing.algs.saga.SagaAlgorithmProvider import SagaAlgorithmProvider
|
||||
from processing.script.ScriptAlgorithmProvider import ScriptAlgorithmProvider
|
||||
from processing.algs.taudem.TauDEMAlgorithmProvider import TauDEMAlgorithmProvider
|
||||
from processing.preconfigured.PreconfiguredAlgorithmProvider import PreconfiguredAlgorithmProvider
|
||||
|
||||
|
||||
cmd_folder = os.path.split(inspect.getfile(inspect.currentframe()))[0]
|
||||
|
@ -541,6 +541,12 @@ class GeoAlgorithm:
|
||||
s = s[:-1] + ')'
|
||||
return s
|
||||
|
||||
def displayName(self):
|
||||
return self.i18n_name or self.name
|
||||
|
||||
def displayNames(self):
|
||||
return self.name, self.i18n_name
|
||||
|
||||
def tr(self, string, context=''):
|
||||
if context == '':
|
||||
context = self.__class__.__name__
|
||||
|
@ -36,8 +36,7 @@ from qgis.utils import iface
|
||||
from qgis.core import QgsMessageLog
|
||||
|
||||
import processing
|
||||
from processing.gui import AlgorithmClassification
|
||||
from processing.modeler.ModelerUtils import ModelerUtils
|
||||
from processing.core.AlgorithmProvider import AlgorithmProvider
|
||||
from processing.core.ProcessingConfig import ProcessingConfig
|
||||
from processing.core.GeoAlgorithm import GeoAlgorithm
|
||||
from processing.core.ProcessingLog import ProcessingLog
|
||||
@ -45,20 +44,6 @@ from processing.gui.MessageBarProgress import MessageBarProgress
|
||||
from processing.gui.RenderingStyles import RenderingStyles
|
||||
from processing.gui.Postprocessing import handleAlgorithmResults
|
||||
from processing.gui.AlgorithmExecutor import runalg
|
||||
from processing.modeler.ModelerAlgorithmProvider import ModelerAlgorithmProvider
|
||||
from processing.modeler.ModelerOnlyAlgorithmProvider import ModelerOnlyAlgorithmProvider
|
||||
from processing.algs.qgis.QGISAlgorithmProvider import QGISAlgorithmProvider
|
||||
from processing.algs.grass.GrassAlgorithmProvider import GrassAlgorithmProvider
|
||||
from processing.algs.grass7.Grass7AlgorithmProvider import Grass7AlgorithmProvider
|
||||
from processing.algs.lidar.LidarToolsAlgorithmProvider import LidarToolsAlgorithmProvider
|
||||
from processing.algs.gdal.GdalOgrAlgorithmProvider import GdalOgrAlgorithmProvider
|
||||
from processing.algs.otb.OTBAlgorithmProvider import OTBAlgorithmProvider
|
||||
from processing.algs.r.RAlgorithmProvider import RAlgorithmProvider
|
||||
from processing.algs.saga.SagaAlgorithmProvider import SagaAlgorithmProvider
|
||||
from processing.script.ScriptAlgorithmProvider import ScriptAlgorithmProvider
|
||||
from processing.algs.taudem.TauDEMAlgorithmProvider import TauDEMAlgorithmProvider
|
||||
from processing.preconfigured.PreconfiguredAlgorithmProvider import PreconfiguredAlgorithmProvider
|
||||
|
||||
from processing.tools import dataobjects
|
||||
|
||||
|
||||
@ -85,22 +70,21 @@ class Processing:
|
||||
# All the registered context menu actions for the toolbox
|
||||
contextMenuActions = []
|
||||
|
||||
modeler = ModelerAlgorithmProvider()
|
||||
|
||||
@staticmethod
|
||||
def addProvider(provider, updateList=True):
|
||||
def addProvider(provider):
|
||||
"""Use this method to add algorithms from external providers.
|
||||
"""
|
||||
|
||||
# Note: this might slow down the initialization process if
|
||||
# there are many new providers added. Should think of a
|
||||
# different solution
|
||||
if provider.getName() in [p.getName for p in Processing.providers]:
|
||||
return
|
||||
try:
|
||||
provider.initializeSettings()
|
||||
Processing.providers.append(provider)
|
||||
ProcessingConfig.readSettings()
|
||||
if updateList:
|
||||
Processing.updateAlgsList()
|
||||
provider.loadAlgorithms()
|
||||
Processing.algs[provider.getName()] = {a.commandLineName(): a for a in provider.algs}
|
||||
Processing.actions[provider.getName()] = provider.actions
|
||||
Processing.contextMenuActions.extend(provider.contextMenuActions)
|
||||
algListWatcher.providerAdded.emit(provider.getName())
|
||||
except:
|
||||
ProcessingLog.addToLog(
|
||||
@ -125,7 +109,7 @@ class Processing:
|
||||
# This try catch block is here to avoid problems if the
|
||||
# plugin with a provider is unloaded after the Processing
|
||||
# framework itself has been unloaded. It is a quick fix
|
||||
# before I found out how to properly avoid that.
|
||||
# before I find out how to properly avoid that.
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
@ -139,27 +123,12 @@ class Processing:
|
||||
@staticmethod
|
||||
def initialize():
|
||||
# Add the basic providers
|
||||
Processing.addProvider(QGISAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(ModelerOnlyAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(GdalOgrAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(LidarToolsAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(OTBAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(RAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(SagaAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(GrassAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(Grass7AlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(ScriptAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(TauDEMAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(PreconfiguredAlgorithmProvider(), updateList=False)
|
||||
Processing.addProvider(Processing.modeler, updateList=False)
|
||||
Processing.modeler.initializeSettings()
|
||||
|
||||
for c in AlgorithmProvider.__subclasses__():
|
||||
Processing.addProvider(c())
|
||||
# And initialize
|
||||
AlgorithmClassification.loadClassification()
|
||||
ProcessingConfig.initialize()
|
||||
ProcessingConfig.readSettings()
|
||||
RenderingStyles.loadStyles()
|
||||
Processing.loadFromProviders()
|
||||
|
||||
@staticmethod
|
||||
def updateAlgsList():
|
||||
@ -168,21 +137,10 @@ class Processing:
|
||||
algorithm providers.
|
||||
"""
|
||||
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
|
||||
Processing.loadFromProviders()
|
||||
for p in Processing.providers:
|
||||
Processing.reloadProvider(p)
|
||||
QApplication.restoreOverrideCursor()
|
||||
|
||||
@staticmethod
|
||||
def loadFromProviders():
|
||||
Processing.loadAlgorithms()
|
||||
Processing.loadActions()
|
||||
Processing.loadContextMenuActions()
|
||||
|
||||
@staticmethod
|
||||
def updateProviders():
|
||||
providers = [p for p in Processing.providers if p.getName() != "model"]
|
||||
for provider in providers:
|
||||
provider.loadAlgorithms()
|
||||
|
||||
@staticmethod
|
||||
def reloadProvider(providerName):
|
||||
for p in Processing.providers:
|
||||
@ -191,50 +149,6 @@ class Processing:
|
||||
Processing.algs[
|
||||
p.getName()] = {a.commandLineName(): a for a in p.algs}
|
||||
|
||||
@staticmethod
|
||||
def loadAlgorithms():
|
||||
Processing.algs = {}
|
||||
Processing.updateProviders()
|
||||
providers = [p for p in Processing.providers if p.getName() != "model"]
|
||||
for provider in providers:
|
||||
providerAlgs = provider.algs
|
||||
algs = {}
|
||||
for alg in providerAlgs:
|
||||
algs[alg.commandLineName()] = alg
|
||||
Processing.algs[provider.getName()] = algs
|
||||
|
||||
provs = {}
|
||||
for provider in Processing.providers:
|
||||
provs[provider.getName()] = provider
|
||||
|
||||
ModelerUtils.allAlgs = Processing.algs
|
||||
ModelerUtils.providers = provs
|
||||
|
||||
Processing.modeler.loadAlgorithms()
|
||||
|
||||
algs = {}
|
||||
for alg in Processing.modeler.algs:
|
||||
algs[alg.commandLineName()] = alg
|
||||
Processing.algs[Processing.modeler.getName()] = algs
|
||||
|
||||
@staticmethod
|
||||
def loadActions():
|
||||
for provider in Processing.providers:
|
||||
providerActions = provider.actions
|
||||
actions = list()
|
||||
for action in providerActions:
|
||||
actions.append(action)
|
||||
Processing.actions[provider.getName()] = actions
|
||||
|
||||
Processing.actions[provider.getName()] = actions
|
||||
|
||||
@staticmethod
|
||||
def loadContextMenuActions():
|
||||
Processing.contextMenuActions = []
|
||||
for provider in Processing.providers:
|
||||
providerActions = provider.contextMenuActions
|
||||
for action in providerActions:
|
||||
Processing.contextMenuActions.append(action)
|
||||
|
||||
@staticmethod
|
||||
def getAlgorithm(name):
|
||||
|
@ -1,80 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
***************************************************************************
|
||||
AlgorithmClassification.py
|
||||
---------------------
|
||||
Date : November 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. *
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
|
||||
__author__ = 'Victor Olaya'
|
||||
__date__ = 'November 2012'
|
||||
__copyright__ = '(C) 2012, Victor Olaya'
|
||||
|
||||
# This will get replaced with a git SHA1 when you do a git archive
|
||||
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
import os
|
||||
from qgis.PyQt.QtCore import QCoreApplication
|
||||
|
||||
classification = {}
|
||||
|
||||
|
||||
def loadClassification():
|
||||
global classification
|
||||
if not os.path.isfile(classificationFile()):
|
||||
return
|
||||
lines = open(classificationFile())
|
||||
line = lines.readline().strip('\n')
|
||||
while line != '':
|
||||
tokens = line.split(',')
|
||||
subtokens = tokens[1].split('/')
|
||||
try:
|
||||
classification[tokens[0]] = subtokens
|
||||
except:
|
||||
raise Exception(line)
|
||||
line = lines.readline().strip('\n')
|
||||
lines.close()
|
||||
|
||||
|
||||
def classificationFile():
|
||||
return os.path.join(os.path.dirname(__file__), 'algclasssification.txt')
|
||||
|
||||
|
||||
def getClassificationEn(alg):
|
||||
if alg.commandLineName().lower() in classification:
|
||||
group, subgroup = classification[alg.commandLineName()]
|
||||
return group, subgroup
|
||||
else:
|
||||
return None, None
|
||||
|
||||
|
||||
def getClassification(alg):
|
||||
group, subgroup = getClassificationEn(alg)
|
||||
if not group and not subgroup:
|
||||
return None, None
|
||||
return (QCoreApplication.translate('AlgorithmClassification', group),
|
||||
QCoreApplication.translate('AlgorithmClassification', subgroup))
|
||||
|
||||
|
||||
def getDisplayNameEn(alg):
|
||||
return alg.name
|
||||
|
||||
|
||||
def getDisplayName(alg):
|
||||
return alg.i18n_name or alg.name
|
||||
|
||||
|
||||
def getDisplayNames(alg):
|
||||
return alg.name, alg.i18n_name
|
@ -36,7 +36,6 @@ from qgis.utils import iface
|
||||
from qgis.core import QgsNetworkAccessManager
|
||||
|
||||
from processing.core.ProcessingConfig import ProcessingConfig
|
||||
from processing.gui import AlgorithmClassification
|
||||
|
||||
pluginPath = os.path.split(os.path.dirname(__file__))[0]
|
||||
WIDGET, BASE = uic.loadUiType(
|
||||
@ -62,7 +61,7 @@ class AlgorithmDialogBase(BASE, WIDGET):
|
||||
|
||||
self.btnClose = self.buttonBox.button(QDialogButtonBox.Close)
|
||||
|
||||
self.setWindowTitle(AlgorithmClassification.getDisplayName(self.alg))
|
||||
self.setWindowTitle(self.alg.displayName())
|
||||
|
||||
desktop = QDesktopWidget()
|
||||
if desktop.physicalDpiX() > 96:
|
||||
|
@ -38,7 +38,6 @@ from processing.core.Processing import Processing, algListWatcher
|
||||
from processing.core.ProcessingLog import ProcessingLog
|
||||
from processing.core.ProcessingConfig import ProcessingConfig, settingsWatcher
|
||||
from processing.gui.MessageDialog import MessageDialog
|
||||
from processing.gui import AlgorithmClassification
|
||||
from processing.gui.AlgorithmDialog import AlgorithmDialog
|
||||
from processing.gui.BatchAlgorithmDialog import BatchAlgorithmDialog
|
||||
from processing.gui.EditRenderingStylesDialog import EditRenderingStylesDialog
|
||||
@ -344,7 +343,7 @@ class TreeAlgorithmItem(QTreeWidgetItem):
|
||||
QTreeWidgetItem.__init__(self)
|
||||
self.alg = alg
|
||||
icon = alg.getIcon()
|
||||
nameEn, name = AlgorithmClassification.getDisplayNames(alg)
|
||||
nameEn, name = alg.displayNames()
|
||||
name = name if name != '' else nameEn
|
||||
self.setIcon(0, icon)
|
||||
self.setToolTip(0, name)
|
||||
|
@ -17,7 +17,6 @@
|
||||
***************************************************************************
|
||||
"""
|
||||
|
||||
|
||||
__author__ = 'Alexander Bruy'
|
||||
__date__ = 'December 2012'
|
||||
__copyright__ = '(C) 2012, Alexander Bruy'
|
||||
@ -39,7 +38,7 @@ from qgis.PyQt.QtWidgets import QMenu, QAction, QMessageBox, QFileDialog, QAppli
|
||||
from qgis.core import QgsApplication
|
||||
from qgis.utils import iface
|
||||
|
||||
from processing.modeler.ModelerUtils import ModelerUtils
|
||||
from processing.core.Processing import Processing
|
||||
from processing.gui.AlgorithmDialog import AlgorithmDialog
|
||||
from processing.gui.HelpEditionDialog import HelpEditionDialog
|
||||
from processing.algs.r.RAlgorithm import RAlgorithm
|
||||
@ -63,8 +62,8 @@ class ScriptEditorDialog(BASE, WIDGET):
|
||||
super(ScriptEditorDialog, self).__init__(None)
|
||||
self.setupUi(self)
|
||||
|
||||
self.setWindowFlags(Qt.WindowMinimizeButtonHint |
|
||||
Qt.WindowMaximizeButtonHint |
|
||||
self.setWindowFlags(Qt.WindowMinimizeButtonHint |
|
||||
Qt.WindowMaximizeButtonHint |
|
||||
Qt.WindowCloseButtonHint)
|
||||
# Set icons
|
||||
self.btnOpen.setIcon(
|
||||
@ -274,10 +273,10 @@ class ScriptEditorDialog(BASE, WIDGET):
|
||||
def runAlgorithm(self):
|
||||
if self.algType == self.SCRIPT_PYTHON:
|
||||
alg = ScriptAlgorithm(None, unicode(self.editor.text()))
|
||||
alg.provider = ModelerUtils.providers['script']
|
||||
alg.provider = Processing.getProviderFromName('script')
|
||||
if self.algType == self.SCRIPT_R:
|
||||
alg = RAlgorithm(None, unicode(self.editor.text()))
|
||||
alg.provider = ModelerUtils.providers['r']
|
||||
alg.provider = Processing.getProviderFromName('r')
|
||||
|
||||
dlg = alg.getCustomParametersDialog()
|
||||
if not dlg:
|
||||
|
@ -1,396 +0,0 @@
|
||||
gdalogr:overviews,Raster/Creation
|
||||
gdalogr:executesql,Vector/General tools
|
||||
gdalogr:rasterinfo,Raster/General tools
|
||||
gdalogr:merge,Raster/General tools
|
||||
gdalogr:nearblack,Raster/Analysis
|
||||
gdalogr:ogr2ogr,Vector/General tools
|
||||
gdalogr:vectorinfo,Vector/Statistics
|
||||
gdalogr:pcttorgb,Images/Image Manipulation
|
||||
gdalogr:proximity,Raster/Analysis
|
||||
gdalogr:rgbtopct,Images/Image Manipulation
|
||||
gdalogr:sieve,Raster/Edition
|
||||
gdalogr:translate,Raster/General tools
|
||||
gdalogr:warpreproject,Raster/General tools
|
||||
gdalogr:slope,Domain specific/Terrain analysis and geomorphometry
|
||||
gdalogr:aspect,Domain specific/Terrain analysis and geomorphometry
|
||||
gdalogr:hillshade,Domain specific/Viewsheds\Lighting
|
||||
gdalogr:polygonize,Raster - vector/Raster -> Vector
|
||||
gdalogr:gridrasterize,Raster - vector/Vector -> Raster
|
||||
gdalogr:gridnearestneighbor,Raster - vector/Vector -> Raster
|
||||
gdalogr:griddatametrics,Raster - vector/Vector -> Raster
|
||||
gdalogr:gridinvdist,Raster - vector/Vector -> Raster
|
||||
gdalogr:gridaverage,Raster - vector/Vector -> Raster
|
||||
gdalogr:contour,Raster - vector/Raster -> Vector
|
||||
gdalogr:importvectorintopostgisdatabaseavailableconnections,Vector/General tools
|
||||
otb:bandmath,Images/Miscellaneous
|
||||
otb:binarymorphologicaloperation,Images/Image Filtering
|
||||
otb:bundletoperfectsensor,Images/Geometry
|
||||
otb:cartographictogeographiccoordinatesconversion,Images/Geometry
|
||||
otb:classificationregularization,Images/Learning
|
||||
otb:colormapping,Images/Image Manipulation
|
||||
otb:computeconfusionmatrix,Images/Learning
|
||||
otb:computeimagessecondorderstatistics,Images/Learning
|
||||
otb:computepolylinefeaturefromimage,Images/Feature Extraction
|
||||
otb:concatenate,Images/Vector Data Manipulation
|
||||
otb:connectedcomponentsegmentation,Images/Segmentation
|
||||
otb:convertsensorpointtogeographicpoint,Images/Geometry
|
||||
otb:dimensionalityreductionapplication,Images/Image Filtering
|
||||
otb:disparitymaptoelevationmap,Images/Stereo
|
||||
otb:edgeextraction,Images/Feature Extraction
|
||||
otb:edisonmeanshiftsegmentationlabeledrasteroutput,Images/Segmentation
|
||||
otb:edisonmeanshiftsegmentationlargescalevectoroutput,Images/Segmentation
|
||||
otb:extractroi,Images/Image Manipulation
|
||||
otb:fineregistration,Images/Stereo
|
||||
otb:fusionofclassifications,Images/Learning
|
||||
otb:fuzzymodelestimation,Images/Feature Extraction
|
||||
otb:grayscalemorphologicaloperation,Images/Image Filtering
|
||||
otb:gridbasedimageresampling,Images/Geometry
|
||||
otb:haralicktextureextraction,Images/Feature Extraction
|
||||
otb:hoovercomparesegmentation,Images/Segmentation
|
||||
otb:hyperspectraldataunmixing,Images/Miscellaneous
|
||||
otb:imageconversion,Images/Image Manipulation
|
||||
otb:imageenvelope,Images/Geometry
|
||||
otb:imageresamplingwitharigidtransform,Images/Geometry
|
||||
otb:imagescomparison,Images/Miscellaneous
|
||||
otb:imagesconcatenation,Images/Image Manipulation
|
||||
otb:imagesvmclassification,Images/Learning
|
||||
otb:imagetokmzexport,Images/Miscellaneous
|
||||
otb:linesegmentdetection,Images/Feature Extraction
|
||||
otb:localstatisticextraction,Images/Feature Extraction
|
||||
otb:maximumautocorrelationfactordecomposition,Images/Image Filtering
|
||||
otb:meanshiftfiltering,Images/Image Filtering
|
||||
otb:meanshiftsegmentationlabeledrasteroutput,Images/Segmentation
|
||||
otb:meanshiftsegmentationlargescalevectoroutput,Images/Segmentation
|
||||
otb:morphologicalprofilesbasedsegmentationlabeledrasteroutput,Images/Segmentation
|
||||
otb:morphologicalprofilesbasedsegmentationlargescalevectoroutput,Images/Segmentation
|
||||
otb:multiresolutionpyramid,Images/Image Manipulation
|
||||
otb:multivariatealterationdetector,Images/Feature Extraction
|
||||
otb:obtainutmzonefromgeopoint,Images/Miscellaneous
|
||||
otb:openstreetmaplayersimportationsapplications,Images/Miscellaneous
|
||||
otb:opticalcalibration,Images/Calibration
|
||||
otb:orthorectification,Images/Geometry
|
||||
otb:pansharpening,Images/Image Manipulation
|
||||
otb:pixelvalue,Images/Miscellaneous
|
||||
otb:pixelwiseblockmatching,Images/Stereo
|
||||
otb:pixelwiseblockmatching,Images/Stereo
|
||||
otb:quicklook,Images/Image Manipulation
|
||||
otb:radiometricindices,Images/Feature Extraction
|
||||
otb:rasterization,Images/Vector Data Manipulation
|
||||
otb:readimageinformation,Images/Image Manipulation
|
||||
otb:rescaleimage,Images/Image Manipulation
|
||||
otb:sarradiometriccalibration,Images/Calibration
|
||||
otb:sfstextureextraction,Images/Feature Extraction
|
||||
otb:simpleconnectedcomponentssegmentationlabeledrasteroutput,Images/Segmentation
|
||||
otb:simpleconnectedcomponentssegmentationlargescalevectoroutput,Images/Segmentation
|
||||
otb:smoothing,Images/Image Filtering
|
||||
otb:somclassification,Images/Learning
|
||||
otb:splitimage,Images/Image Manipulation
|
||||
otb:stereorectificationdeformationgridgenerator,Images/Geometry
|
||||
otb:stereosensormodeltoelevationmap,Images/Stereo
|
||||
otb:superimposesensor,Images/Geometry
|
||||
otb:trainsvmclassifierfrommultipleimages,Images/Learning
|
||||
otb:unsupervisedkmeansimageclassification,Images/Learning
|
||||
otb:validatesvmimagesclassifier,Images/Learning
|
||||
otb:vectordataextractroi,Images/Vector Data Manipulation
|
||||
otb:vectordatareprojection,Images/Vector Data Manipulation
|
||||
otb:vectordatasetfield,Images/Vector Data Manipulation
|
||||
otb:vectordatatransformation,Images/Vector Data Manipulation
|
||||
otb:vectordatavalidation,Images/Feature Extraction
|
||||
otb:vertexcomponentanalysis,Images/Miscellaneous
|
||||
otb:watershedsegmentationlabeledrasteroutput,Images/Segmentation
|
||||
otb:watershedsegmentationlargescalevectoroutput,Images/Segmentation
|
||||
qgis:addautoincrementalfield,Vector/Table tools
|
||||
qgis:addfieldtoattributestable,Vector/Table tools
|
||||
qgis:advancedpythonfieldcalculator,Vector/Table tools
|
||||
qgis:basicstatisticsfornumericfields,Vector/Statistics
|
||||
qgis:basicstatisticsfortextfields,Vector/Statistics
|
||||
qgis:clip,Vector/Overlay
|
||||
qgis:convertgeometrytype,Vector/General tools
|
||||
qgis:convexhull,Vector/Geometry operations
|
||||
qgis:countpointsinpolygon,Vector/Statistics
|
||||
qgis:countpointsinpolygonweighted,Vector/Statistics
|
||||
qgis:countuniquepointsinpolygon,Vector/Statistics
|
||||
qgis:createequivalentnumericalfield,Vector/Table tools
|
||||
qgis:creategrid,Vector/Creation
|
||||
qgis:delaunaytriangulation,Vector/Geometry operations
|
||||
qgis:deletecolumn,Vector/Table tools
|
||||
qgis:deleteduplicategeometries,Vector/General tools
|
||||
qgis:densifygeometries,Vector/Geometry operations
|
||||
qgis:densifygeometriesgivenaninterval,Vector/Geometry operations
|
||||
qgis:difference,Vector/Overlay
|
||||
qgis:dissolve,Vector/Geometry operations
|
||||
qgis:distancetonearesthub,Vector/Analysis
|
||||
qgis:explodelines,Vector/Lines
|
||||
qgis:exportaddgeometrycolumns,Vector/Table tools
|
||||
qgis:extractnodes,Vector/General tools
|
||||
qgis:fieldcalculator,Vector/Table tools
|
||||
qgis:fixeddistancebuffer,Vector/Geometry operations
|
||||
qgis:hublines,Vector/Analysis
|
||||
qgis:intersection,Vector/Overlay
|
||||
qgis:joinattributestable,Vector/Table tools
|
||||
qgis:lineintersections,Vector/Lines
|
||||
qgis:linestopolygons,Vector/Lines
|
||||
qgis:listuniquevalues,Vector/Table tools
|
||||
qgis:meancoordinates,Vector/Statistics
|
||||
qgis:mergevectorlayers,Vector/General tools
|
||||
qgis:multiparttosingleparts,Vector/General tools
|
||||
qgis:nearestneighbouranalysis,Vector/Points
|
||||
qgis:pointslayerfromtable,Vector/Creation
|
||||
qgis:polygonfromlayerextent,Vector/Creation
|
||||
qgis:polygonstolines,Vector/Polygons
|
||||
qgis:polygoncentroids,Vector/Polygons
|
||||
qgis:randomselection,Vector/Selection
|
||||
qgis:randomselectionwithinsubsets,Vector/Selection
|
||||
qgis:rasterlayerhistogram,Raster/Statistics
|
||||
qgis:rasterlayerstatistics,Raster/Statistics
|
||||
qgis:reprojectlayer,Vector/General tools
|
||||
qgis:saveselectedfeatures,Vector/General tools
|
||||
qgis:selectbyattribute,Vector/Selection
|
||||
qgis:selectbylocation,Vector/Selection
|
||||
qgis:simplifygeometries,Vector/Geometry operations
|
||||
qgis:singlepartstomultipart,Vector/General tools
|
||||
qgis:snappointstogrid,Vector/General tools
|
||||
qgis:statisticsbycategories,Vector/Statistics
|
||||
qgis:sumlinelengths,Vector/Lines
|
||||
qgis:texttofloat,Vector/Table tools
|
||||
qgis:union,Vector/Overlay
|
||||
qgis:variabledistancebuffer,Vector/Geometry operations
|
||||
qgis:vectorlayerhistogram,Vector/Statistics
|
||||
qgis:vectorlayerscatterplot,Vector/Statistics
|
||||
qgis:voronoipolygons,Vector/Geometry operations
|
||||
saga:accumulatedcostanisotropic,Domain specific/Cost analysis
|
||||
saga:accumulatedcostisotropic,Domain specific/Cost analysis
|
||||
saga:addcoordinatestopoints,Vector/Points
|
||||
saga:addgridvaluestopoints,Raster - vector/Raster - vector operations
|
||||
saga:addgridvaluestoshapes,Raster - vector/Raster - vector operations
|
||||
saga:addpolygonattributestopoints,Vector/Points
|
||||
saga:aggregate,Raster/Edition
|
||||
saga:aggregatepointobservations,Vector/Points
|
||||
saga:aggregationindex,Raster/Miscellaneous
|
||||
saga:analyticalhierarchyprocess,Raster/Miscellaneous
|
||||
saga:basicterrainanalysis,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:bsplineapproximation,Raster - vector/Raster -> Vector
|
||||
saga:burnstreamnetworkintodem,Domain specific/Hydrology
|
||||
saga:catchmentarea,Domain specific/Hydrology
|
||||
saga:cellbalance,Domain specific/Hydrology
|
||||
saga:changedateformat,Vector/Table tools
|
||||
saga:changedetection,Raster/Analysis
|
||||
saga:changegridvalues,Raster/Edition
|
||||
saga:changetimeformat,Vector/Table tools
|
||||
saga:changevectoranalysis,Raster/Analysis
|
||||
saga:channelnetwork,Domain specific/Hydrology
|
||||
saga:channelnetworkanddrainagebasins,Domain specific/Hydrology
|
||||
saga:clipgridwithpolygon,Raster - vector/Raster - vector operations
|
||||
saga:clippointswithpolygons,Vector/Overlay
|
||||
saga:closegaps,Raster/General tools
|
||||
saga:closegapswithspline,Raster/General tools
|
||||
saga:closeonecellgaps,Raster/General tools
|
||||
saga:clusteranalysis,Vector/General tools
|
||||
saga:clusteranalysisforgrids,Raster/Analysis
|
||||
saga:combinegrids,Raster/General tools
|
||||
saga:convergenceindex,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:convergenceindexsearchradius,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:convertdatastoragetype,Raster/General tools
|
||||
saga:convertlinestopoints,Vector/Lines
|
||||
saga:convertlinestopolygons,Vector/Lines
|
||||
saga:convertmultipointstopoints,Vector/Points
|
||||
saga:convertpointstolines,Vector/Points
|
||||
saga:convertpolygonlineverticestopoints,Vector/Polygons
|
||||
saga:convertpolygonstolines,Vector/Polygons
|
||||
saga:converttabletopoints,Vector/Table tools
|
||||
saga:coordinatetransformationgrid,Raster/General tools
|
||||
saga:coordinatetransformationgridlist,Raster/General tools
|
||||
saga:coordinatetransformationshapes,Vector/General tools
|
||||
saga:coordinatetransformationshapeslist,Vector/General tools
|
||||
saga:covereddistance,Raster/Analysis
|
||||
saga:creategraticule,Vector/Creation
|
||||
saga:croptodata,Raster/General tools
|
||||
saga:crossclassificationandtabulation,Raster/General tools
|
||||
saga:crossprofiles,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:cubicsplineapproximation,Raster - vector/Vector -> Raster
|
||||
saga:curvatureclassification,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:cutshapeslayer,Vector/Overlay
|
||||
saga:dailytohourlypet,Domain specific/Miscellaneous
|
||||
saga:directionalaverage1,Raster/Filters
|
||||
saga:directionalstatisticsforsinglegrid,Raster/Statistics
|
||||
saga:distancematrix,Vector/Points
|
||||
saga:diurnalanisotropicheating,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:downslopedistancegradient,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:dtmfilterslopebased,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:edgecontamination,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:effectiveairflowheights,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:enumeratetablefield,Vector/Table tools
|
||||
saga:fillgapsinrecords,Vector/Table tools
|
||||
saga:fillsinks,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:filterclumps,Raster/General tools
|
||||
saga:fitnpointstoshape,Vector/Points
|
||||
saga:flatdetection,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:flowpathlength,Domain specific/Hydrology
|
||||
saga:flowwidthandspecificcatchmentarea,Domain specific/Hydrology
|
||||
saga:fractaldimensionofgridsurface,Raster/Statistics
|
||||
saga:function,Raster/Creation
|
||||
saga:fuzzify,Raster/Analysis
|
||||
saga:fuzzyintersectionand,Raster/Analysis
|
||||
saga:fuzzyunionor,Raster/Analysis
|
||||
saga:gaussianfilter,Raster/Filters
|
||||
saga:gaussianlandscapes,Raster/Creation
|
||||
saga:geographicallyweightedmultipleregression,Raster/Statistics
|
||||
saga:geographicallyweightedmultipleregressionpoints,Raster/Statistics
|
||||
saga:geographicallyweightedmultipleregressionpoints/grids,Raster/Statistics
|
||||
saga:geographicallyweightedregression,Raster/Statistics
|
||||
saga:geographicallyweightedregressionpointsgrid,Raster/Statistics
|
||||
saga:geometricfigures,Vector/Miscellaneous
|
||||
saga:getshapesextents,Vector/General tools
|
||||
saga:globalmoransiforgrids,Domain specific/Geostatistics
|
||||
saga:gradientvectorfromcartesiantopolarcoordinates,Domain specific/Cost analysis
|
||||
saga:gradientvectorfrompolartocartesiancoordinates,Domain specific/Cost analysis
|
||||
saga:gradientvectorsfromdirectionalcomponents,Raster - vector/Raster -> Vector
|
||||
saga:gradientvectorsfromdirectionandlength,Raster - vector/Raster -> Vector
|
||||
saga:gradientvectorsfromsurface,Raster - vector/Raster -> Vector
|
||||
saga:gridbuffer,Raster/General tools
|
||||
saga:rastercalculator,Raster/General tools
|
||||
saga:griddifference,Raster/General tools
|
||||
saga:griddivision,Raster/General tools
|
||||
saga:gridmasking,Raster/General tools
|
||||
saga:gridnormalisation,Raster/General tools
|
||||
saga:gridorientation,Raster/General tools
|
||||
saga:gridproximitybuffer,Raster/General tools
|
||||
saga:gridsfromclassifiedgridandtable,Raster/Creation
|
||||
saga:gridshrinkexpand,Raster/General tools
|
||||
saga:gridskeletonization,Raster/General tools
|
||||
saga:gridsproduct,Raster/General tools
|
||||
saga:gridssum,Raster/General tools
|
||||
saga:gridstandardisation,Raster/Edition
|
||||
saga:gridstatisticsforpolygons,Raster - vector/Raster - vector statistics
|
||||
saga:gridvaluestopoints,Raster - vector/Raster -> Vector
|
||||
saga:gridvaluestopointsrandomly,Raster - vector/Raster -> Vector
|
||||
saga:gridvolume,Raster/Miscellaneous
|
||||
saga:hypsometry,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:invertdatanodata,Raster/General tools
|
||||
saga:kerneldensityestimation,Raster/Statistics
|
||||
saga:lakeflood,Raster/Miscellaneous
|
||||
saga:landsurfacetemperature,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:laplacianfilter,Raster/Filters
|
||||
saga:layerofextremevalue,Raster/General tools
|
||||
saga:leastcostpaths,Domain specific/Cost analysis
|
||||
saga:line-polygonintersection,Vector/Geometry operations
|
||||
saga:linedissolve,Vector/Lines
|
||||
saga:lineproperties,Vector/Lines
|
||||
saga:linesimplification,Vector/Lines
|
||||
saga:localminimaandmaxima,Raster - vector/Raster -> Vector
|
||||
saga:lsfactor,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:majorityfilter,Raster/Filters
|
||||
saga:massbalanceindex,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:mergeshapeslayers,Vector/General tools
|
||||
saga:metricconversions,Raster/Edition
|
||||
saga:minimumdistanceanalysis,Vector/Points
|
||||
saga:modifedquadraticshepard,Raster - vector/Vector -> Raster
|
||||
saga:morphologicalfilter,Raster/Filters
|
||||
saga:morphometricprotectionindex,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:multibandvariation,Raster/Analysis
|
||||
saga:multidirectionleefilter,Raster/Filters
|
||||
saga:multilevelbsplineinterpolation,Raster - vector/Vector -> Raster
|
||||
saga:multilevelbsplineinterpolationfromgrid,Raster - vector/Vector -> Raster
|
||||
saga:multipleregressionanalysisgridgrids,Raster/Statistics
|
||||
saga:multipleregressionanalysispointsgrid,Raster - vector/Raster - vector statistics
|
||||
saga:multiresolutionindexofvalleybottomflatnessmrvbf,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:naturalneighbour,Raster - vector/Vector -> Raster
|
||||
saga:orderedweightedaveragingowa,Raster/Analysis
|
||||
saga:ordinarykriging,Raster - vector/Vector -> Raster
|
||||
saga:ordinarykrigingglobal,Raster - vector/Vector -> Raster
|
||||
saga:overlandflowdistancetochannelnetwork,Domain specific/Hydrology
|
||||
saga:overlandflowkinematicwaved8,Domain specific/Hydrology
|
||||
saga:patching,Raster/General tools
|
||||
saga:patternanalysis,Raster/Analysis
|
||||
saga:pointsfilter,Vector/Points
|
||||
saga:pointstatisticsforpolygons,Raster - vector/Raster - vector statistics
|
||||
saga:pointsthinning,Vector/Points
|
||||
saga:polartocartesiancoordinates,Domain specific/Cost analysis
|
||||
saga:polygon-lineintersection,Vector/Geometry operations
|
||||
saga:polygondissolve,Vector/Polygons
|
||||
saga:polygondissolvebyattribute,Vector/Polygons
|
||||
saga:polygondissolveallpolygons,Vector/Polygons
|
||||
saga:intersect,Vector/Polygons
|
||||
saga:difference,Vector/Polygons
|
||||
saga:update,Vector/Polygons
|
||||
saga:identity,Vector/Polygons
|
||||
saga:union,Vector/Polygons
|
||||
saga:symmetricaldifference,Vector/Polygons
|
||||
saga:polygonpartstoseparatepolygons,Vector/Polygons
|
||||
saga:polygonproperties,Vector/Polygons
|
||||
saga:polygonshapeindices,Vector/Polygons
|
||||
saga:polygonstoedgesandnodes,Vector/Polygons
|
||||
saga:polynomialregression,Raster/Statistics
|
||||
saga:polynomialtrendfromgrids,Raster/Statistics
|
||||
saga:principlecomponentsanalysis,Raster/Analysis
|
||||
saga:profilefrompoints,Raster - vector/Raster - vector statistics
|
||||
saga:profilesfromlines,Raster - vector/Raster - vector statistics
|
||||
saga:proximitygrid,Raster/Analysis
|
||||
saga:pythagorastree,Vector/Miscellaneous
|
||||
saga:quadtreestructuretoshapes,Vector/Miscellaneous
|
||||
saga:radiusofvariancegrid,Raster/Statistics
|
||||
saga:randomfield,Raster/Creation
|
||||
saga:randomterraingeneration,Raster/Creation
|
||||
saga:rankfilter,Raster/Filters
|
||||
saga:realareacalculation,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:reclassifygridvalues,Raster/Edition
|
||||
saga:regressionanalysispointsgrid,Raster - vector/Raster - vector statistics
|
||||
saga:relativeheightsandslopepositions,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:removeduplicatepoints,Vector/Points
|
||||
saga:representativenessgrid,Domain specific/Geostatistics
|
||||
saga:resampling,Raster/General tools
|
||||
saga:residualanalysisgrid,Raster/Statistics
|
||||
saga:rgbcomposite,Images/Image tools
|
||||
saga:runningaverage,Vector/Table tools
|
||||
saga:sagawetnessindex,Domain specific/Hydrology
|
||||
saga:separatepointsbydirection,Vector/Points
|
||||
saga:shapesbuffer,Vector/Geometry operations
|
||||
saga:simplefilter,Raster/Filters
|
||||
saga:simulation,Domain specific/Miscellaneous
|
||||
saga:sinkdrainageroutedetection,Domain specific/Hydrology
|
||||
saga:sinkremoval,Domain specific/Hydrology
|
||||
saga:skyviewfactor,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:slopelength,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:sortgrid,Raster/General tools
|
||||
saga:spatialpointpatternanalysis,Vector/Points
|
||||
saga:splitrgbbands,Images/Image tools
|
||||
saga:splitshapesbyattribute,Vector/General tools
|
||||
saga:splitshapeslayer,Vector/General tools
|
||||
saga:splitshapeslayercompletely,Vector/General tools
|
||||
saga:splitshapeslayerrandomly,Vector/General tools
|
||||
saga:statisticsforgrids,Raster/Statistics
|
||||
saga:strahlerorder,Domain specific/Hydrology
|
||||
saga:streampowerindex,Domain specific/Hydrology
|
||||
saga:supervisedclassification,Raster/Analysis
|
||||
saga:surfacespecificpoints,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:terrainruggednessindextri,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:thiessenpolygons,Vector/Geometry operations
|
||||
saga:thinplatesplineglobal,Raster - vector/Vector -> Raster
|
||||
saga:thinplatesplinelocal,Raster - vector/Vector -> Raster
|
||||
saga:thinplatesplinetin,Raster - vector/Vector -> Raster
|
||||
saga:thresholdbuffer,Raster/General tools
|
||||
saga:topmodel,Domain specific/Hydrology
|
||||
saga:topographiccorrection,Domain specific/Viewsheds\Lighting
|
||||
saga:topographicpositionindextpi,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:topographicwetnessindextwi,Domain specific/Hydrology
|
||||
saga:tpibasedlandformclassification,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:transectthroughpolygonshapefile,Vector/Overlay
|
||||
saga:transformshapes,Vector/Geometry operations
|
||||
saga:triangulation,Raster - vector/Vector -> Raster
|
||||
saga:universalkriging,Raster - vector/Vector -> Raster
|
||||
saga:universalkrigingglobal,Raster - vector/Vector -> Raster
|
||||
saga:upslopearea,Domain specific/Hydrology
|
||||
saga:userdefinedfilter,Raster/Filters
|
||||
saga:variogramcloud,Domain specific/Geostatistics
|
||||
saga:variogramsurface,Domain specific/Geostatistics
|
||||
saga:vectorruggednessmeasurevrm,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:vegetationindexdistancebased,Images/Image analysis
|
||||
saga:vegetationindexslopebased,Images/Image analysis
|
||||
saga:verticaldistancetochannelnetwork,Domain specific/Hydrology
|
||||
saga:waterretentioncapacity,Domain specific/Hydrology
|
||||
saga:watershedbasins,Domain specific/Hydrology
|
||||
saga:windeffectwindwardleewardindex,Domain specific/Terrain analysis and geomorphometry
|
||||
saga:zonalgridstatistics,Raster/Statistics
|
||||
modelertools:calculator,Modeler/Modeler tools
|
||||
modelertools:rasterlayerbounds,Modeler/Modeler tools
|
||||
modelertools:vectorlayerbounds,Modeler/Modeler tools
|
@ -16,7 +16,6 @@
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
from operator import attrgetter
|
||||
|
||||
__author__ = 'Victor Olaya'
|
||||
__date__ = 'August 2012'
|
||||
@ -35,6 +34,8 @@ import codecs
|
||||
import traceback
|
||||
from qgis.PyQt.QtCore import QCoreApplication, QPointF
|
||||
from qgis.PyQt.QtGui import QIcon
|
||||
from operator import attrgetter
|
||||
|
||||
from qgis.core import QgsRasterLayer, QgsVectorLayer
|
||||
from qgis.gui import QgsMessageBar
|
||||
from qgis.utils import iface
|
||||
@ -55,6 +56,7 @@ from processing.core.parameters import (getParameterFromString,
|
||||
ParameterMultipleInput)
|
||||
from processing.tools import dataobjects
|
||||
from processing.gui.Help2Html import getHtmlFromDescriptionsDict
|
||||
from processing.core.Processing import Processing
|
||||
|
||||
pluginPath = os.path.split(os.path.dirname(__file__))[0]
|
||||
|
||||
@ -90,17 +92,17 @@ class Algorithm():
|
||||
self.name = None
|
||||
self.description = ""
|
||||
|
||||
#The type of the algorithm, indicated as a string, which corresponds
|
||||
#to the string used to refer to it in the python console
|
||||
# The type of the algorithm, indicated as a string, which corresponds
|
||||
# to the string used to refer to it in the python console
|
||||
self.consoleName = consoleName
|
||||
|
||||
self._algInstance = None
|
||||
|
||||
#A dict of Input object. keys are param names
|
||||
# A dict of Input object. keys are param names
|
||||
self.params = {}
|
||||
|
||||
#A dict of ModelerOutput with final output descriptions. Keys are output names.
|
||||
#Outputs not final are not stored in this dict
|
||||
# A dict of ModelerOutput with final output descriptions. Keys are output names.
|
||||
# Outputs not final are not stored in this dict
|
||||
self.outputs = {}
|
||||
|
||||
self.pos = None
|
||||
@ -117,7 +119,7 @@ class Algorithm():
|
||||
@property
|
||||
def algorithm(self):
|
||||
if self._algInstance is None:
|
||||
self._algInstance = ModelerUtils.getAlgorithm(self.consoleName).getCopy()
|
||||
self._algInstance = Processing.getAlgorithm(self.consoleName).getCopy()
|
||||
return self._algInstance
|
||||
|
||||
def setName(self, model):
|
||||
@ -227,7 +229,7 @@ class ModelerAlgorithm(GeoAlgorithm):
|
||||
# Geoalgorithms in this model. A dict of Algorithm objects, with names as keys
|
||||
self.algs = {}
|
||||
|
||||
#Input parameters. A dict of Input objects, with names as keys
|
||||
# Input parameters. A dict of Input objects, with names as keys
|
||||
self.inputs = {}
|
||||
GeoAlgorithm.__init__(self)
|
||||
|
||||
@ -526,7 +528,7 @@ class ModelerAlgorithm(GeoAlgorithm):
|
||||
|
||||
def checkBeforeOpeningParametersDialog(self):
|
||||
for alg in self.algs.values():
|
||||
algInstance = ModelerUtils.getAlgorithm(alg.consoleName)
|
||||
algInstance = Processing.getAlgorithm(alg.consoleName)
|
||||
if algInstance is None:
|
||||
return "The model you are trying to run contains an algorithm that is not available: <i>%s</i>" % alg.consoleName
|
||||
|
||||
@ -651,7 +653,7 @@ class ModelerAlgorithm(GeoAlgorithm):
|
||||
model.group = line[len('GROUP:'):]
|
||||
elif line.startswith('ALGORITHM:'):
|
||||
algLine = line[len('ALGORITHM:'):]
|
||||
alg = ModelerUtils.getAlgorithm(algLine)
|
||||
alg = Processing.getAlgorithm(algLine)
|
||||
if alg is not None:
|
||||
modelAlg = Algorithm(alg.commandLineName())
|
||||
modelAlg.description = alg.name
|
||||
@ -702,7 +704,7 @@ class ModelerAlgorithm(GeoAlgorithm):
|
||||
modelAlgs.append(modelAlg.name)
|
||||
else:
|
||||
raise WrongModelException(
|
||||
_tr('Error in algorithm name: %s', ) % algLine)
|
||||
_tr('Error in algorithm name: %s',) % algLine)
|
||||
line = lines.readline().strip('\n').strip('\r')
|
||||
for modelAlg in model.algs.values():
|
||||
for name, value in modelAlg.params.iteritems():
|
||||
|
@ -57,9 +57,6 @@ class ModelerAlgorithmProvider(AlgorithmProvider):
|
||||
ModelerUtils.MODELS_FOLDER, self.tr('Models folder', 'ModelerAlgorithmProvider'),
|
||||
ModelerUtils.modelsFolder(), valuetype=Setting.FOLDER))
|
||||
|
||||
def setAlgsList(self, algs):
|
||||
ModelerUtils.allAlgs = algs
|
||||
|
||||
def modelsFolder(self):
|
||||
return ModelerUtils.modelsFolder()
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
* *
|
||||
***************************************************************************
|
||||
"""
|
||||
from processing.gui import AlgorithmClassification
|
||||
|
||||
__author__ = 'Victor Olaya'
|
||||
__date__ = 'August 2012'
|
||||
@ -35,6 +34,7 @@ from qgis.PyQt.QtCore import Qt, QRectF, QMimeData, QPoint, QPointF, QSettings,
|
||||
from qgis.PyQt.QtWidgets import QGraphicsView, QTreeWidget, QMessageBox, QFileDialog, QTreeWidgetItem
|
||||
from qgis.PyQt.QtGui import QIcon, QImage, QPainter
|
||||
from qgis.core import QgsApplication
|
||||
from processing.core.Processing import Processing
|
||||
from processing.core.ProcessingConfig import ProcessingConfig
|
||||
from processing.core.ProcessingLog import ProcessingLog
|
||||
from processing.gui.HelpEditionDialog import HelpEditionDialog
|
||||
@ -61,8 +61,8 @@ class ModelerDialog(BASE, WIDGET):
|
||||
|
||||
self.zoom = 1
|
||||
|
||||
self.setWindowFlags(Qt.WindowMinimizeButtonHint |
|
||||
Qt.WindowMaximizeButtonHint |
|
||||
self.setWindowFlags(Qt.WindowMinimizeButtonHint |
|
||||
Qt.WindowMaximizeButtonHint |
|
||||
Qt.WindowCloseButtonHint)
|
||||
|
||||
settings = QSettings()
|
||||
@ -89,7 +89,7 @@ class ModelerDialog(BASE, WIDGET):
|
||||
if text in ModelerParameterDefinitionDialog.paramTypes:
|
||||
self.addInputOfType(text, event.pos())
|
||||
else:
|
||||
alg = ModelerUtils.getAlgorithm(text)
|
||||
alg = Processing.getAlgorithm(text)
|
||||
if alg is not None:
|
||||
self._addAlgorithm(alg.getCopy(), event.pos())
|
||||
event.accept()
|
||||
@ -226,7 +226,7 @@ class ModelerDialog(BASE, WIDGET):
|
||||
def editHelp(self):
|
||||
if self.alg.provider is None:
|
||||
# Might happen if model is opened from modeler dialog
|
||||
self.alg.provider = ModelerUtils.providers['model']
|
||||
self.alg.provider = Processing.getProviderFromName('model')
|
||||
alg = self.alg.getCopy()
|
||||
dlg = HelpEditionDialog(alg)
|
||||
dlg.exec_()
|
||||
@ -243,7 +243,7 @@ class ModelerDialog(BASE, WIDGET):
|
||||
|
||||
if self.alg.provider is None:
|
||||
# Might happen if model is opened from modeler dialog
|
||||
self.alg.provider = ModelerUtils.providers['model']
|
||||
self.alg.provider = Processing.getProviderFromName('model')
|
||||
alg = self.alg.getCopy()
|
||||
dlg = AlgorithmDialog(alg)
|
||||
dlg.exec_()
|
||||
@ -390,7 +390,7 @@ class ModelerDialog(BASE, WIDGET):
|
||||
pos = QPointF(pos)
|
||||
self.alg.addParameter(ModelerParameter(dlg.param, pos))
|
||||
self.repaintModel()
|
||||
#self.view.ensureVisible(self.scene.getLastParameterItem())
|
||||
# self.view.ensureVisible(self.scene.getLastParameterItem())
|
||||
self.hasChanged = True
|
||||
|
||||
def getPositionForParameterItem(self):
|
||||
@ -469,14 +469,13 @@ class ModelerDialog(BASE, WIDGET):
|
||||
def fillAlgorithmTreeUsingProviders(self):
|
||||
self.algorithmTree.clear()
|
||||
text = unicode(self.searchBox.text())
|
||||
allAlgs = ModelerUtils.allAlgs
|
||||
allAlgs = Processing.algs
|
||||
for providerName in allAlgs.keys():
|
||||
name = 'ACTIVATE_' + providerName.upper().replace(' ', '_')
|
||||
if not ProcessingConfig.getSetting(name):
|
||||
continue
|
||||
groups = {}
|
||||
provider = allAlgs[providerName]
|
||||
algs = provider.values()
|
||||
algs = allAlgs[providerName].values()
|
||||
|
||||
# Add algorithms
|
||||
for alg in algs:
|
||||
@ -498,12 +497,10 @@ class ModelerDialog(BASE, WIDGET):
|
||||
|
||||
if len(groups) > 0:
|
||||
providerItem = QTreeWidgetItem()
|
||||
providerItem.setText(0,
|
||||
ModelerUtils.providers[providerName].getDescription())
|
||||
providerItem.setToolTip(0,
|
||||
ModelerUtils.providers[providerName].getDescription())
|
||||
providerItem.setIcon(0,
|
||||
ModelerUtils.providers[providerName].getIcon())
|
||||
provider = Processing.getProviderFromName(providerName)
|
||||
providerItem.setText(0, provider.getDescription())
|
||||
providerItem.setToolTip(0, provider.getDescription())
|
||||
providerItem.setIcon(0, provider.getIcon())
|
||||
for groupItem in groups.values():
|
||||
providerItem.addChild(groupItem)
|
||||
self.algorithmTree.addTopLevelItem(providerItem)
|
||||
@ -521,7 +518,7 @@ class TreeAlgorithmItem(QTreeWidgetItem):
|
||||
QTreeWidgetItem.__init__(self)
|
||||
self.alg = alg
|
||||
icon = alg.getIcon()
|
||||
name = AlgorithmClassification.getDisplayName(alg)
|
||||
name = alg.displayName()
|
||||
self.setIcon(0, icon)
|
||||
self.setToolTip(0, name)
|
||||
self.setText(0, name)
|
||||
|
@ -32,9 +32,6 @@ from processing.core.ProcessingConfig import ProcessingConfig
|
||||
|
||||
class ModelerUtils:
|
||||
|
||||
allAlgs = {}
|
||||
providers = {}
|
||||
|
||||
MODELS_FOLDER = 'MODELS_FOLDER'
|
||||
ACTIVATE_MODELS = 'ACTIVATE_MODELS'
|
||||
|
||||
@ -47,9 +44,3 @@ class ModelerUtils:
|
||||
|
||||
return os.path.abspath(folder)
|
||||
|
||||
@staticmethod
|
||||
def getAlgorithm(name):
|
||||
for provider in ModelerUtils.allAlgs.values():
|
||||
if name in provider:
|
||||
return provider[name]
|
||||
return None
|
||||
|
@ -27,8 +27,8 @@ __revision__ = '$Format:%H$'
|
||||
|
||||
|
||||
import os
|
||||
from processing.modeler.ModelerUtils import ModelerUtils
|
||||
from processing.core.GeoAlgorithm import GeoAlgorithm
|
||||
from processing.core.Processing import Processing
|
||||
import json
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ class PreconfiguredAlgorithm(GeoAlgorithm):
|
||||
self.showInModeler = False
|
||||
|
||||
def execute(self, progress):
|
||||
self.alg = ModelerUtils.getAlgorithm(self.description["algname"]).getCopy()
|
||||
self.alg = Processing.getAlgorithm(self.description["algname"]).getCopy()
|
||||
for name, value in self.description["parameters"].iteritems():
|
||||
self.alg.setParameterValue(name, value)
|
||||
for name, value in self.description["outputs"].iteritems():
|
||||
|
@ -26,7 +26,7 @@ __revision__ = '$Format:%H$'
|
||||
import os
|
||||
from processing.core.Processing import Processing
|
||||
from processing.gui.AlgorithmClassification import (
|
||||
loadClassification, getClassificationEn, getDisplayNameEn)
|
||||
loadClassification, getClassificationEn)
|
||||
|
||||
|
||||
def updateTranslations():
|
||||
@ -61,7 +61,7 @@ def translationShadow():
|
||||
"""{}"""
|
||||
'''.format(provider.__class__.__name__))
|
||||
for alg in provider.algs:
|
||||
display_name = getDisplayNameEn(alg)
|
||||
display_name = alg.name
|
||||
f.write(" QCoreApplication.translate(\"{}\", \"{}\")\n"
|
||||
.format(alg.__class__.__name__,
|
||||
display_name.replace('"', '\\"')))
|
||||
|
Loading…
x
Reference in New Issue
Block a user