Skip to content
Permalink
Browse files
Create a context object for processing algorithm execution
  • Loading branch information
nyalldawson committed Apr 26, 2017
1 parent fea6bff commit 241d283bb8bb174d635410d522ee3f2c3ad2c63c
Showing with 146 additions and 0 deletions.
  1. +1 −0 python/core/core.sip
  2. +68 −0 python/core/processing/qgsprocessingcontext.sip
  3. +1 −0 src/core/CMakeLists.txt
  4. +76 −0 src/core/processing/qgsprocessingcontext.h
@@ -276,6 +276,7 @@
%Include layertree/qgslayertreeutils.sip

%Include processing/qgsprocessingalgorithm.sip
%Include processing/qgsprocessingcontext.sip
%Include processing/qgsprocessingfeedback.sip
%Include processing/qgsprocessingprovider.sip
%Include processing/qgsprocessingregistry.sip
@@ -0,0 +1,68 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/processing/qgsprocessingcontext.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/






class QgsProcessingContext
{
%Docstring
Contains information about the context in which a processing algorithm is executed.

Contextual information includes settings such as the associated project, and
expression context.
.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsprocessingcontext.h"
%End
public:

QgsProcessingContext();

QgsProject *project() const;
%Docstring
Returns the project in which the algorithm is being executed.
\see setProject()
:rtype: QgsProject
%End

void setProject( QgsProject *project );
%Docstring
Sets the ``project`` in which the algorithm will be executed.
\see project()
%End

QgsExpressionContext expressionContext() const;
%Docstring
Returns the expression context.
:rtype: QgsExpressionContext
%End

void setExpressionContext( const QgsExpressionContext &context );
%Docstring
Sets the expression ``context``.
%End

};





/************************************************************************
* This file has been generated automatically from *
* *
* src/core/processing/qgsprocessingcontext.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

@@ -852,6 +852,7 @@ SET(QGIS_CORE_HDRS
composer/qgspaperitem.h

processing/qgsprocessingalgorithm.h
processing/qgsprocessingcontext.h
processing/qgsprocessingutils.h

raster/qgsbilinearrasterresampler.h
@@ -0,0 +1,76 @@
/***************************************************************************
qgsprocessingcontext.h
----------------------
begin : April 2017
copyright : (C) 2017 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 QGSPROCESSINGCONTEXT_H
#define QGSPROCESSINGCONTEXT_H

#include "qgis_core.h"
#include "qgis.h"
#include "qgsproject.h"
#include "qgsexpressioncontext.h"

/**
* \class QgsProcessingContext
* \ingroup core
* Contains information about the context in which a processing algorithm is executed.
*
* Contextual information includes settings such as the associated project, and
* expression context.
* \since QGIS 3.0
*/

class CORE_EXPORT QgsProcessingContext
{
public:

QgsProcessingContext() = default;

/**
* Returns the project in which the algorithm is being executed.
* \see setProject()
*/
QgsProject *project() const { return mProject; }

/**
* Sets the \a project in which the algorithm will be executed.
* \see project()
*/
void setProject( QgsProject *project ) { mProject = project; }

/**
* Returns the expression context.
*/
QgsExpressionContext expressionContext() const { return mExpressionContext; }

/**
* Sets the expression \a context.
*/
void setExpressionContext( const QgsExpressionContext &context ) { mExpressionContext = context; }

private:

QPointer< QgsProject > mProject;

QgsExpressionContext mExpressionContext;

};

#endif // QGSPROCESSINGPARAMETERS_H




0 comments on commit 241d283

Please sign in to comment.