Skip to content
Permalink
Browse files
Simple c++ base class for processing algorithms
  • Loading branch information
nyalldawson committed Apr 3, 2017
1 parent e462bfb commit 52cc002990a62216415933215ad86c26254299f9
@@ -273,6 +273,7 @@
%Include layertree/qgslayertreeregistrybridge.sip
%Include layertree/qgslayertreeutils.sip

%Include processing/qgsprocessingalgorithm.sip
%Include processing/qgsprocessingfeedback.sip
%Include processing/qgsprocessingprovider.sip
%Include processing/qgsprocessingregistry.sip
@@ -0,0 +1,13 @@
class QgsProcessingAlgorithm
{
%TypeHeaderCode
#include <qgsprocessingalgorithm.h>
%End

public:

QgsProcessingAlgorithm();
virtual ~QgsProcessingAlgorithm();

};

@@ -34,7 +34,8 @@

from qgis.core import (QgsApplication,
QgsProcessingFeedback,
QgsSettings)
QgsSettings,
QgsProcessingAlgorithm)

from builtins import str
from builtins import object
@@ -49,9 +50,10 @@
from processing.algs.help import shortHelp


class GeoAlgorithm(object):
class GeoAlgorithm(QgsProcessingAlgorithm):

def __init__(self):
super().__init__()
self._icon = QgsApplication.getThemeIcon("/processingAlgorithm.svg")
# Parameters needed by the algorithm
self.parameters = list()
@@ -84,6 +84,7 @@ SET(QGIS_CORE_SRCS
annotations/qgssvgannotation.cpp
annotations/qgstextannotation.cpp

processing/qgsprocessingalgorithm.cpp
processing/qgsprocessingprovider.cpp
processing/qgsprocessingregistry.cpp

@@ -835,6 +836,7 @@ SET(QGIS_CORE_HDRS
composer/qgssingleboxscalebarstyle.h
composer/qgsticksscalebarstyle.h

processing/qgsprocessingalgorithm.h
processing/qgsprocessingprovider.h

raster/qgsbilinearrasterresampler.h
@@ -0,0 +1,18 @@
/***************************************************************************
qgsprocessingalgorithm.cpp
--------------------------
begin : December 2016
copyright : (C) 2016 by Nyall Dawson
email : nyall dot dawson 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. *
* *
***************************************************************************/

#include "qgsprocessingalgorithm.h"
@@ -0,0 +1,47 @@
/***************************************************************************
qgsprocessingalgorithm.h
------------------------
begin : December 2016
copyright : (C) 2016 by Nyall Dawson
email : nyall dot dawson 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. *
* *
***************************************************************************/

#ifndef QGSPROCESSINGALGORITHM_H
#define QGSPROCESSINGALGORITHM_H

#include "qgis_core.h"
#include <QString>
#include <QVariant>
#include <QIcon>

/**
* \class QgsProcessingAlgorithm
* \ingroup core
* Abstract base class for processing algorithms.
* \note added in QGIS 3.0
*/
class CORE_EXPORT QgsProcessingAlgorithm
{
public:

/**
* Constructor for QgsProcessingAlgorithm.
*/
QgsProcessingAlgorithm() = default;

virtual ~QgsProcessingAlgorithm() = default;

};

#endif // QGSPROCESSINGALGORITHM_H


0 comments on commit 52cc002

Please sign in to comment.