2842 Commits

Author SHA1 Message Date
Nyall Dawson
b0bd61f308 [FEATURE] Detect default literal values from OGR layers
Requires GDAL >= 2
2016-11-08 08:18:16 +10:00
Nyall Dawson
0ae610c5e3 [FEATURE] Detect literal default values for spatialite provider 2016-11-08 08:18:16 +10: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
Nyall Dawson
3c530a62e5 Merge pull request #3723 from nirvn/regexp_matches
[FEATURE] add regexp_matches() function
2016-11-07 14:34:27 +10:00
nirvn
1d245b2ef6 [FEATURE] add regexp_matches() function
The new function returns an array of strings captured by capturing
groups in a supplied regular expression. For e.g., the following
expression: regexp_matches('qgis=>rocks','(.*)=>(.*)')
will return the following array: 'qgis', 'rocks'.
2016-11-07 10:47:19 +07:00
Nyall Dawson
8acc286b0f [FEATURE] Snap to layer algorithm accepts a mode parameter
With a new option to prefer to snap to closest point on geometry.
The old behaviour was to prefer to snap to nodes, even if a node
was further from the input geometry than a segment. The new option
allows you to snap geometries to the closest point, regardless
of whether it's a node or segment.
2016-11-07 12:20:59 +10:00
Nyall Dawson
983fe24806 Port some API from QgsPoint to QgsPointV2 2016-11-07 12:20:59 +10:00
Nyall Dawson
dae0a01761 [FEATURE][processing] Snap geometries algorithm allows snapping
to other layer types, supports point/line layers

Fix #14791, #15313
2016-11-07 12:20:59 +10:00
Alessandro Pasotti
a0e0fcf9a9 [tests] WMS/WFS PKI authentication test 2016-11-04 12:09:57 +01:00
Alessandro Pasotti
16a88e6c36 Merge pull request #3719 from elpaso/auth_tests_more_master
Auth tests more master
2016-11-04 11:36:18 +01:00
Alessandro Pasotti
f587defde2 [tests][bugfix] Check for result diff existance before accessing to it 2016-11-04 09:50:34 +01:00
Alessandro Pasotti
f582849ca7 [tests] Authmanager Postgres PKI test 2016-11-04 09:46:17 +01:00
Nyall Dawson
9a2ca1cebd Merge pull request #3673 from nyalldawson/constraints
[FEATURE] Improved constraint handling, pt 1
2016-11-04 10:34:15 +10:00
nirvn
769c82b579 [pal] fix curved labels failure with zero-width characters
(fixes 15801)
2016-11-03 13:35:51 +07:00
Even Rouault
06dc501139 test_provider_ogr_gpkg.py: Test disabling walForSqlite3 setting 2016-11-02 12:40:20 +01:00
Nyall Dawson
3f2a7810cf Respect non-enforced constraints when editing/adding features
Warnings are shown, but features can be committed. Fields which
fail an unenforced constraint are now shaded in yellow to differentiate
from the red failure for enforced constraints.
2016-11-02 13:42:22 +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
e3a608365f fix test 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
003fe1830c Color a few pixels slightly differently 2016-11-02 11:07:07 +10:00
Nyall Dawson
bb6fc32eec [FEATURE] Not null constraint detection for ogr provider
Implements not null constraint detection for the OGR layers, where
supported for the data format by OGR.

(only available for GDAL >= 2.0)
2016-11-02 11:07:07 +10:00
Nyall Dawson
210c98bedc Fix failing unit test 2016-11-02 11:07:07 +10:00
Nyall Dawson
a6319a47d7 If the layer is NOT being edited then only check layer based constraints
and not any constraints enforced by the provider

Because:

1. we want to keep browsing features nice and responsive. It's nice to give
 feedback as to whether the value checks out, but not if it's too slow to
 do so. Some constraints (eg unique) can be expensive to test. A user can
 freely remove a layer-based constraint if it proves to be too slow to
 test, but they are unlikely to have any control over provider-side
 constraints

2. the provider has already accepted the value, so presumably it doesn't
 violate the constraint and there's no point rechecking!
2016-11-02 11:07:07 +10:00
Nyall Dawson
c98d380dc1 Move responsibility for testing for attribute against constraints
to QgsVectorLayerUtils::validateAttribute()

Also clean up some strings shown to the user when a constraint
check fails
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
b7d0fd6f90 New class QgsVectorLayerUtils
Contains static helper methods for working with vector layers.
Initially only contains a method to test whether a value
exists within a layer's attributes.
2016-11-02 11:07:07 +10:00
Nyall Dawson
3e40f803c3 Implement constraint detection for spatialite provider 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
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
57a57545a0 Add test for QgsFeatureRequest.setLimit and feature variable 2016-11-02 09:39:59 +10:00
Nyall Dawson
fb849620e7 Avoid unexpected gpkg test success with older GDAL versions 2016-11-02 09:39:59 +10:00
Patrick Valsecchi
667718bc89 [feature] Editor widget auto config for foreign keys (#3699)
Automatically pick RelationReference widgets for foreign keys.
2016-11-01 08:36:21 +01:00
Martin Dobias
5e4bb00fa3 Fix import of shapefiles to postgres - regression introduced in 5abdfcb (#3652)
(cherry picked from commit a965a132c52df9308b5a58be92c04a285826485a)
2016-11-01 11:41:23 +08:00
Martin Dobias
b798040040 Fixed legend renderer expected images 2016-11-01 11:41:23 +08:00
Matthias Kuhn
6d387650f4 More test for referencedVariables 2016-10-31 14:24:34 +01:00
Martin Dobias
24fbe1a080 Fix crash in node tool after deleting the whole geometry (fixes #15659)
Made sure that both closestVertex() and closestSegment() return negative
distance on error (e.g. with null or emtpy geometry).

Also fixes snapping when dealing with layers with null/invalid geometries

(cherry picked from commit c093d5188fad685c4a596ff23c27aad7d151dac2)
2016-10-31 12:51:21 +08:00
Nyall Dawson
2b545822e7 [FEATURE] New expression function 'extend'
Extends linestrings by a specified amount at the start and
end of the line
2016-10-31 07:56:24 +10:00
Nyall Dawson
ef34e393dc Add method to QgsGeometry to extend the start/end of a linestring 2016-10-31 07:56:24 +10:00
Matthias Kuhn
7a05a7a8c4 Fix caching of aggregate values with @parent
And add a test for referencedVariables
2016-10-28 12:31:40 +02:00
nirvn
17fc7dbe53 [FEATURE] add array_distinct() function 2016-10-28 10:51:14 +07:00
Matthias Kuhn
0b3646b252 Expression functions can dynamically report geometry and columns 2016-10-27 23:11:51 +02:00
Matthias Kuhn
f292fdd625 Add test for @parent aggregate filter 2016-10-27 23:11:51 +02:00
Nyall Dawson
fb4578131f Merge pull request #3678 from nirvn/string_to_array_to_string
[FEATURE] add string_to_array() and array_to_string() functions
2016-10-28 04:44:25 +10:00
Matthias Kuhn
01f3c9ae38 [FEATURE] Add is_selected and num_selected functions
* is_selected() returns if the current feature is selected
* num_selected() returns the number of selected features on the current layer
* is_selected(layer, feature) returns if the "feature" is selected. "feature"
  must be on "layer".
* num_selected(layer) returns the number of selected features on "layer"
2016-10-27 17:24:15 +02:00
Matthias Kuhn
f52dfba21e [expressions] Variable length arguemnt functions accept 0 params 2016-10-27 17:24:15 +02:00
nirvn
7373036edf [FEATURE] add string_to_array() and array_to_string() functions 2016-10-27 22:12:59 +07:00
Even Rouault
984ec65fcd [DBManager GPKG] Set appropriate icon for line layers 2016-10-27 15:59:57 +02:00
nirvn
3fb2d9e4e3 [expression] further improve replace() to support a map argument 2016-10-27 11:33:28 +07:00