1
0
mirror of https://github.com/qgis/QGIS.git synced 2025-04-26 00:02:43 -04:00

99 Commits

Author SHA1 Message Date
Nyall Dawson
c50ee6d42f Update python code to new API 2017-10-26 07:06:34 +10:00
Nyall Dawson
c4f3832af2 Rename QgsGeometry::fromPolyline as QgsGeometry::fromPolylineXY
and add new QgsGeometry::fromPolyline which uses QgsPoint

We want to encourage people not to use the QgsPointXY method, as it drops
Z/M values. So it's moved across to a different name to make way
for a new QgsGeometry::fromPolyline which uses a QgsPoint list
instead of QgsPointXY, thus keeping Z/M values intact.

Similarly, QgsPolyline now is a list of QgsPoint (keeping z/m values)
and the old 2d QgsPolyline type was renamed to QgsPolylineXY.

Making the QgsPoint method the "preferred" method and making linestrings
just as easy to create from z/m dimensioned points as 2d points is
important to push people to write code which does not discard
these important dimensions.

As a bonus, the QgsPoint methods are more efficient anyway, since
they don't require creation of a temporary list.
2017-10-22 18:10:14 +10:00
Matthias Kuhn
366433e1f5
Add more applyOnUpdate tests 2017-09-29 17:52:32 +02:00
Matthias Kuhn
951b699c97
More default value tests 2017-09-29 17:52:31 +02:00
Matthias Kuhn
ff385fb035
Add tests for QgsDefaultValue 2017-09-29 17:52:31 +02:00
Blottiere Paul
d4789db19a Fix tests 2017-08-28 14:09:56 +01:00
Blottiere Paul
4be1cc0067 Add tests for deleteCascade option 2017-08-28 14:09:56 +01:00
Nyall Dawson
8711473b7f Add a very basic guard against virtual fields which reference themself 2017-07-14 10:29:18 +10:00
Nyall Dawson
3f4d6de54b Fix aggregate expression calculation when used with virtual fields
The layer expression context (which is required for aggregate
calculation to work) was not being added to the context used
by vector layer feature iterators.

Fix 
2017-07-14 10:21:56 +10:00
Nyall Dawson
eb0c3015f9 Push minimumValues/maximumValues up to QgsFeatureSource base class
Allows these methods to be called on feature sources
2017-07-13 20:07:33 +10:00
Blottiere Paul
b354986209 Add unit test 2017-06-25 14:39:54 +01:00
Martin Dobias
415d3e90a6 Use bold font in tests + fix a unit test 2017-06-21 14:54:52 +02:00
Nyall Dawson
32ecbcfa21 Merge pull request from nyalldawson/request_crs
Allow specifying a destination CRS in QgsFeatureRequest
2017-06-09 10:49:02 +10:00
Nyall Dawson
9f71156a13 Merge pull request from nyalldawson/layer_scale
Swap QgsMapLayer min/max scale API definitions (unify scale api, pt 2)
2017-06-09 07:44:01 +10:00
Nyall Dawson
b6e1eea4c7 Handle request destinationCrs in QgsVectorLayerFeatureIterator 2017-06-08 19:20:07 +10:00
Nyall Dawson
342897c6ae Add source test for vector layer with deleted features in buffer 2017-06-08 06:42:09 +10:00
Nyall Dawson
3f81fc0913 Add feature source unit tests for vector layer with edits in buffer
Run the feature source tests over a layer with added, edited
geometries, and edited attributes unsaved in an edit buffer

Fix identified issues when iterating over these edited features
2017-06-07 22:26:11 +10:00
Nyall Dawson
6fed80b1e9 Add a couple more tests for QgsVectorLayerSelectedFeatureSource 2017-06-05 13:36:19 +10:00
Nyall Dawson
405c55f155 Create QgsVectorLayerSelectedFeatureSource
...which is a QgsFeatureSource subclass which only considers
selected features from a QgsVectorLayer
2017-06-05 13:28:37 +10:00
Nyall Dawson
a9a7d3c3d9 Swap QgsMapLayer min/max scale API definitions
setMaximumScale() and setMinimumScale(), maximumScale() and
minimumScale() had the opposite meaning to other min/max scales
in the API, and were the opposite to how these settings were
exposed in the GUI. This lead to very confusing API!!

Their definitions have now been swapped. setMaximumScale
now sets the maximum (i.e. largest scale, or most zoomed in)
at which the layer will appear, and setMinimumScale now sets
the minimum (i.e. smallest scale, or most zoomed out) at
which the layer will appear. The same is true for the
maximumScale and minimumScale getters.
2017-06-04 09:31:10 +10:00
Matthias Kuhn
881dfef3c9 Fix python test imports 2017-06-02 19:53:37 +02:00
Matthias Kuhn
a9d7630a69 Rename QgsPointV2 to QgsPoint and QgsPoint to QgsPointXY
Because 3D coordinates should be the default.

References https://github.com/qgis/qgis3.0_api/issues/36
2017-06-02 19:53:37 +02:00
Nyall Dawson
32480fe8bd Fix tests 2017-05-30 08:48:55 +10:00
Nyall Dawson
aa376c2a1f Split ProviderTestCase into provider/source tests
There's now a FeatureSourceTestCase base class which handles
testing QgsFeatureSources for conformance. These tests
consist mostly of tests which where previously in
ProviderTestCase. ProviderTestCase now subclasses
FeatureSourceTestCase + adds tests which are specific
to QgsVectorDataProviders.
2017-05-25 20:48:00 +10:00
Blottiere Paul
9f8b92d329 Update unit tests for vector layer 2017-05-18 11:09:42 +02:00
Blottiere Paul
8a6137247a Remove the deep copy functionality 2017-05-18 11:09:41 +02:00
Blottiere Paul
c6f97e53de Add unit tests 2017-05-18 11:09:23 +02:00
Martin Dobias
23a7bd0fd9 Introduce QgsReadWriteContext that encapsulates QgsPathResolver
This should make the read/write methods more flexible if we need to give them extra context.
2017-05-13 18:09:26 +08:00
Martin Dobias
bbe59969b7 Fixes to unit tests 2017-05-13 18:02:58 +08:00
Nyall Dawson
730d10a153 Fix failing test 2017-03-14 17:27:45 +10:00
Juergen E. Fischer
c77172ed3d fix more flake8 warnings 2017-03-05 10:21:24 +01:00
Martin Dobias
7683cfacd3 Rework vector joins so they do not use QgsProject::instance()
The basic idea is to split reading of XML definition and resolution of layer IDs into layers.

Also includes some cleanups in QgsProject and improvements in QgsVectorLayerJoinInfo.
2017-01-31 09:33:02 +08:00
Martin Dobias
660867cb4e Explicitly pass QgsProject object when dealing with expression contexts
Continued effort to reduce number of uses of QgsProject as singleton...
2017-01-06 11:34:55 +08:00
Martin Dobias
d56a97d4fe Merge QgsMapLayerRegistry into QgsProject
All methods/signals of QgsMapLayerRegistry moved verbatim to QgsProject.
2016-12-10 15:18:12 +08:00
Harrissou Sant-anna
f9578bf60b Replace selectedFeaturesIds by selectedFeatureIds 2016-12-07 00:19:11 +01:00
Nyall Dawson
4682eaf6eb Add QgsVectorLayer::uniqueStringsMatching() to retrieve
a list of unique strings matching a substring for a field
2016-11-16 14:19:24 +01:00
Nyall Dawson
8cd810ed2c Return false from QgsVectorLayer::addFeatures if adding features failed 2016-11-08 12:54:25 +10:00
Nyall Dawson
fac5bc0691 [FEATURE] Field constraints can be enforced or not
Non-enforced constraints just show a warning to the user, but
do not prevent committing the feature. Enforced constraints
block users from comitting non compliant features.

Any constraints detected by the provider are always
enforced.
2016-11-02 13:42:22 +10:00
Nyall Dawson
cb94b68d88 Move constraint handling to QgsFieldConstraints
Avoids cluttering QgsField API
2016-11-02 11:07:07 +10:00
Nyall Dawson
2500d75f5e Move responsibility for storage of constraint expressions to QgsVectorLayer 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
bd9f672aa7 Allow constraints to be added at a QgsVectorLayer level 2016-11-02 11:07:07 +10:00
Nyall Dawson
2665eb50a6 Correctly handle edit buffer when using request with limit (fix ) 2016-10-12 16:31:49 +10:00
Nyall Dawson
3a76708bcb Fix renaming a virtual field leads to crash (fix ) 2016-10-09 09:03:52 +10:00
Matthias Kuhn
ff52a9f29b setAttributeAlias is now setFieldAlias 2016-10-01 15:39:03 +02:00
Nyall Dawson
d49b656055 Permantly convert python tests to python 3 2016-09-21 09:12:54 +10:00
Nyall Dawson
97d7b7339e Move storage of field alias and default value to QgsField
This is a partial implementation - QMaps are still used internally
within QgsVectorLayer to track the alias/default values
between attribute edit operations.

Sponsored by DB Fahrwegdienste GmbH
2016-08-30 12:40:55 +10:00
Nyall Dawson
4d5bae22b8 [FEATURE] Client side default field values
Allows an expression to be set for a vector layer field which
is used to evaluate a default value for this field.

A new method,
QgsVectorLayer::defaultValue( int index,
                              const QgsFeature& feature = QgsFeature(),
                              QgsExpressionContext* context = nullptr )
has been added which evaluates the default value for a given field
using the optionally passed feature and expression context. This
allows default values to utilise properties of the feature
which exist at the time of calling, such as digitized geometries.
The expression context parameter allows variables to be used
in default value expressions, making it easier to eg insert
a user's name, current datetime, project path, etc

Default values are set using QgsVectorLayer::setDefaultValueExpression()
and retrieved using defaultValueExpression()
2016-08-30 12:39:55 +10:00
Nyall Dawson
0f2723542b Python 3 update 2016-08-16 08:59:01 +10:00
Nyall Dawson
50c35929d8 Make QgsVectorLayer uniqueValues/min/maxValue consider edits
Previously these methods would inconsistently handle the
edit buffer, eg uniqueValues would consider changed attributes
but not added features. Now uniqueValues, minimumValue and
maximumValue all consider both added features and changed
attribute values when performing their calculation.

The most noticable effect of this fix is that the unique
values widget now correctly shows values for features which
have been added but not yet committed to the provider.
2016-08-16 07:57:15 +10:00