231 Commits

Author SHA1 Message Date
Denis Rouzaud
c604d2dda6 run sipify 2017-12-15 22:13:44 -04:00
Nyall Dawson
4da1ce8404 Drop redundant virtual keywords on overrides
Run clang-tidy modernize-use-override to remove all the redundant
virtual keywords from overridden methods, and add some missing
overrides.

Another benefit is that this has also added the overrides
on destructors, which will cause a build failure if a base
class is missing a virtual destructor.
2017-12-16 08:49:36 +10:00
Denis Rouzaud
f2b3ed0a9b run sipify 2017-12-15 11:12:19 -04:00
Alexander Bruy
1d482cf953 [processing] add groupId() method to algorithms to get unique ID of the
algorithm group.

Adapt native algorithms
2017-12-14 14:12:00 +02:00
Nyall Dawson
53ebe050bd
Merge pull request #5825 from nyalldawson/gdal
[processing] Some GDAL algorithm fixes
2017-12-09 17:26:41 +11:00
Nyall Dawson
3a5caaf94c Add missing proxy calls for QgsProcessingFeatureSource, causing
inefficient base class methods to be used instead.
2017-12-08 15:05:56 +10:00
Denis Rouzaud
b72c569cf3 [doxygen] replace @see by \see 2017-12-06 08:31:12 -04:00
Denis Rouzaud
e48cf98edb run sipify 2017-12-06 07:19:50 -04:00
Nyall Dawson
86958937ad Tweak processing API to better handle dynamic properties 2017-12-02 11:17:19 +10:00
Nyall Dawson
ecbc4718d4 [processing] Some more framework for dynamic (data defined) parameters 2017-12-02 11:16:26 +10:00
Nyall Dawson
297e8561a0 Bump lowest possible min for numeric parameters to -DBL_MAX + 1
We need to reserve -DBL_MAX as a special value, to allow it to
work correctly in QDoubleSpinBoxes (limitation of QDoubleSpinBox)
2017-12-01 20:42:38 +11:00
Nyall Dawson
6b56565f89 Show nicer tooltips for numeric processing parameters
With min/max and default values (when set)
2017-12-01 20:42:38 +11:00
Nyall Dawson
4b9986eb8c [processing] Add a generic map layer output type
For occasions when an algorithm creates a map layer, but the type
is not known in advance (i.e. could be raster OR vector)
2017-11-27 06:38:21 +11:00
Matthias Kuhn
916c9c4cdb Open heart surgery on expression context for processing sources 2017-11-24 16:09:05 +01:00
Matthias Kuhn
abe1a9b661 Expression context creation for processing improvements
Hiding away the implementation directly in QgsProcessingFeatureSource

See discussion ec97102bc6 (r152903378)
2017-11-24 16:09:05 +01:00
Matthias Kuhn
851adb0a3d Allow adding sources to processing expression context 2017-11-23 15:24:40 +01:00
Nyall Dawson
e6d86bba53 [processing] Generalise modeler multi-step feedback proxy for use
outside of modeler

This can be useful too for individual algorithms
2017-11-23 10:01:13 +10:00
Nyall Dawson
bf75747f18 [processing] Use user-set default file formats if supported by
provider, otherwise fall back to a format which IS supported
by that provider
2017-11-07 12:25:55 +10:00
Nyall Dawson
4ae9241e71 [processing] Allow providers to determine default vector/raster file
to use for their algorithm's parameters

Because some providers do not have support for all output types,
we need to give providers a way to restrict the default format
choices to those which are supported by the provider.
2017-11-06 12:44:38 +10:00
Nyall Dawson
2a280d69aa Allow access to parent algorithm for processing parameters 2017-11-06 12:00:16 +10:00
Nyall Dawson
4ce166241e Allow processing providers to specify a long name, and show it in tooltips
Add version number to gdal provider long name
2017-10-19 13:12:31 +10:00
Nyall Dawson
b5197c8c53 Port drop geometries to c++ 2017-10-13 08:29:37 +10:00
Nyall Dawson
2951afa324 Port boundary algorithm to c++
Also allow feature based algorithms to customise their appectable
input layers types and set suitable filters for all applicable
algorithms
2017-10-13 08:28:34 +10:00
Alexander Bruy
2104b273af [processing][API]introduce QgsProcessingOutputFile output and fix gdal2xyz test 2017-10-11 17:06:11 +03:00
Denis Rouzaud
6e14854f90 [sipify] remove redundant private sections 2017-10-09 09:51:40 +02:00
Nyall Dawson
b27382d011 [processing] Fix history doesn't correctly escape values
Fixes #17229
2017-10-03 19:01:13 +10:00
Nyall Dawson
01d34ede9d Sip sync 2017-09-25 17:12:03 +10:00
Nyall Dawson
e1eef7ed19 Allow use of QgsPointXY/QgsReferencedPointXY for point parameter values 2017-09-24 12:09:38 +10:00
Nyall Dawson
57b76920d6 Expand docs 2017-09-22 15:22:01 +10:00
Nyall Dawson
c41dca937c Port processing combineFields to c++ 2017-09-22 15:19:32 +10:00
Nyall Dawson
6afe25ef0f [processing] Proper progress reports during model execution
Instead of showing the progress reports for each child algorithm
individually, which leads to repeated 0->100% progress for every
step of a model, we proxy the progress reports and account for the
overall progress through a model as well. This means that
the progress accounts for both the progress within the current
model step AND the total number of steps left to execute.
2017-09-22 10:32:17 +10:00
Mathieu Pellerin
09195fb567 [processing] implement source flag for feature based algorithms (#5208) 2017-09-18 13:33:20 +07:00
Nyall Dawson
9b112284c7 Add method to recover extent parameter CRS 2017-09-15 14:09:27 +10:00
Nyall Dawson
cfdc3c71e7 Use geometry of reproject extent parameters for more accurate clipping 2017-09-15 08:35:42 +10:00
Nyall Dawson
ae8bc04b6c Allow use of Qgs(Referenced)Rectangle for processing extent parameter values
And add a new target CRS argument to parameterAsExtent. If set, and
the source CRS of the rectangle parameter can be determined, then
the returned value will be the rectangle automatically reprojected
to the desired target CRS.
2017-09-15 08:33:45 +10:00
Nyall Dawson
cb70aad7a3 Fix restricting model algorithm input types to valid types for alg (refs #17030) 2017-08-23 17:34:08 +10:00
Nyall Dawson
ebda2fd212 Rename some enum values for clarity 2017-08-19 02:46:22 +10:00
Nyall Dawson
7879c0a20b Fix processing rendering styles for output dialog, functionality 2017-08-19 00:47:21 +10:00
Nyall Dawson
37b899fb99 Add a pure virtual clone method to processing parameter definitions
And use it when we need to clone parameters (instead of more fragile
conversion to and from variants)

This fixes model loading which use algorithms which create python
subclasses of parameter definitions
2017-08-18 01:22:07 +10:00
arnaud.morvan@camptocamp.com
b3a9e46cfe [processing] Port refactor fields to new API 2017-08-14 13:48:50 +02:00
Alexander Bruy
9fe326dee2 [processing] more consistent naming for class members, setters and
getters
2017-08-04 13:21:26 +03:00
Alexander Bruy
49bfe69823 [processing] add parameter representing raster band 2017-08-04 11:27:35 +03:00
Nyall Dawson
f7b25a17b1 Allow setting layer type filter for QgsProcessingParameterVectorLayer
Turns out this is required for some algorithms
2017-07-27 14:30:04 +10:00
Nyall Dawson
383422f069 Fix "wrapped object has been deleted" errors in Processing
Ownership of Python subclass algorithm instances was getting
mangled due to passing through multiple functions with /Factory/
annotations.

As per Phil Thomson's advice on
https://www.riverbankcomputing.com/pipermail/pyqt/2017-July/039450.html:
"
/Factory/ is used when the instance returned is guaranteed to be
new to Python. In this case it isn't because it has already been
seen when being returned by createInstance(). (However for a different
sub-class implemented in C++ then it would be the first time it was seen
by Python so the /Factory/ on create() would be correct.)

You might try using /TransferBack/ on create() instead - that might be
the best compromise.
"

Changing to /TransferBack/ indeed fixes the error for me.
2017-07-26 07:03:16 +10:00
Nyall Dawson
11cfc78a24 Skip invalid returned features 2017-07-18 22:13:50 +10:00
Nyall Dawson
29855b3942 Change signature of processFeature so that features are no longer modified in place 2017-07-18 19:56:42 +10:00
Nyall Dawson
c2cad99d6b Add note about throwing QgsProcessingException to cancel algorithm execution 2017-07-18 19:44:33 +10:00
Nyall Dawson
d926789d3b Improve dox 2017-07-18 19:41:33 +10:00
Nyall Dawson
7e3c435dd6 Port some existing algorithms to QgsProcessingFeatureBasedAlgorithm 2017-07-18 19:41:33 +10:00
Nyall Dawson
1a41624370 Add QgsProcessingFeatureBasedAlgorithm subclass
An abstract QgsProcessingAlgorithm base class for processing algorithms
which operate "feature-by-feature".

Feature based algorithms are algorithms which operate on individual
features in isolation. These are algorithms where one feature is
output for each input feature, and the output feature result
for each input feature is not dependent on any other features
present in the source.

For instance, algorithms like "centroids" and "buffers" are feature
based algorithms since the centroid or buffer of a feature is
calculated for each feature in isolation. An algorithm like "dissolve"
is NOT suitable for a feature based algorithm as the dissolved output
depends on multiple input features and these features cannot be
processed in isolation.

Using QgsProcessingFeatureBasedAlgorithm as the base class for feature
based algorithms allows shortcutting much of the common algorithm code
for handling iterating over sources and pushing features to output sinks.
It also allows the algorithm execution to be optimised in future
(for instance allowing automatic multi-thread processing of the
algorithm, or use of the algorithm in "chains", avoiding the need
for temporary outputs in multi-step models).
2017-07-18 19:41:33 +10:00