113 Commits

Author SHA1 Message Date
Denis Rouzaud
6606d463d3 fix enum 2017-06-07 19:43:45 +02:00
Nyall Dawson
c6c20c6114 Add sourceExtent method to QgsFeatureSource 2017-06-06 17:26:07 +10:00
Nyall Dawson
3388857526 Move uniqueValues to QgsFeatureSource
Also change signature of QgsVectorLayer/QgsVectorDataProvider
uniqueValues method to match (and improve API)
2017-06-05 16:59:08 +10:00
Nyall Dawson
4647662664 Add crs, fields, wkbType and featureCount to QgsFeatureSource 2017-05-25 12:31:06 +10:00
Nyall Dawson
8bfeb8f73b QgsVectorLayer, QgsVectorDataProvider are QgsFeatureSources 2017-05-25 12:31:06 +10:00
Denis Rouzaud
1df3c51606 sipify batch 2017-05-22 10:12:08 +02:00
Denis Rouzaud
7d459149c7 [sip] align missing bits and replace nullptr by 0 2017-05-02 08:09:53 +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
3dfc4cf6fd Provide a base class version of QgsFeatureSink::addFeature
Means that subclasses are only required to implement addFeatures
2017-04-26 11:58:19 +10:00
Nyall Dawson
7ae71ded57 QgsVectorDataProvider is a QgsFeatureSink 2017-04-26 10:43:07 +10:00
Mathieu Pellerin
25d9936df8 [OGR] fix feature count issue for OSM datasets (fixes #16402) (#4322) 2017-04-06 16:04:48 +07:00
Nyall Dawson
d47d31d13c Rename "Db"/"DB" in API to "Database"
Motivations:
- consistency - we generally use expanded names, and this also
matches Qt API which uses Database instead of Db
- avoids unpredictable capitalization throughout API (mix of "Db"
and "DB")
2017-02-07 09:32:05 +10:00
Jorge Gustavo Rocha
8b36ad5b90 Updated Qt connections to the new style qgis/QGIS-Enhancement-Proposals#77
Changed isDeleteStyleFromDBSupported to isDeleteStyleFromDbSupported
2017-02-05 19:35:47 +00:00
Jorge Gustavo Rocha
6d6f288102 make deleteStyleFromDatabase consistent with other vectorlayer's methods 2017-01-30 23:48:20 +00:00
Jorge Gustavo Rocha
72c5cf0088 Sip coverage: first attempt 2017-01-27 00:09:30 +00:00
Denis Rouzaud
b119744773 replace cancelling, cancelled and cancellation by canceling, canceled and cancelation, respectively (#4000)
* replace cancelling and cancelled by canceling and canceled, respectively

see https://github.com/qgis/qgis3_UIX_discussion/issues/19

* replace cancellation by cancelation
2017-01-16 22:27:14 +01:00
Nyall Dawson
231f6af0e1 Don't return const references to implicitly shared Qt classes
Instead return the inexpensive copies. Should provide extra safety
against issues like #14822

(refs #14822)
2017-01-14 15:53:45 +10:00
Denis Rouzaud
6c74e4ea5d spelling fixes 2017-01-12 22:01:50 +01:00
Harrissou Sant-anna
ef85cdcf83 Replace "eg" by "e.g." or "for example" 2016-12-30 00:03:22 +01:00
Nyall Dawson
bc98a326c0 [FEATURE] Add QgsVectorDataProvider::truncate for clearing layers
Adds a new method to QgsVectorDataProvider to truncate the layer.
The base implementation requires DeleteFeatures capability and
is not optimised. Providers can return the FastTruncate capability
and override the base implementation with a provider specific
optimised version. This is done in this commit for the Postgres
and Spatialite providers.
2016-12-27 13:55:42 +10:00
Nyall Dawson
60bbd09339 Avoid double-evaluating postgres default values 2016-11-16 14:19:24 +01:00
Nyall Dawson
3242321aa9 [FEATURE] Add method to get list of unique strings matching
a substring from a vector data provider

Base implementation iterates through all features, but
providers can override with optimised versions. Native
implementations for postgres, spatialite and OGR included.
2016-11-16 14:19:24 +01:00
Stéphane Brunner
6cf47bef1e Apply some @m-kuhn comments (#3736)
* Use QgsStringMap

* Better description

* Use new translated metadata methods
2016-11-08 23:16:11 +01:00
Nyall Dawson
1fea20de50 Split handling of literal default values from provider side
default value SQL clauses

QgsVectorDataProvider now has two methods:

- defaultValueClause: returns SQL fragment which must be evaluated
by the provider to obtain the default value, eg sequence values
- defaultValue: returns the literal constant default value
for a field
2016-11-08 08:18:16 +10:00
Stéphane Brunner
59b10d65b7 Merge pull request #3720 from sbrunner/WFS-provider-metadata
Add metadata for WFS provider in layer metadata informations
2016-11-07 17:15:03 +01:00
Stéphane Brunner
bc1ad2ce82 Add metadata for WFS provider in layer metadata informations 2016-11-07 16:46:39 +01:00
Nyall Dawson
cb94b68d88 Move constraint handling to QgsFieldConstraints
Avoids cluttering QgsField API
2016-11-02 11:07:07 +10:00
Nyall Dawson
f99ea26bdf Refactor constraint handling
- store constraint origin in QgsField
- move handling of constraint expressions to QgsField
2016-11-02 11:07:07 +10:00
Nyall Dawson
4efad04bd8 Move constraints to QgsField 2016-11-02 11:07:07 +10:00
Nyall Dawson
d1fd588499 Add method to fetch constraints from a vector data provider
Implemented for unique and not null constraints for postgres
provider
2016-11-02 11:07:07 +10:00
Matthias Kuhn
1445647065 QgsVectorDataProvider API cleanup 2016-10-22 23:03:57 +02:00
Nyall Dawson
a51bebdacc Fix missing doc warning 2016-10-22 13:19:32 +10:00
Patrick Valsecchi
31a1c23903 Add auto-discovery of relations for PostgresQL
Fixed the add relation functionnality: the table is sorted. When the code
was setting the sorted column, the row was sorted and the other columns it was
setting were set on the wrong row.
2016-09-27 16:36:33 +02:00
Nyall Dawson
7f9cc87f85 Merge pull request #3494 from nyalldawson/deprecated
Remove remaining deprecated methods
2016-09-16 21:02:25 +10:00
Nyall Dawson
ccd9cc8a15 Undeprecate provider CreateAttributeIndex capability
This capability is still used in QGIS and has value for
plugins
2016-09-15 06:16:37 +10:00
Patrick Valsecchi
57d00949f7 Add an editor widget for QVariantList 2016-09-13 09:16:17 +02:00
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