4940 Commits

Author SHA1 Message Date
Nyall Dawson
4c2447fd89 Add shell for QgsLayoutView 2017-07-11 11:06:35 +10:00
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
f49b603443 Split QgsProcessingModelAlgorithm into separate components
The cpp/h file was getting too large, so split off the individual
subcomponents into their own h/cpp files to keep code
maintainable.
2017-07-08 20:49:17 +10:00
Nyall Dawson
cfa18039af Fix incorrect icon size in processing windows
Well... kind of. It fixes the toolbar button size, but for some
reason the actual icon content itself isn't being resized. I can't
work out why this is...
2017-07-08 20:49:17 +10:00
Nyall Dawson
a3fdb95d0a Update model input type names 2017-07-08 20:49:17 +10:00
Nyall Dawson
7db1a9dfd3 Save and restore window geometry for modeler dialogs 2017-07-08 20:49:17 +10:00
Nyall Dawson
3665e462c8 Use a filter line edit for outputs 2017-07-08 20:49:17 +10:00
Nyall Dawson
0836c60712 Make model editor dialog more robust while loading models 2017-07-08 20:49:17 +10:00
Nyall Dawson
9d04f87249 Rename "output" style parameters for clarity
The previous naming was too easily confused with processing outputs.
Rename them to QgsProcessingParameterFileDestination, etc... to
make it clearer what they are used for.
2017-07-08 20:49:17 +10:00
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
Matthias Kuhn
875a5d6d9d Merge pull request #4818 from DelazJ/spelling
Fix some spelling issues
2017-07-08 10:20:40 +02:00
Nyall Dawson
e0915103fd Fix folder destinations always default to temp folder (fix #16800) 2017-07-07 17:02:19 +10:00
Nyall Dawson
b500080a31 [processing] Use correct file filter for file output dialog 2017-07-07 16:39:19 +10:00
Harrissou Sant-anna
0d1c4cdc59 Running check_spelling.sh 2017-07-07 06:55:06 +02:00
Nyall Dawson
05e8928e30 Use native algorithms for processing tests where possible
And fix a few issues in the dissolve algorithm
2017-07-07 13:49:43 +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
3f9cfe0ce7 Fix setting number parameters to expressions 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
26cd6017b8 Use an expression context when evaluating child parameters with expression sources 2017-07-07 11:35:31 +10:00
Nyall Dawson
ac9a39f09a Fix processing.runAndLoadResults 2017-07-07 09:28:20 +10:00
Nyall Dawson
55ce31b371 When calling procesing.run(), map layer results are automatically
converted to QgsMapLayer objects with the ownership transferred
to the Python caller

This should make it super-easy for PyQGIS scripts to run processing
algorithms and immediately utilise the results, even if they
are memory layers. They call processing.run(), and get a dict of
results back which includes those layers ready for adding to the
current project or doing some other processing or operations
with, and if they don't transfer to ownership off then these
layers will be correctly garbaged collected by Python.
2017-07-07 09:28:20 +10:00
Nyall Dawson
a2af3a9345 Make concave hull alg more efficient
- remove temporary layers from context, delete them as soon as they
are finished with
- directly remove features via data provider, instead of selecting
and using edit buffer
- use native geometry methods for splitting to single features
and removing rings
2017-07-07 09:28:20 +10:00
Nyall Dawson
db816ec3fe Port a multi-step algorithm to new API (concave hull) 2017-07-07 09:28:20 +10:00
Nyall Dawson
a15d283cd6 Port delaunay triangulation alg to new API 2017-07-07 09:28:19 +10:00
Nyall Dawson
75cd91b1a0 Port voronoi polygons algorithm to new API 2017-07-07 09:28:19 +10:00
Nyall Dawson
90f10ae853 Port snap geometries algorithm to new API 2017-07-07 09:28:19 +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
ab06973d6a Don't try to load default styles in processing test layers 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
3108d68f87 Indentation 2017-07-07 09:28:19 +10:00
Nyall Dawson
4fa2bc025c Keep correct order for zonal stats options, set some stats by default 2017-07-07 09:28:19 +10:00
Nyall Dawson
4eca20f28d Fix zonal stats algorithm execution 2017-07-07 09:28:19 +10:00
Nyall Dawson
274d684f64 Fix procesing test layer loading 2017-07-07 09:28:19 +10:00
Nyall Dawson
b917a82662 Better debuging from processing alg tests 2017-07-07 09:28:19 +10:00
Nyall Dawson
6654aec6a5 Fix execution of script algorithms was not releasing layers/sinks 2017-07-07 09:28:19 +10:00
Nyall Dawson
e9e335a7bd Don't set thinking cursors when running processing algorithms
Since now they're run in a background thread, it's not appropriate
anymore
2017-07-07 09:28:19 +10:00
Nyall Dawson
1b2086e8a6 Make algorithm dialog use background tasks to execute algorithms 2017-07-07 09:27:35 +10:00
Nyall Dawson
8cfcf57541 Fix tests 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
cd7776ca1c Upgrade ported python algs to be thread ready 2017-07-07 09:27:35 +10:00
Harrissou Sant-anna
9e6b8ed59d Use PostGIS and PostgreSQL spelling when appropriate 2017-07-07 01:26:38 +02:00
Harrissou Sant-anna
6fab688298 Use SpatiaLite right spelling when needed 2017-07-07 01:26:38 +02:00
Harrissou Sant-anna
15be88918f Replace "double click" and "doubleclick" by double-click 2017-07-07 01:26:38 +02:00
Nyall Dawson
5c4f64270d Add clone method to ScriptAlgorithm 2017-07-07 09:26:17 +10:00
Nyall Dawson
1b2afea23e Add some more clone methods to algorithm subclasses 2017-07-07 09:26:17 +10:00
Nyall Dawson
6d7b0a3bbc Fix re-saving already saved models 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