12 Commits

Author SHA1 Message Date
Nyall Dawson
1e13d733c2 Move declaration of algorithm parameters/outputs to a new virtual
initAlgorithm() method

This allows 2 benefits:
- algorithms can be subclassed and have subclasses add additional
parameters/outputs to the algorithm. With the previous approach
of declaring parameters/outputs in the constructor, it's not
possible to call virtual methods to add additional parameters/
outputs (since you can't call virtual methods from a constructor).

- initAlgorithm takes a variant map argument, allowing the algorithm
to dynamically adjust its declared parameters and outputs according
to this configuration map. This potentially allows model algorithms which
can be configured to have variable numbers of parameters and
outputs at run time. E.g. a "router" algorithm which directs
features to one of any number of output sinks depending on some
user configured criteria.
2017-07-10 16:31:14 +10:00
Nyall Dawson
03275bbace Split QgsProcessingAlgorithm::create into non virtual-create
and pure virtual createInstance

Allows us to add logic which always need applying within
create(), leaving createInstance() free to just return a
raw new instance of the class
2017-07-10 10:07:32 +10:00
Nyall Dawson
05364aa5f0 When running algorithm tests, if two parameters share the same
layer source, ensure that the actual parameter values point
to the same layer
2017-07-07 09:28:19 +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
1b2afea23e Add some more clone methods to algorithm subclasses 2017-07-07 09:26:17 +10:00
Nyall Dawson
ebe0ebdb9c Fix (unwanted) python exception in algorithm test 2017-06-24 07:36:30 +10:00
Nyall Dawson
a8cdde5232 Add test that python exception is caught when executing an alg 2017-06-23 12:08:54 +10:00
Nyall Dawson
5a6f11d52e Some cleanups 2017-04-07 13:21:28 +10:00
Juergen E. Fischer
c77172ed3d fix more flake8 warnings 2017-03-05 10:21:24 +01:00
Juergen E. Fischer
f41304637c switch tests to pyqt wrappers 2016-03-21 17:00:26 +01:00
Juergen E. Fischer
2526d3e3c8 processing: switch to pyqt wrappers, flake8 fixes 2016-03-21 17:00:25 +01:00
Matthias Kuhn
450fb13047 [processing] Move AlgorithmTests to QgisAlgorithmTests 2016-02-23 09:33:41 +01:00