77 Commits

Author SHA1 Message Date
Hugo Mercier
0749ba43ba Rework layer dependencies
A new class QgsMapLayerDependency allows to represent different kinds
of dependencies between layers.
2016-08-31 14:40:13 +02: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
58856fe82f Remove some deprecated QgsVectorDataProvider::Capabilities
Also make capabilities() return a QFlags
QgsVectorDataProvider::Capabilities, rather than an integer
value (for type safety)
2016-07-25 12:14:00 +10:00
Nyall Dawson
1a2231f10c Rename QGis class to Qgis, for capitalisation consistency 2016-07-21 22:01:38 +10:00
Nyall Dawson
e683101b10 Make QgsVectorDataProvider::fields() return a copy
Implements a QGIS 3.0 TODO
2016-07-15 05:59:02 +10:00
Nyall Dawson
1bafa80089 Const correctness for numerous data provider methods 2016-07-15 05:57:57 +10:00
Juergen E. Fischer
006b581870 fix warnings 2016-06-02 12:27:40 +02:00
Nyall Dawson
58cc89019c [FEATURE] Add support for attribute renaming to QgsVectorDataProvider
Implemented in memory layer provider only, not yet supported
in edit buffer or configurable in GUI
2016-06-02 17:09:45 +10:00
Nyall Dawson
307aabd66a [FEATURE] Aggregates for expressions
This commit adds a number of different forms of aggregates to
the expression engine.

1. Aggregates within the current layer, eg sum("passengers")
Supports sub expressions (ie sum("passengers"/2) ), group by
( sum("passengers", group_by:="line_segment") ), and optional
filters ( sum("passengers", filter:= "station_class" > 3 ) )

2. Relational aggregates, which calculate an aggregate over
all matching child features from a relation, eg
relation_aggregate( 'my_relation', 'mean', "some_child_field" )

3. A summary aggregate function, for calculating aggregates
on other layers. Eg aggregate('rail_station_layer','sum',"passengers")
The summary aggregate function supports an optional filter,
making it possible to calculate things like:

aggregate('rail_stations','sum',"passengers",
  intersects(@atlas_geometry, $geometry ) )

for calculating the total number of passengers for the stations
inside the current atlas feature

In all cases the calculations are cached inside the expression
context, so they only need to be calculated once for each
set of expression evaluations.

Sponsored by Kanton of Zug, Switzerland
2016-05-17 10:53:25 +10:00
Nyall Dawson
dcc047af49 Add possibility to handle aggregate calculation at data provider
(not implemented for any providers yet)
2016-05-17 10:53:24 +10:00
Nyall Dawson
ab288c6b12 Fix coverity mixed enum warning, switch 0 -> nullptr 2016-05-11 10:00:01 +10:00
Marco Hugentobler
11b7a2702c Move conversion of added/changed geometry to vector data provider 2016-05-06 15:26:13 +02:00
Matthias Kuhn
4c63c85cca Show provider errors more prominently 2016-02-20 17:21:57 +01:00
Juergen E. Fischer
ad1fd2a922 [API] Introduce optional QgsVectorDataProvider::ChangeFeatures
capability and changeFeaturss method to allows joint geometry and
attribute updates.

Currently only implemented in the postgres provider
2016-01-15 10:12:07 +01:00
Hugo Mercier
020dac0702 Allow to declare layer dependencies on a vector layer 2016-01-07 12:02:30 +01: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
Matthias Kuhn
aeeca48ac9 Provide a public API for invalidating connections.
QgsVectorDataProvider::forceReload() is the virtual method. It is implemented
in the OGR provider.
See here for reference:
http://gis.stackexchange.com/questions/159950/make-a-qgis-layer-update-from-a-changed-data-source
2015-08-29 20:50:58 +02:00
Juergen E. Fischer
9752c468c1 indentation update 2015-07-29 11:52:14 +02:00
Nyall Dawson
b05e789c57 Fix build 2015-02-03 20:47:29 +11:00
Juergen E. Fischer
abd4a04399 sip update 2015-02-03 02:21:52 +01:00
Sandro Mani
40ad3b0993 [FEATURE]: Transactional editing for postgres layers (other datasources possible in the future). Funded by City of Uster 2015-01-19 15:22:20 +01:00
Juergen E. Fischer
9ceb5ceab6 sip sync 2014-11-21 01:17:21 +01:00
Juergen E. Fischer
c4c131ef75 sip sync 2014-05-27 23:32:42 +02: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
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
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
Juergen E. Fischer
ea1aaeae01 cleanup style to db:
- add sip bindings to new methods
- table name, sql queries and constants should not be translated
- replace QVector<QString> with QStringList
2013-05-03 00:25:39 +02:00
Borys Jurgiel
2073f87a22 Disable encoding combobox in layer properties dialog for OGR provider with OLCStringsAsUTF8==true (so when it doesn't work anyway). Patch from Minoru Akagi. 2013-04-22 22:13:12 +02:00
Martin Dobias
94639ee61e [API] remove QgsVectorDataProvider::enableGeometrylessFeatures(bool)
Geometryless features are not skipped by default anymore.
2013-04-11 23:38:10 +02:00
Larry Shaffer
fbf999190c Update QgsPalLabeling to work with new vector api
- Switch data defined properties from field index- to name-based
- Add routine to migrate properties to new keys:  labeling/dataDefined/[enum name]
- Add QHash containing old-style data provider mapping of index to name for use in properties migration
- Update QgsLabelingGui, QgsMapToolLabel, QgsLabelPropertyDialog to work with name-based properties
2013-02-07 14:49:56 -07:00
Juergen E. Fischer
4cbec1811c fix warnings, add copyright headers, cosmetics 2013-01-28 01:39:58 +01:00
Martin Dobias
8da06cb97d QgsVectorLayer: deprecate old API: select(), nextFeature(), featureAtId() 2013-01-26 19:42:46 +01:00
Martin Dobias
5f304b34a1 Merge remote-tracking branch 'origin/master' into new_vector_api
Conflicts:
	python/core/qgsvectordataprovider.sip
	src/app/legend/qgslegendlayer.cpp
	src/app/qgisapp.cpp
	src/app/qgsmergeattributesdialog.cpp
	src/core/qgsvectordataprovider.cpp
	src/core/qgsvectordataprovider.h
	src/core/qgsvectorlayer.cpp
	src/gui/qgssearchquerybuilder.cpp
	src/providers/postgres/qgspostgresprovider.cpp
	src/providers/wfs/CMakeLists.txt
2013-01-23 23:46:56 +01:00
Alexander Bruy
5e45a22d06 remove deprecated methods from API 2012-12-23 10:40:23 +02:00
Martin Dobias
81b0930498 QgsVectorLayer: large internal refactoring
Most important changes:
- introduced feature iterator for QgsVectorLayer
- vector editing moved to QgsVectorEditBuffer
- complete rework of undo/redo commands for vector layers
- geometry cache separated from editing (QgsVectorLayerCache)
- non-essential editing functionality moved to QgsVectorLayerEditUtils
2012-12-17 21:22:42 +01:00
Martin Dobias
51122d263a Store attributes and fields in vectors instead of maps 2012-10-20 22:19:55 +02:00
Martin Dobias
f217a7fb19 Fixes after rebase 2012-10-09 20:57:35 +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
Juergen E. Fischer
4c97806d26 fix doxygen warnings 2012-09-25 21:29:32 +02:00
Juergen E. Fischer
f3cb57b1eb SIP bindings update:
- update methods of existing classes
- add comment to methods missing in the sip bindings
- split up collective sip files into single files and use
  same directory structure in python/ as in src/
- add a lot of missing classes (some might not make sense because of
  missing python methods in those classes)
- remove some non-existing methods from the header files
- add scripts/sipdiff
- replace some usages of std::vector and std::set with QVector/QSet
2012-09-24 02:42:57 +02:00
Juergen E. Fischer
d8bdcb20ca add python binding to QgsVectorDataProvider::fieldNameMap() 2012-01-16 08:57:07 +01:00
Juergen E. Fischer
893f305c51 update for sip 4.13 2011-12-24 05:09:25 +01:00
Juergen E. Fischer
5a3a87fde2 [FEATURE] support 64bit feature ids 2011-06-16 20:30:07 +02:00
jef
ce8e3d5f05 add 'deprecated' annotation to SIP bindings
git-svn-id: http://svn.osgeo.org/qgis/trunk@15209 c8812cc2-4d05-0410-92ff-de0c093fc19c
2011-02-19 13:24:24 +00:00
jef
132088f6d2 fix API QgsMapLayer::getLayerID() to id()), some warnings and use doxygen deprecation tag.
git-svn-id: http://svn.osgeo.org/qgis/trunk@15168 c8812cc2-4d05-0410-92ff-de0c093fc19c
2011-02-13 20:24:55 +00:00
jef
b78d8556a4 allow vector data provider to record errors (currently only used in query
builder to report errors in where clauses from OGR and postgres provider).


git-svn-id: http://svn.osgeo.org/qgis/trunk@14935 c8812cc2-4d05-0410-92ff-de0c093fc19c
2010-12-17 15:00:17 +00:00
jef
ae3d122853 [FEATURE] allow saving vector layers as ogr vector files
git-svn-id: http://svn.osgeo.org/qgis/trunk@13169 c8812cc2-4d05-0410-92ff-de0c093fc19c
2010-03-27 00:38:59 +00:00
wonder
2034de2bc9 PyQGIS: few additions for more pythonic api
- QgsVectorLayer and QgsVectorDataProvider support iterating
- QgsFeature allows direct access to attributes (get/set/del)


git-svn-id: http://svn.osgeo.org/qgis/trunk@12878 c8812cc2-4d05-0410-92ff-de0c093fc19c
2010-02-04 21:08:33 +00:00