47 Commits

Author SHA1 Message Date
Nyall Dawson
5ea07684bd Also call invalidGeometryCallback when skipping features 2017-06-23 12:08:54 +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
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
Matthias Kuhn
b0bb873360 Fix build 2017-05-19 07:16:03 +02:00
Matthias Kuhn
ad7ce981fb Update sip files 2017-05-19 07:13:11 +02:00
Denis Rouzaud
68b990b3bb sipify batch
python/core/qgspaintenginehack.sip
python/core/qgspainting.sip
python/core/qgspallabeling.sip
python/core/qgspathresolver.sip
python/core/qgspluginlayer.sip
python/core/qgspluginlayerregistry.sip
python/core/qgspointlocator.sip
python/core/qgsproject.sip
python/core/qgsprojectbadlayerhandler.sip
python/core/qgsprojectproperty.sip
python/core/qgsprojectversion.sip
python/core/qgssnappingconfig.sip
2017-05-18 09:41:16 +02:00
Denis Rouzaud
8231d7528b sipify QgsExpressionContext, QgsFeatureRequest, QgsOptionalExpression 2017-05-17 15:20:31 +02:00
Matthias Kuhn
f511401995 Fix bindings 2017-05-02 01:56:23 +02:00
Denis Rouzaud
93971d5ed3 [sip] align pointer and reference in blacklisted files
this will facilitate sip diff checking
2017-05-01 17:49:43 +02:00
Nyall Dawson
d27cbe7f3f Try to fix build failure on clang 2017-04-25 16:47:52 +10:00
Nyall Dawson
5be060fe85 More cleanups to MethodCode 2017-04-25 16:26:11 +10:00
Nyall Dawson
c658f5ac63 Cleaner MethodCode 2017-04-25 16:16:17 +10:00
Nyall Dawson
9743831123 Expose invalid geometry callback to python 2017-04-25 16:16:17 +10:00
Nyall Dawson
80d07cb4b9 Add method to perform invalid geometry checking in QgsFeatureRequest
Allows requests to specify how invalid geometries should be
handled. Default is to perform no geometry validity checking.
2017-04-25 16:16:17 +10:00
Nyall Dawson
6beaa51837 Add test to provider test suite that provider source does not rely
on source layer or provider in any way

Fails for OGR provider! :o
2017-04-24 08:21:06 +10:00
Nyall Dawson
f3e1772bb9 Remove QgsFeatureRequest::FilterRect
This enum value has not been in use since filter rects were
separated from other filter types. Leaving it in API is confusing
and leads to incorrect use.
2017-03-20 15:03:10 +10:00
Nyall Dawson
b5480633e4 Standardise names for static variables
All non-const variables are prefixed with "s", all const
statics are ALL_CAPS
2017-01-14 16:40:24 +10:00
Nyall Dawson
df0d5969aa Fix virtual fields which depend on other virtual fields may not be
calculated in some circumstances (fix #14939)
2016-06-10 11:18:25 +10:00
Juergen E. Fischer
8f29f28d5c fix windows build and some warnings 2015-12-24 02:17:59 +01:00
Matthias Kuhn
168c6f70bc Rename OrderBys -> OrderBy and OrderBy -> OrderByClause
And some sip fixes
2015-12-22 09:12:32 +01:00
Matthias Kuhn
a5f88181f6 Fix fallback orderby and attribute subset
Also properly closes the iterator when a fallback orderby is used
2015-12-22 09:12:32 +01:00
Matthias Kuhn
d96a2748b6 Add Order By Clause 2015-12-18 18:36:43 +01:00
Nyall Dawson
edb16d0014 [FEATURE] Feature limit support for feature requests
Limits the maximum number of features returned by the iterator.
Some providers (postgres, spatialite, MS SQL) pass the limit on
to the provider to result in faster queries.
2015-12-05 10:24:42 +11:00
Nyall Dawson
323f265c94 Misc cleanups following c9f0d83 2015-11-20 10:38:34 +11:00
Nyall Dawson
c49b5b777f Change a lot of arguments to const references in core/gui
Rationale:
- there was a lot of large objects passed by value, so potentially
there's a speed bump from this
- even for implicitly shared classes like QString/QList there's still
a (small) cost for copying the objects when there's no reason to
- it's the right thing to do!
2015-10-07 12:02:04 +11:00
Nyall Dawson
3b6f5915e7 Port iterators to expression contexts 2015-08-22 19:01:40 +10:00
Denis Rouzaud
480a0f17c3 Don't send expressions with special fields to provider 2015-08-14 11:39:27 +02:00
Juergen E. Fischer
9752c468c1 indentation update 2015-07-29 11:52:14 +02:00
Nyall Dawson
1e39db6a0f [FEATURE] New expression functions for $currentfeature (returns current feature) and 'attribute' (returns value stored in specified field within a feature) 2014-07-10 14:10:44 +10:00
Juergen E. Fischer
45c0be1059 sip: remove enum constants 2014-06-02 21:52:02 +02:00
Juergen E. Fischer
c4c131ef75 sip sync 2014-05-27 23:32:42 +02:00
Martin Dobias
fafa58ed24 Merge remote-tracking branch 'origin/master' into threading-revival
Conflicts:
	src/core/qgspallabeling.cpp
	src/core/qgsrenderchecker.h
	src/core/qgsvectorlayer.cpp
	src/core/symbology-ng/qgslinesymbollayerv2.cpp
	src/core/symbology-ng/qgssymbollayerv2.cpp
	src/providers/wms/qgswmsdataitems.cpp
	tests/src/core/testqgsblendmodes.cpp
2014-02-23 20:12:50 +07:00
Martin Dobias
5a4f8d07a0 Change "added/deprecated in 2.1" notes to 2.4 for stuff related to threading 2014-02-21 17:33:09 +07:00
Martin Dobias
da1ebc2693 Comments and API improvements of simplification (no functional changes)
- moved QgsVectorLayer::SimplifyHint enum to QgsVectorSimplifyMethod
- use QFlags instead of int for hints
- added few notes about simplification being added in 2.2
2014-02-21 12:08:50 +07:00
Martin Dobias
a3af93394e Merge branch 'master' into threading-revival
Some features are still disabled - will be fixed later

Conflicts:
	python/core/composer/qgscomposition.sip
	python/core/diagram/qgsdiagram.sip
	python/core/diagram/qgshistogramdiagram.sip
	python/core/diagram/qgspiediagram.sip
	python/core/diagram/qgstextdiagram.sip
	python/core/qgsdiagramrendererv2.sip
	python/core/qgsfield.sip
	python/core/qgslabelsearchtree.sip
	python/core/qgsmaprenderer.sip
	python/core/qgsrenderchecker.sip
	python/core/symbology-ng/qgssymbollayerv2.sip
	python/gui/qgsmapcanvas.sip
	src/app/composer/qgscomposerlegendwidget.cpp
	src/app/qgisapp.cpp
	src/core/composer/qgsatlascomposition.cpp
	src/core/composer/qgscomposerattributetable.cpp
	src/core/composer/qgscomposermap.cpp
	src/core/composer/qgscomposition.cpp
	src/core/composer/qgscomposition.h
	src/core/diagram/qgsdiagram.h
	src/core/diagram/qgshistogramdiagram.cpp
	src/core/diagram/qgshistogramdiagram.h
	src/core/diagram/qgspiediagram.cpp
	src/core/diagram/qgspiediagram.h
	src/core/diagram/qgstextdiagram.cpp
	src/core/diagram/qgstextdiagram.h
	src/core/qgsdiagramrendererv2.cpp
	src/core/qgsdiagramrendererv2.h
	src/core/qgsmaprenderer.cpp
	src/core/qgsmaprenderer.h
	src/core/qgsnetworkaccessmanager.h
	src/core/qgspallabeling.cpp
	src/core/qgsrenderchecker.h
	src/core/qgsvectorlayer.cpp
	src/core/qgsvectorlayer.h
	src/core/qgsvectorlayerfeatureiterator.cpp
	src/core/qgsvectorlayerfeatureiterator.h
	src/core/raster/qgsrasterlayer.cpp
	src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp
	src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
	src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
	src/core/symbology-ng/qgssinglesymbolrendererv2.cpp
	src/core/symbology-ng/qgssymbollayerv2.cpp
	src/core/symbology-ng/qgssymbollayerv2.h
	src/core/symbology-ng/qgssymbolv2.cpp
	src/gui/qgshighlight.cpp
	src/gui/qgsmapcanvas.cpp
	src/gui/qgsmapcanvas.h
	src/gui/qgsmapcanvasitem.cpp
	src/gui/qgsmaptoolidentify.cpp
	src/plugins/georeferencer/qgsgeorefplugingui.cpp
	src/providers/memory/qgsmemoryfeatureiterator.cpp
	src/providers/ogr/qgsogrfeatureiterator.cpp
	src/providers/ogr/qgsogrfeatureiterator.h
	src/providers/ogr/qgsogrprovider.cpp
	src/providers/oracle/qgsoraclefeatureiterator.cpp
	src/providers/oracle/qgsoracleprovider.cpp
	src/providers/postgres/qgspostgresconn.cpp
	src/providers/postgres/qgspostgresfeatureiterator.cpp
	src/providers/postgres/qgspostgresfeatureiterator.h
	src/providers/wfs/qgswfsfeatureiterator.cpp
	src/providers/wms/qgswmsprovider.cpp
	src/providers/wms/qgswmsprovider.h
	src/ui/qgsoptionsbase.ui
	tests/src/core/CMakeLists.txt
	tests/src/core/testqgscomposereffects.cpp
	tests/src/core/testqgscomposerhtml.cpp
	tests/src/core/testqgscomposerscalebar.cpp
	tests/src/core/testqgscomposershapes.cpp
2014-02-18 11:28:46 +07:00
Juergen E. Fischer
74e7314c36 update sip bindings II 2014-01-27 09:22:53 +01:00
Juergen E. Fischer
d4e369414b update sip bindings 2014-01-26 18:36:29 +01:00
Martin Dobias
2bece090f5 Update Python bindings to match changes in core/gui libraries. 2013-12-05 18:27:45 +07:00
Matthias Kuhn
0c90f32007 QgsFeatureRequest: New filters FilterExpression and FilterFids 2013-09-18 18:57:52 +01:00
Juergen E. Fischer
3854086d47 sip update 2013-06-23 16:00:24 +02:00
Martin Dobias
ff0a434852 Added convenience constructors for QgsFeatureRequest 2013-03-19 22:32:36 +01:00
Juergen E. Fischer
bb97787c65 fix sip error 2013-01-29 08:50:35 +01:00
Juergen E. Fischer
4cbec1811c fix warnings, add copyright headers, cosmetics 2013-01-28 01:39:58 +01:00
Matthias Kuhn
5cd75663f3 Add expression constructor to QgsFeatureRequest 2013-10-31 13:16:23 +01:00
Martin Dobias
51122d263a Store attributes and fields in vectors instead of maps 2012-10-20 22:19:55 +02:00
Martin Dobias
e110855e6c [API] added QgsFeatureIterator, changed QgsVectorProvider API
Vector data provider now has getFeatures() method to access features.
select(), nextFeature(), featureAtId(), rewind() were removed resp. moved to provider's feature iterator implementations.

Providers that currently do not implement the new API were disabled.
2012-10-08 17:47:51 +02:00
Martin Dobias
70ff8ef6dd Added select() variant with QgsFeatureRequest for simpler construction of requests 2012-10-08 17:14:45 +02:00