250 Commits

Author SHA1 Message Date
Nyall Dawson
81855a715b Use FastInsert when adding features from processing 2017-06-23 14:34:38 +10:00
Nyall Dawson
5ea07684bd Also call invalidGeometryCallback when skipping features 2017-06-23 12:08:54 +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
4ea85362f4 Transform errors encountered while iterating features in
processing are non-fatal. We report them to users, and treat the
feature as having no geometry, but don't stop execution.
2017-06-23 12:08:54 +10:00
Nyall Dawson
57f2c623ce Move invalid geometry callback from Python to c++ 2017-06-23 12:08:54 +10:00
Nyall Dawson
6be4875a82 Restore symmetrical difference alg 2017-06-22 18:21:16 +10:00
Nyall Dawson
a87ca09e34 Move some temp file/folder utils to c++ 2017-06-22 06:48:25 +10:00
Nyall Dawson
e8a03b918b Move default file extension code to c++ 2017-06-22 06:48:25 +10:00
Nyall Dawson
29f50b72ee [processing] Catch transform errors in when iterating features 2017-06-12 08:05:32 +10:00
Alexander Bruy
a137a7c0f3 [processing] open help in the default webbrowser to be consistent with
the rest of QGIS dialogs
2017-06-06 10:51:22 +03:00
Nyall Dawson
ea2e477d91 Fix failing tests, temporarily disable some processing tests during
refactoring
2017-06-06 07:41:20 +10:00
Nyall Dawson
a658135693 Remove global processing use selection setting 2017-06-06 07:41:20 +10:00
Nyall Dawson
f9887aabf5 [processing] Remove more UseSelectionIfPresent use 2017-06-06 07:41:20 +10:00
Nyall Dawson
bdf051a03a Partially port a trial python alg to new API 2017-06-06 07:41:19 +10:00
Nyall Dawson
28f7a8b7e1 Move expression context generation out of parameters 2017-06-06 07:41:19 +10:00
Nyall Dawson
189f804714 Adapt more code to c++ API 2017-06-06 07:41:19 +10:00
Nyall Dawson
03e40f7497 [processing] Remove all remaining algorithm copies
Algorithms are no longer copied - just a single const instance
of each algorithm is used
2017-06-06 07:41:19 +10:00
Alexander Bruy
dc5ba8ffe9 [processing] explisitly load outputs as raster or vector depending
on the output type. Don't rely on extension or other indirect attributes
2017-05-26 13:30:23 +03:00
Alexander Bruy
e01b7ef60a [processing] take in account file extension when loading Processing
results (fix #16486)
2017-05-12 17:28:41 +03:00
Nyall Dawson
06c4dea7ff [processing] Remove vector.createVectorWriter
Use QgsProcessingUtils.createFeatureSink instead
2017-05-07 08:02:54 +10:00
Nyall Dawson
a8a3cc82ed [processing] Port vector.createVectorWriter to c++
This implements an improved version of vector.createVectorWriter
in QgsProcessingUtils. The improved version relies on the
core class QgsVectorLayerImport to create empty layers,
which:
- reduces duplicate code and reuses the mature QgsVectorLayerImport
routines
- avoids manual conversion of field types to destination provider
field types
- potentially allows any writable provider to be used as a feature
sink for algorithms (e.g. output direct to MSSQL/Oracle/db2). This
should work now - it just needs exposing via UI.
2017-05-07 08:02:53 +10:00
Nyall Dawson
b5ae888b60 Merge pull request #4478 from nyalldawson/layer_store
Split off map layer storage handling from QgsProject to QgsMapLayerStore
2017-05-06 13:00:05 +10:00
Nyall Dawson
f81971daa4 Fix failing tests 2017-05-03 07:09:44 +10:00
Nyall Dawson
15de36ab26 [processing] Always require real QgsFields objects in getVectorWriter,
don't allow arrays of fields as inputs
2017-05-03 06:26:12 +10:00
Nyall Dawson
ee1236f067 [processing] Remove unused options argument from (create/get)VectorWriter 2017-05-03 06:25:30 +10:00
Nyall Dawson
877775d2c0 Remove a bunch of unneeded imports 2017-05-02 14:47:58 +10:00
Nyall Dawson
49c688bbe4 Fix use of QgsProcessingUtils.mapLayerFromString 2017-05-02 13:40:49 +10:00
Nyall Dawson
df1ead5ed4 [processing] Remove vector.spatialindex()
Use QgsProcessingUtils.createSpatialIndex() instead.
2017-05-02 13:39:36 +10:00
Nyall Dawson
bde1bf457b [processing] Remove unused vector.duplicateInMemory() function 2017-05-02 13:29:42 +10:00
Nyall Dawson
7eb7a7aa01 [processing] Remove vector.bufferedBoundingBox()
Use QgsRectangle.grow() instead
2017-05-02 13:27:01 +10:00
Nyall Dawson
8e5565413f [processing] Remove unused dataobjects.loadList method 2017-05-02 13:20:29 +10:00
Nyall Dawson
0fbf1c2f54 [processing] Remove unused dataobjects.extent method 2017-05-02 13:18:47 +10:00
Nyall Dawson
fa8f667b3e Fix failing test 2017-05-02 13:15:58 +10:00
Nyall Dawson
b1eecfdba4 Fix resolving memory layers when multiple memory layers are used in model 2017-05-02 12:45:54 +10:00
Nyall Dawson
f84d703234 Add method QgsProcessingUtils::mapLayerFromString
Algorithms and other processing code should use this method
(instead of dataobjects.getLayerFromString) to
retrieve layers from a string, as it considers the processing
context and allows resolving strings to temporarily stored layers.

This permits processing models to function correctly when
intermediate results are stored as memory layers. Subsequent
model algorithms can then access these temporary layers as inputs.
All temporary layers will be removed when the context object
is destroyed after the model algorithm is run.
2017-05-02 12:33:04 +10:00
rldhont
856046c5f0 [BUGFIX][Processing] Fix spatialite version comparison: import re 2017-04-28 13:47:19 +02:00
Nyall Dawson
0b0ccc9e9d Rename QgsVectorLayer::selectedFeaturesIterator to getSelectedFeatures
It's more in line with QgsVectorLayer::getFeatures, hence a more
discoverable API
2017-04-27 11:16:10 +10:00
Nyall Dawson
fd2c18ee16 Refactor processing writer to use QgsFeatureSink, and to store
temporary output layers in the provided processing context

Should fix loss of intermediate memory layers when running
a multi-step model
2017-04-26 17:38:40 +10:00
Nyall Dawson
1394c28d13 [processing] Move some log handling to c++ class 2017-04-26 13:56:29 +10:00
Nyall Dawson
f247a7cda3 Add c++ optimised uniqueValues method which respects processing context
Remove processing vector.uniqueValues/vector.getUniqueValues
and port usage to c++ method

Should be much faster than the python method, as the c++ method takes
advantage of handing off the unique values calculation to the
provider source whenever possible
2017-04-26 12:53:35 +10:00
Nyall Dawson
86002f3b6f Move createContext to dataobjects 2017-04-26 12:53:35 +10:00
Nyall Dawson
b067bd786a Rename UseSelection -> UseSelectionIfPresent, clarify docs 2017-04-26 12:53:35 +10:00
Nyall Dawson
427c3b1684 Remove vector.features
Use QgsProcessingUtils.getFeatures instead
2017-04-26 12:53:35 +10:00
Nyall Dawson
6397386fda Remove len method from vector.features
Use QgsProcessingUtils::featureCount instead
2017-04-26 12:53:35 +10:00
Nyall Dawson
f4f4ca3d83 Raise GeoAlgorithmExecutionException when encountering invalid
geometries in QgsProcessingUtils::getFeatures
2017-04-26 12:53:35 +10:00
Nyall Dawson
8cf1617f5d Use context to control vector.features() 2017-04-26 12:53:35 +10:00
Nyall Dawson
3f137e123d Add context argument to other vector methods 2017-04-26 12:53:35 +10:00
Nyall Dawson
adc7cf0ec2 Add context argument to vector.features 2017-04-26 12:53:35 +10:00
Nyall Dawson
f3cfb8b759 Add invalid geometry handling method to processing context 2017-04-26 12:53:35 +10:00
Nyall Dawson
06a20b935d Add UseSelection flag to QgsProcessingContext
Indicates whether only selected features should be used in
algorithms
2017-04-26 12:53:35 +10:00