3275 Commits

Author SHA1 Message Date
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
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
Denis Rouzaud
5b8e2c2f27 remove QgsVectorLayer::hasGeometryType in favor of QgsMapLayer::isSpatial 2017-07-05 10:18:32 +02:00
Harrissou Sant-anna
b57cd0deb1 [processing] align the "Iterate over layer" button (#4796) 2017-07-03 14:13:30 +07:00
Nyall Dawson
37cc8fc5f1 Don't allow removal of model parameters on which other parameters
depend
2017-07-03 11:02:45 +10:00
Nyall Dawson
f9f98593e0 Draw links between dependent parameters in graphical modeler
Fix #12907
2017-07-03 10:27:03 +10:00
Nyall Dawson
f4d703bd38 Fix processing modeler joins are drawn doubled
OCD fix: joins are actually being drawn with two lines going
in both directions. This is totally 100% unacceptable, so
this commit fixes it so they are correctly drawn only with one line.
2017-07-03 10:25:40 +10:00
Harrissou Sant-anna
450eb7c24a Spelling check: Replace analyse by analyze 2017-07-02 22:28:50 +02: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
nirvn
26d9c74bc4 [processing] keep only one zonal statistics algorithm 2017-06-29 11:53:04 +07:00
Nyall Dawson
8379f9bb98 Merge pull request #4791 from nyalldawson/reproj_test
Use native projection algorithm for unit test
2017-06-29 09:30:16 +10:00
Nyall Dawson
468e44dc3a Use native projection algorithm for unit test 2017-06-29 08:33:34 +10:00
Nyall Dawson
144d733b12 Use a QgsFeedback instead of QProgressBar for QgsNineCellFilter
Gives progress reports and allows cancelation of processing
aspect algorithm
2017-06-29 08:03:57 +10:00
Nyall Dawson
d2b9652d4b Fix use of direct map layers as inputs for source parameters 2017-06-29 08:00:47 +10:00
Nyall Dawson
d1a93e0e13 Restore points layer from table algorithm 2017-06-28 17:38:17 +10:00
Mathieu Pellerin
a6b14a0b40 [processing] restore zonal statistics (qgis) alg (#4784) 2017-06-27 18:09:44 +07:00
Nyall Dawson
7f7842a11d Merge pull request #4783 from nyalldawson/script
processing: restore script algorithm provider and tests
2017-06-27 14:15:36 +10:00
Nyall Dawson
4f096a6f8b Feature source parameters cannot be used for vector layer algorithm
parameters in models

There's not a 1:1 correlation here - vector layers can be used
as inputs for sources, but sources cannot be used when a
full vector layer is required.
2017-06-27 13:18:22 +10:00
Nyall Dawson
e171fe30c0 Restore script based algorithm tests 2017-06-27 13:18:22 +10:00
Nyall Dawson
ae829857ca Restore select by expression algorithm 2017-06-27 13:18:22 +10:00
Nyall Dawson
f98bcb2b81 Update processing.run() for new API 2017-06-27 13:18:22 +10:00
Nyall Dawson
14347a431e Also add results to results dock when running through algorithm dialog 2017-06-27 13:18:22 +10:00
Nyall Dawson
1e5d773e57 Fix use of temporary files for outputs 2017-06-27 13:18:22 +10:00