Skip to content

Commit

Permalink
separate otb provider into a plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Jun 21, 2021
1 parent 50fad18 commit cfc093d
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 11 deletions.
1 change: 1 addition & 0 deletions python/plugins/CMakeLists.txt
Expand Up @@ -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")
4 changes: 4 additions & 0 deletions python/plugins/otbprovider/CMakeLists.txt
@@ -0,0 +1,4 @@
file(GLOB PY_FILES *.py)
file(GLOB OTHER_FILES metadata.txt)

PLUGIN_INSTALL(otbprovider . ${PY_FILES} ${OTHER_FILES})
Expand Up @@ -51,8 +51,8 @@
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):
Expand Down
Expand Up @@ -35,8 +35,8 @@
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):
Expand Down
39 changes: 39 additions & 0 deletions python/plugins/otbprovider/OtbProviderPlugin.py
@@ -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)
File renamed without changes.
27 changes: 27 additions & 0 deletions python/plugins/otbprovider/__init__.py
@@ -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()
17 changes: 17 additions & 0 deletions python/plugins/otbprovider/metadata.txt
@@ -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
1 change: 0 additions & 1 deletion python/plugins/processing/algs/CMakeLists.txt
Expand Up @@ -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})
2 changes: 0 additions & 2 deletions python/plugins/processing/algs/otb/CMakeLists.txt

This file was deleted.

Empty file.
4 changes: 0 additions & 4 deletions python/plugins/processing/core/Processing.py
Expand Up @@ -59,9 +59,6 @@
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

Expand Down Expand Up @@ -112,7 +109,6 @@ def initialize():
for c in [
QgisAlgorithmProvider,
GdalAlgorithmProvider,
OtbAlgorithmProvider,
ScriptAlgorithmProvider,
ModelerAlgorithmProvider,
ProjectProvider
Expand Down

0 comments on commit cfc093d

Please sign in to comment.