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
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'.
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.
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.
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.
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!
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.
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)
* 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"