3222 Commits

Author SHA1 Message Date
Nyall Dawson
2d2dff9b4a Restore basic stats alg 2017-06-09 13:17:48 +10:00
Nyall Dawson
32ecbcfa21 Merge pull request #4693 from nyalldawson/request_crs
Allow specifying a destination CRS in QgsFeatureRequest
2017-06-09 10:49:02 +10:00
Nyall Dawson
482ed3f25a Explicitly mention in docs that presence of destination CRS does
not affect filter expressions or virtual field values
2017-06-09 09:00:04 +10:00
Nyall Dawson
e437812a68 Return an invalid iterator if a transform exception occurs
when projecting filter rects from destination crs
2017-06-09 08:57:00 +10:00
Nyall Dawson
7d847bf34a Rename transform methods for clarity 2017-06-09 08:41:46 +10:00
Nyall Dawson
9f71156a13 Merge pull request #4678 from nyalldawson/layer_scale
Swap QgsMapLayer min/max scale API definitions (unify scale api, pt 2)
2017-06-09 07:44:01 +10:00
Martin Dobias
2964c33d63 Reshape tool: use default Z value for 3D geometries 2017-06-08 21:56:21 +02:00
Denis Rouzaud
866bfc3db6 sipify core symbology part 2 2017-06-08 15:16:55 +02:00
Nyall Dawson
b6e1eea4c7 Handle request destinationCrs in QgsVectorLayerFeatureIterator 2017-06-08 19:20:07 +10:00
Nyall Dawson
a98923507e Allow specifying a destination CRS in QgsFeatureRequest
If set, all geometries will be reprojected from their original
coordinate reference system to the destination CRS while
iterating over features.

If a CRS has been set as the destination CRS, then the filterRect
parameter should be specified in the same CRS as this destination
CRS.

Additionally, a callback function can be specified on the request
to be called if a transform exception is encountered while
iterating over features.

This is designed to make it easier for scripts and plugins to
correctly reproject layers in an efficient and robust way, instead
of having to implement lots of repeated code themselves and
potentially missing some of the important considerations which
come with reprojecting geometries & bounding boxes.

Now, if a script wants the features from a layer in a specific
CRS, they can call:

    crs = QgsCoordinateReferenceSystem('epsg:4326')
    request = QgsFeatureRequest().setDestinationCrs(crs)
    for f in layer.getFeatures(reqeuest):
        print('geometry in 4326 is {}.format(f.geometry().exportToWkt()))
2017-06-08 19:20:07 +10:00
Nyall Dawson
7651f9fb71 Merge pull request #4698 from nyalldawson/cache_test
Add feature source test for QgsVectorLayerCache
2017-06-08 17:39:14 +10:00
Denis Rouzaud
9e176feeac gps fixes 2017-06-08 09:38:34 +02:00
Denis Rouzaud
e545d44c4f sipify core gps 2017-06-08 09:38:34 +02:00
Nyall Dawson
fbad91165c Add feature source test for QgsVectorLayerCache
While it's not a QgsFeatureSource subclass (yet), it behaves
just like one so when can run the feature source conformance
test suite over it.

Fix a few minor issues identified by the test suite, and one
potential crash (requesting an invalid id from a cache iterator
crashes qgis)
2017-06-08 16:59:21 +10:00
Denis Rouzaud
a7c9cc8133 fix merge 2017-06-08 07:31:47 +02:00
Denis Rouzaud
41ceed3d77 [sipify] fix false virtual methods 2017-06-08 07:28:36 +02:00
Denis Rouzaud
6606d463d3 fix enum 2017-06-07 19:43:45 +02:00
Denis Rouzaud
542dc85433 sipify core symbology classes 2017-06-07 16:04:30 +02:00
Denis Rouzaud
9a40754fb8 sipify Qgis, QgsDxfExport 2017-06-07 12:03:22 +02:00
Nyall Dawson
64a86e3d6c Add an explicit argument to set QgsGeometryValidator method
Previously this was always read from settings when using
QgsGeometryValidator. It's now an explicit argument
when constructing QgsGeometryValidator or calling the
static validation methods, allowing choice of internal/GEOS
validation methods.

Helps remove more QgsSettings use from core.
2017-06-07 11:36:14 +10:00
Nyall Dawson
de9e70e6ba Merge pull request #4684 from nyalldawson/processing_pt3
Add sourceExtent method to QgsFeatureSource
2017-06-06 21:50:45 +10:00
Martin Dobias
51e7efe218 Replace QString::null by QString() in core (deprecated since Qt 5.9) 2017-06-06 11:36:41 +02:00
Nyall Dawson
c6c20c6114 Add sourceExtent method to QgsFeatureSource 2017-06-06 17:26:07 +10:00
Nyall Dawson
c1d35a043b Port getHTMLOutputsCount to c++ API 2017-06-06 15:39:54 +10:00
Nyall Dawson
1f0a3d9719 Add file based and HTML outputs to c++ API 2017-06-06 15:36:39 +10:00
Nyall Dawson
a27c22d9b1 Add raster layer output parameters 2017-06-06 14:38:24 +10:00
Nyall Dawson
b75a174780 Rename QgsProcessingFeatureSinkDefinition to QgsProcessingOutputLayerDefinition
Since it also applies to raster layer outputs, we need a more generic name
2017-06-06 13:43:55 +10:00
Nyall Dawson
ab64428891 Add a cancel button for algorithms which support cancelation 2017-06-06 11:40:33 +10:00
Nyall Dawson
39d20a4cb4 Move algorithm expression context generation to QgsProcessingAlgorithm
Fix error when selecting "from expression" in algorithm parameter dialog
2017-06-06 11:25:09 +10:00
Nyall Dawson
607fed8c48 Restore ability to save outputs directly to Spatialite/PostGIS providers 2017-06-06 10:34:57 +10:00
Nyall Dawson
77072b15ac Rename QgsProcessingFeatureSink to QgsProcessingFeatureSinkDefinition
For consistency with QgsProcessingFeatureSourceDefinition
2017-06-06 08:42:48 +10:00
Nyall Dawson
81da209bf5 Use a QgsProject pointer instead of bool loadIntoProject
Allows potential future use case of loading results into
a different open project
2017-06-06 08:40:23 +10:00
Nyall Dawson
72be86dc61 Only accept QgsPropertys in QgsProcessingFeatureSourceDefinition/
QgsProcessingFeatureSink, not all QVariant types

Only strings/QgsPropertys are valid anyway, so instead of strings
use static properties. This makes it clearer what possible
values are permitted for the underlying source/sink definition.
2017-06-06 08:25:03 +10:00
Nyall Dawson
d7aa3f5f7c [processing] Change explicit encoding string parameters to more
flexible QVariantMap creatOptions parameters which include an
optional fileEncoding value

More flexible, allows sinks to be created using any creation
option which is passed to the underlying provider
2017-06-06 08:00:28 +10:00
Nyall Dawson
ea2e477d91 Fix failing tests, temporarily disable some processing tests during
refactoring
2017-06-06 07:41:20 +10:00
Nyall Dawson
46596c50f2 Restore correct layer naming when loading results 2017-06-06 07:41:20 +10:00
Nyall Dawson
5b9d925c70 Fix loading of results after running algorithms 2017-06-06 07:41:20 +10:00
Nyall Dawson
3bd74aef52 Remove no longer required QgsProcessingContext::UseSelectionIfPresent flag
Since using selection is now a per-feature-source setting
2017-06-06 07:41:20 +10:00
Nyall Dawson
ed09a8a727 Create class for encapsulating settings relating to a feature source
input to a processing algorithm.

This allows parameter inputs to encapsulate extra information
relating to a feature source input, such as whether only
selected features from the source layer should be used.
2017-06-06 07:41:20 +10:00
Nyall Dawson
0e991bf62c Remove QgsProcessingUtils::uniqueValues
Use QgsFeatureSource method instead
2017-06-06 07:41:20 +10:00
Nyall Dawson
b6fb41d4ee [processing] Don't use vector layers directly as feature sources
Instead, parameters evaluate to QgsFeatureSource, which are
used for retrieving features, feature count, crs, wkb type,
etc.

This abstracts away the actual feature source, so that
algorithms may potentially operate from non-layer
feature sources.

It also helps remove the need for specialised QgsProcessingUtils
methods like getFeatures, featureCount, and createSpatialIndex.
Instead the standard API methods using QgsFeatureSources can
be used instead.
2017-06-06 07:41:20 +10:00
Nyall Dawson
005a08ead9 Create class for encapsulating settings relating to a feature sink
input to a processing algorithm.

This allows parameter inputs to encapsulate extra information
relating to a feature sink input, such as destination file
encoding and whether the sink layer should be loaded into
the project on completion
2017-06-06 07:41:20 +10:00
Nyall Dawson
5b8affcb56 Rename QgsProcessingParameterOutputVectorLayer to QgsProcessingParameterFeatureSink 2017-06-06 07:41:20 +10:00
Nyall Dawson
770c45da12 Rename QgsProcessingParameterVectorLayer to QgsProcessingParameterFeatureSource
Helps abstract away sources to allow non vector layer sources in future
2017-06-06 07:41:20 +10:00
Nyall Dawson
ffce9c9f1e Add direct method to retrieve QgsFeatureSink from parameter 2017-06-06 07:41:20 +10:00
Nyall Dawson
a951424287 QgsProcessingParameterVectorLayer accepts lists of vector layer types 2017-06-06 07:41:19 +10:00
Nyall Dawson
ba03f1a13a Move minimum layer extent calculation to c++ 2017-06-06 07:41:19 +10:00
Nyall Dawson
ef59d0c454 Port parameter checking to c++ 2017-06-06 07:41:19 +10:00
Nyall Dawson
a23a6ac631 Create a QgsProcessingAlgRunnerTask task
Allows background execution of processing algorithms.

Not exposed anywhere in GUI (yet)
2017-06-06 07:41:19 +10:00
Nyall Dawson
c1d9d57dd2 First working pure c++ algorithms 2017-06-06 07:41:19 +10:00