52 Commits

Author SHA1 Message Date
Nyall Dawson
21f92a6fb2 Port line intersection and split with lines to c++ 2017-09-22 15:19:32 +10:00
Nyall Dawson
c41dca937c Port processing combineFields to c++ 2017-09-22 15:19:32 +10:00
Nyall Dawson
2a442c7886 Rationalise algorithm groups a bit 2017-08-22 23:36:42 +10:00
Nyall Dawson
7baa623f6f Allow bulk load of QgsSpatialIndex to be canceled via QgsFeedback 2017-07-15 16:43:44 +10:00
Nyall Dawson
91d6ac9537 Update script algorithms for auto output creation 2017-07-12 07:50:13 +10:00
Nyall Dawson
d92583c10e Take advantage of auto created outputs in ported algorithms 2017-07-12 07:39:43 +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
81855a715b Use FastInsert when adding features from processing 2017-06-23 14:34:38 +10:00
Nyall Dawson
99cfb8faf3 Fix processing algs crash when no source features exist
Instead we output an empty layer - this may be critical for
multi-step models where there is validly no features present
in a source layer
2017-06-23 13:49:32 +10:00
Nyall Dawson
6be4875a82 Restore symmetrical difference alg 2017-06-22 18:21:16 +10:00
Nyall Dawson
f64f74fb63 Fix incorrect import 2017-06-06 13:41:42 +10:00
Nyall Dawson
4cb7d18b1c Push parameters into processAlgorithm and related functions 2017-06-06 07:41:19 +10:00
Nyall Dawson
77ab933788 Move alg character definitions to __init__ 2017-06-06 07:41:19 +10:00
Nyall Dawson
168f16276c Remove help related methods from GeoAlgorithm 2017-06-06 07:41:19 +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
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
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
e9f13d1ea3 Just use standard QgsMessageLog functionality instead of a dedicated
method for processing
2017-04-26 13:57:06 +10:00
Nyall Dawson
1394c28d13 [processing] Move some log handling to c++ class 2017-04-26 13:56:29 +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
adc7cf0ec2 Add context argument to vector.features 2017-04-26 12:53:35 +10:00
Nyall Dawson
dd4f530cfb [processing] Pass context argument to processAlgorithm 2017-04-26 12:53:35 +10:00
Nyall Dawson
377b181c4e Port more processing dataobjects methods to c++
Also
- simplify and add tests
- remove large memory leak (persistant store of all non-project layers)
- remove broken support for direct loading postgres/virtual layers
by string (Python version was very broken and would never match
a postgres/virtual layer)
2017-04-05 19:50:46 +10:00
Nyall Dawson
a0bd464232 Use formatted name for algorithm names
Avoids conversion of names later and gives clearer separation
between visible names and internal names
2017-04-03 21:17:45 +10:00
Nyall Dawson
6987d7b37c Port handling of algorithm names to QgsProcessingAlgorithm 2017-04-03 21:17:45 +10:00
Nyall Dawson
dc729c1b5a Move algorithm group handling to QgsProcessingAlgorithm 2017-04-03 21:17:45 +10:00
Nyall Dawson
faa8a653b2 Move algorithm icon handling to QgsProcessingAlgorithm 2017-04-03 21:17:45 +10:00
Juergen E. Fischer
c77172ed3d fix more flake8 warnings 2017-03-05 10:21:24 +01:00
Nyall Dawson
ede452be85 [processing] Port feedback object to c++
Algorithms are now passed a QgsProcessingFeedback object
instead of the loosely defined progress parameter.
2017-01-11 11:11:10 +10:00
volaya
7b68c77f4c [processing] removed unnecessary code to check validity of geometries 2017-01-09 15:13:47 +02:00
Mathieu Pellerin
cf6004959e [processing] ensure that outputs of vector overlay operations are multiparts (#3622) 2016-10-19 14:58:23 +02:00
Nyall Dawson
86368f39c3 [processing] Optimise feature requests within qgis algs
- don't use setFilterFid() within loops to fetch features one
at time (as it's extremely slow), instead use setFilterFids()
outside the loop
- don't fetch unused attributes/geometry when it can be
avoided
2016-10-17 10:30:55 +10:00
Alexander Bruy
65db336eaf [processing] move some constants to the dataobjects module 2016-09-02 09:28:45 +03:00
Nyall Dawson
06c4b07222 [processing] Use layer crs/fields instead of provider crs/fields
Since the layer has more complete knowledge of the crs (ie, when
provider could not determine crs and user has selected it from
the list), and also better knowledge of layer fields (virtual
fields, joined fields) we should use these rather than the
provider methods.
2016-08-05 06:28:49 +10:00
Matthias Kuhn
bb79d13e82 Remove deprecated Qgis::WKBType and API cleanup (#3325)
* Remove deprecated Qgis::WKBType and API cleanup

Renames QgsWKBTypes to QgsWkbTypes

Replaces usage of the enums:

* Qgis::WKBType with QgsWkbTypes::Type
* Qgis::GeometryType with QgsWkbTypes::GeometryType

Their values should be forward compatible (a fact that was already
explited up to now by casting between the types)

Renames some SSLxxx to SslXxx and URIxxx to UriXxx

* Fix build warnings and simplify type handling

* Add a fixer to rewrite imports

* The forgotten rebase conflictThe forgotten rebase conflicts

* QgsDataSourcURI > QgsDataSourceUri

* QgsWKBTypes > QgsWkbTypes

* Qgis.WKBGeom > QgsWkbTypes.Geom

* Further python fixes

* Guess what... Qgis::wkbDimensions != QgsWkbTypes::wkbDimensions

* Fix tests

* Python 3 updates

* [travis] pull request caching cannot be disabled

so at least use it in r/w mode

* Fix python3 print in plugins
2016-08-04 09:10:08 +02:00
Nyall Dawson
bd7d913379 Refine QgsFeature geometry getters/setters
All pointer based methods have been removed.

Now we have only:

  void setGeometry( const QgsGeometry& geom )

and

  QgsGeometry geometry() const

Benefits include avoiding a whole lot of tricky pointer lifetime
issues, potential memory leaks, and finally closing #777, which
has survived for over 9 years!...

Impacts on PyQGIS code:
- no more need for the messy
  g = QgsGeometry( feature.geometry() )
  workaround, just use g = feature.geometry() instead
- IMPORTANT: you can no longer test whether a feature has geometry
 using `if f.geometry():`, since QgsFeature::geometry() will
 *always* return an object. Instead, use
 `if not f.geometry().isEmpty():`, or preferably the new method
 `if not f.hasGeometry():`

Fix #777
2016-08-01 16:25:46 +10:00
Nyall Dawson
1a2231f10c Rename QGis class to Qgis, for capitalisation consistency 2016-07-21 22:01:38 +10:00
Alexander Bruy
0553f7b33b [processing] allow 2.5D geometries (fix #14929) 2016-06-13 11:44:08 +03:00
Alexander Bruy
48949d642f [processing] improve error message text (refs #14929) 2016-06-10 15:30:03 +03:00
Denis Rouzaud
8071acd064 move PyQt compat folder to python/qgis 2016-04-29 14:10:26 +02:00
Juergen E. Fischer
2526d3e3c8 processing: switch to pyqt wrappers, flake8 fixes 2016-03-21 17:00:25 +01:00
Alexander Bruy
5df0ce04e8 [processing] replace fTools and GdalTools plugins with Processing 2016-03-01 15:57:32 +02:00
Alexander Bruy
11a9a66104 [processing] add icons for fTools and GDALTools algorithms 2016-03-01 15:57:31 +02:00
Alexander Bruy
d4e400a425 [processing] fixes for vector geoprocessing algorithms 2016-01-29 16:33:21 +02:00
Juergen E. Fischer
bf64f8d0a0 spelling fixes and indentation update 2015-10-22 21:56:54 +02:00
Juergen E. Fischer
24fe216270 spelling fixes 2015-10-01 19:12:29 +02:00
Juergen E. Fischer
b39055b39c indentation update (now including autopep8) 2015-08-22 14:29:41 +02:00