separate otb provider into a plugin

This commit is contained in:
Alexander Bruy 2021-06-03 13:44:39 +03:00
parent 50fad18493
commit cfc093d0e9
13 changed files with 92 additions and 11 deletions

View File

@ -55,6 +55,7 @@ endif()
add_subdirectory(processing)
add_subdirectory(sagaprovider)
add_subdirectory(grassprovider)
add_subdirectory(otbprovider)
add_subdirectory(MetaSearch)
PY_COMPILE(staged-plugins "${PYTHON_OUTPUT_DIRECTORY}/plugins")

View File

@ -0,0 +1,4 @@
file(GLOB PY_FILES *.py)
file(GLOB OTHER_FILES metadata.txt)
PLUGIN_INSTALL(otbprovider . ${PY_FILES} ${OTHER_FILES})

View File

@ -51,8 +51,8 @@ from qgis.core import (Qgis,
QgsProviderRegistry)
from processing.core.parameters import getParameterFromString
from processing.algs.otb.OtbChoiceWidget import OtbParameterChoice
from processing.algs.otb.OtbUtils import OtbUtils
from .OtbChoiceWidget import OtbParameterChoice
from .OtbUtils import OtbUtils
class OtbAlgorithm(QgsProcessingAlgorithm):

View File

@ -35,8 +35,8 @@ from qgis.core import (Qgis,
from qgis import utils
from processing.core.ProcessingConfig import ProcessingConfig, Setting
from processing.algs.otb.OtbUtils import OtbUtils
from processing.algs.otb.OtbAlgorithm import OtbAlgorithm
from .OtbUtils import OtbUtils
from .OtbAlgorithm import OtbAlgorithm
class OtbAlgorithmProvider(QgsProcessingProvider):

View File

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
OtbProviderPlugin.py
---------------------
Date : June 2021
Copyright : (C) 2021 by Alexander Bruy
Email : alexander dot bruy 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__ = 'Alexander Bruy'
__date__ = 'June 2021'
__copyright__ = '(C) 2021, Alexander Bruy'
from qgis.core import QgsApplication
from otbprovider.OtbAlgorithmProvider import OtbAlgorithmProvider
class OtbProviderPlugin:
def __init__(self):
self.provider = OtbAlgorithmProvider()
def initGui(self):
QgsApplication.processingRegistry().addProvider(self.provider)
def unload(self):
QgsApplication.processingRegistry().removeProvider(self.provider)

View File

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
__init__.py
---------------------
Date : June 2021
Copyright : (C) 2021 by Alexander Bruy
Email : alexander dot bruy 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__ = 'Alexander Bruy'
__date__ = 'June 2021'
__copyright__ = '(C) 2021, Alexander Bruy'
def classFactory(iface):
from otbprovider.OtbProviderPlugin import OtbProviderPlugin
return OtbProviderPlugin()

View File

@ -0,0 +1,17 @@
[general]
name=OrfeoToolbox provider
description=OrfeoToolbox Processing provider
about=OrfeoToolbox Processing provider
category=Analysis
version=2.12.99
qgisMinimumVersion=3.0
author=Victor Olaya
icon=:/images/themes/default/providerOtb.svg
homepage=https://qgis.org
tracker=https://github.com/qgis/QGIS/issues
repository=https://github.com/qgis/QGIS
hasProcessingProvider=yes

View File

@ -2,7 +2,6 @@ file(GLOB PY_FILES *.py)
add_subdirectory(help)
add_subdirectory(gdal)
add_subdirectory(otb)
add_subdirectory(qgis)
PLUGIN_INSTALL(processing algs ${PY_FILES})

View File

@ -1,2 +0,0 @@
file(GLOB PY_FILES *.py)
PLUGIN_INSTALL(processing algs/otb ${PY_FILES})

View File

@ -59,9 +59,6 @@ with QgsRuntimeProfiler.profile('Import QGIS Provider'):
with QgsRuntimeProfiler.profile('Import GDAL Provider'):
from processing.algs.gdal.GdalAlgorithmProvider import GdalAlgorithmProvider # NOQA
with QgsRuntimeProfiler.profile('Import OTB Provider'):
from processing.algs.otb.OtbAlgorithmProvider import OtbAlgorithmProvider # NOQA
with QgsRuntimeProfiler.profile('Import Script Provider'):
from processing.script.ScriptAlgorithmProvider import ScriptAlgorithmProvider # NOQA
@ -112,7 +109,6 @@ class Processing(object):
for c in [
QgisAlgorithmProvider,
GdalAlgorithmProvider,
OtbAlgorithmProvider,
ScriptAlgorithmProvider,
ModelerAlgorithmProvider,
ProjectProvider