216 Commits

Author SHA1 Message Date
Nyall Dawson
f82b41e001 Move an enum to new QgsProcessing class 2017-07-08 20:49:17 +10:00
Nyall Dawson
febf0a0e6e Rename method to more generic name - it's usable by vector layer outputs too 2017-07-08 20:49:17 +10:00
Nyall Dawson
d443bb3cbe Expose compatible vector layer parameter evaluation to QgsProcessingAlgorithm 2017-07-08 20:49:17 +10:00
Nyall Dawson
9e184feaed Add method to evaluate parameters to compatible vector layers
of a specified type
2017-07-08 20:49:17 +10:00
Nyall Dawson
ac51ae106c Add unit tests 2017-07-07 11:36:41 +10:00
Nyall Dawson
3ea70696f0 Add descriptions for model algorithm variables 2017-07-07 11:35:31 +10:00
Nyall Dawson
534844f999 Add function to return variables available for child algorithms during
model execution

And use this function to determine in advance dependencies between
child algorithm parameters with expression based values and
which other child algorithms they depend upon.
2017-07-07 11:35:31 +10:00
Nyall Dawson
82ef7d2a89 Create specific expression context scope for child algorithms
Contains variables for model parameters, algorithm results for
other child algorithms which are not dependent on the
algorithm.

Allows removal of final pieces of ModelerAlgorithm code
2017-07-07 11:35:31 +10:00
Nyall Dawson
d8086e549d Use c++ method for available sources 2017-07-07 11:35:31 +10:00
Nyall Dawson
17199c8ffd Reimplement getAvailableValuesOfType in QgsProcessingModelAlgorithm 2017-07-07 11:35:31 +10:00
Nyall Dawson
3243a1a34c Allow model child parameters to take values from an expression
The expression is evaluated just before the child algorithm is
executed, so can utilise results already calculated by other
children in the model through the use of expression context
functions
2017-07-07 11:34:17 +10:00
Nyall Dawson
2c91df4c12 Expand on docs 2017-07-07 10:14:51 +10:00
Nyall Dawson
70cc19687d Add a method to take result layers (and ownership) from processing context 2017-07-07 09:28:20 +10:00
Nyall Dawson
3cbcd75d2f Add equality operator for QgsProcessingFeatureSourceDefinition 2017-07-07 09:28:19 +10:00
Nyall Dawson
8a84e134cc Algorithms don't have to be split to prepare/process/postProcess
Since it's safe to evaluate parameters in background threads
now, it's usually going to be ok to evaluate everything in
the processAlgorithm step.

This keeps the algorithm code as simple as possible, and will
make porting faster.

Note that the prepare/postProcess virtual methods still exist
and can be used when an algorithm MUST do setup/cleanup work
in the main thread.
2017-07-07 09:28:19 +10:00
Nyall Dawson
e1184cd69a Make QgsProcessingAlgRunnerTask work correctly
It now safely can execute algorithms in background threads
without issues
2017-07-07 09:28:19 +10:00
Nyall Dawson
e5b156b86a Make processing algorithms safe to run in threads 2017-07-07 09:28:19 +10:00
Nyall Dawson
5350483c90 Add method to take results from another processing context and
add to the current context

With appropriate note and tests to ensure that both the current
context and that which the results being taken from share the
same thread affinity
2017-07-07 09:28:19 +10:00
Nyall Dawson
d20c68d3f1 Add method to copy thread safe settings between processing contexts 2017-07-07 09:28:19 +10:00
Nyall Dawson
6c6f646291 Add methods to retrieve current thread affinity and push contexts
to another thread

With suitable assert in place to ensure that pushes are only
made when current thread == existing thread affinity
2017-07-07 09:27:35 +10:00
Nyall Dawson
e0c7daa2d8 Rename QgsProcessingAlgorithm::clone to ::create
Since it better describes what the function does. It returns a new
pristine copy of the algorithm, not a clone of its current state
2017-07-07 09:27:35 +10:00
Nyall Dawson
c2621b1275 Split algorithm execution into separate prepare/process/postProcess steps
The prepare and postProcess steps are designed to be run in main
thread only, while the process step can safely be run in a background
thread.
2017-07-07 09:26:17 +10:00
Nyall Dawson
0c6b19cd85 Improvements to QgsProcessingAlgRunnerTask
- take a clone of algs before running them. This avoids issues
if the algorithm is removed or edited while a background task
is running

- accept an optional existing feedback object
2017-07-07 09:26:17 +10:00
Nyall Dawson
9156933c9e Add a pure virtual clone method for algorithms
This is required for safely executing the algorithm in a background
thread.
2017-07-07 09:26:17 +10:00
Nyall Dawson
bdaba00a01 Fix incorrect layer names used when loading result layers from models 2017-07-03 17:08:52 +10:00
Nyall Dawson
921939e4ec Add method to determine whether dependencies exist between model parameters 2017-07-03 10:50:35 +10:00
Nyall Dawson
6483984d0b Add method to retrieve dependent parameters for a parameter 2017-07-03 10:45:15 +10:00
Nyall Dawson
77588b9b61 Convert model child algorithm parameter sources to a list
So that multiple input type parameters are correctly handled,
allowing models with child algorithms like merge to correctly
use any combination of static layers/model inputs/child outputs
as their input parameter
2017-06-30 12:50:38 +10:00
Nyall Dawson
dbf21d1969 Reorder arguments in parameterAsSink to avoid requiring wkb type and crs 2017-06-27 08:33:13 +10:00
Nyall Dawson
60f80f9355 Mark QgsProcessingModelAlgorithm as non-stable API
We want to be able to extend this in future without any
stable API contract.
2017-06-27 08:33:13 +10:00
Nyall Dawson
0a32add69e Port exporting model as python code to c++ 2017-06-27 08:33:13 +10:00
Nyall Dawson
d16f117b6c Port conversion to/from script code to c++ 2017-06-27 08:33:13 +10:00
Nyall Dawson
178a415c9f Port parameter conversion to script code to c++ 2017-06-27 08:33:13 +10:00
Nyall Dawson
3fb1b4809d Export QgsProcessingFeatureSource to Python 2017-06-26 12:44:26 +10:00
Nyall Dawson
5e7fbf44be Make QgsAlgorithm::setProvider() public
Turns out there's valid use cases for calling this from outside
code.
2017-06-24 13:33:44 +10:00
Nyall Dawson
d667bf595f Move iterator exception handling to c++ 2017-06-24 08:15:06 +10:00
Nyall Dawson
a8b364e2e2 Port another member to c++ 2017-06-24 07:36:46 +10:00
Nyall Dawson
10aeba2e72 Move more modelling code to c++ 2017-06-24 07:36:13 +10:00
Nyall Dawson
e7f13f5bd8 Port model help code to c++ 2017-06-24 07:36:07 +10:00
Nyall Dawson
24eb6fd780 Fix loss of output names in graphical modeler 2017-06-23 13:32:31 +10:00
Nyall Dawson
57f2c623ce Move invalid geometry callback from Python to c++ 2017-06-23 12:08:54 +10:00
Nyall Dawson
93b7c2809e Report success or failure after running algs
And auto catch python exceptions and report failure of model
2017-06-23 12:08:54 +10:00
Nyall Dawson
a4f23fd1a4 Throw QgsProcessingException when a python exception occurs while running an alg 2017-06-23 12:08:54 +10:00
Nyall Dawson
76a9844949 Add folder output type 2017-06-22 18:21:33 +10:00
Nyall Dawson
f304828f59 Allow storing arbitrary metadata in parameter definitions 2017-06-22 18:18:51 +10:00
Nyall Dawson
1d69939dde Fix build 2017-06-22 06:58:31 +10:00
Nyall Dawson
312c810787 Sipify 2017-06-22 06:49:43 +10:00
Nyall Dawson
86f33c682d Expand model unit test coverage 2017-06-22 06:49:09 +10:00
Nyall Dawson
780f4331cc Add method to generate temporary destination parameter value 2017-06-22 06:49:09 +10:00
Nyall Dawson
a87ca09e34 Move some temp file/folder utils to c++ 2017-06-22 06:48:25 +10:00