43 Commits

Author SHA1 Message Date
Alessandro Pasotti
7fa9bc1657 Typo 2019-02-19 14:46:41 +01:00
Alessandro Pasotti
348e6837ac Fix docs for createFeatures 2019-02-19 11:17:48 +01:00
Alessandro Pasotti
490c1fedfb Rename QgsFeaturesData to QgsFeatureData and fix test case 2019-02-19 10:51:53 +01:00
Alessandro Pasotti
ba3d9ed066 Cache unique values when creating features
Fixes #21305 - pasting features is very slow

Aggressively optimize createFeature for speed
and introduces createFeatures for bulk creation.
2019-02-19 10:02:17 +01:00
Matthias Kuhn
e968819d6e
More comprehensive API docs 2018-10-30 07:56:32 +01:00
Matthias Kuhn
1332e5c58e
Allow calling getFeatureSource without feedback 2018-10-29 16:15:35 +01:00
Matthias Kuhn
02ec785e1b
Fix deadlock in geometry validation
Fix a deadlock in geometry validation. This happens when the mainthread "waits for finished" of a checker thread.

What happened in this case was, that the main thread canceled the feedback and waited for any jobs to finish.
If a job was waiting for a feature source (or something else to be executed on the main thread) this resulted in a mighty deadlock.

What we do here is that we regularly check if we ought to cancel while waiting for our slot on the main thread and can bail out if we should cancel before the main thread gets around to take care of our function.
The difference is, we still execute the code on the background thread and make sure that the main thread is not doing anything during this time to avoid working on the same data structures in parallel.
2018-10-29 15:05:51 +01:00
Alessandro Pasotti
b34c461dc1 Drop const on makeFeatureComptible returned values 2018-09-25 08:24:49 +02:00
Alessandro Pasotti
a8dbb5395c Some minor changes
- QgsVectorLayer *
- make a const copy of a const container
- typo and comments
2018-09-25 08:17:14 +02:00
Alessandro Pasotti
8d82ce86cc makeFeatureCompatible on a single input feature 2018-09-25 08:17:14 +02:00
Alessandro Pasotti
7e8592bca2 Const correctness (because it's not an API break) 2018-09-25 08:17:14 +02:00
Alessandro Pasotti
3157af2eaa Revert const on createFeature
just because it would be an API break
2018-09-25 08:17:14 +02:00
Alessandro Pasotti
930c3f8e45 Port makeFeaturesCompatible to C++
as: QgsVectorLayerUtils::makeFeaturesCompatible

With tests.
2018-09-25 08:17:14 +02:00
Nyall Dawson
eacf4adb30 Dox++ 2018-09-25 08:49:21 +10:00
Nyall Dawson
a8794001e0 Add method to match feature attributes to the given fields
Refs #18784
2018-09-25 08:49:21 +10:00
Matthias Kuhn
17279a42e2 Only include qgsvectorlayer.h where required 2018-09-05 08:54:11 +02:00
Matthias Kuhn
86f429375d Doxygen 2018-09-05 06:42:59 +02:00
Matthias Kuhn
44ce8977d9 Use QPointer instead of QWeakPointer 2018-09-04 22:05:56 +02:00
Matthias Kuhn
d2f52bf400 Add threadsafe method to get featuresource from layer 2018-09-04 15:27:40 +02:00
Denis Rouzaud
0fa85bba1c put \since and \deprecated at the end of comment blocks 2018-05-28 10:39:34 -08:00
nirvn
715677ee5d move getValues, getDoubleValues to vector layer utils source file 2018-02-07 13:27:39 +07:00
Nyall Dawson
2682a74a1b Fix clazy pass big type by ref, small by value warnings 2018-02-02 19:52:01 +11:00
Nyall Dawson
2e6d125a6f Use =default, =delete where possible 2017-11-11 15:22:19 +10:00
Juergen E. Fischer
cfba4c4d09 fix windows build 2017-10-29 18:59:21 +01:00
David
3dbffb07a4 improved api doc 2017-10-26 10:28:42 +02:00
David
69f069a353 spelling stuff 2017-10-26 07:10:30 +02:00
David
82d94aad9d Add some api documentations for new functions 2017-10-25 19:32:33 +02:00
David
f7073d0587 [FEATURE] Duplicate features including children (one level deep) when relation strength is competition - configuration for the relationsstrength in the relation GUI [needs-docs] 2017-10-25 17:04:48 +02:00
Nyall Dawson
04a9cd9211 Add more consistency to doxygen formatting 2017-10-06 08:19:00 +10:00
Denis Rouzaud
1df3c51606 sipify batch 2017-05-22 10:12:08 +02:00
Nyall Dawson
dfb5f56f80 @see -> \see 2017-04-03 13:18:35 +10:00
Matthias Kuhn
fb91ed7395 Use "\since" instead of "@note added in" 2017-04-03 01:06:33 +02:00
Denis Rouzaud
40c056cae0 run astyle on src/core 2017-03-03 09:09:37 +01:00
Denis Rouzaud
0a63d1f2c2 [spellcheck] properly look into various cases and add more fixes" 2017-01-16 16:39:20 +01:00
Matthias Kuhn
b1e226c069 Add missing #include "qgis_core.h" 2017-01-05 16:49:00 +01:00
Harrissou Sant-anna
ef85cdcf83 Replace "eg" by "e.g." or "for example" 2016-12-30 00:03:22 +01:00
Nyall Dawson
b5864cd432 [FEATURE] Improve handling of defaults (inc provider default clauses,
literal defaults, and qgis expression defaults) and automatically
handle unique value constraints on layers

Add a new method QgsVectorLayerUtils::createFeature which returns
a new feature which includes all relevant defaults. Any fields
with unique value constraints will be guaranteed to have a value
which is unique for the field.

Currently only in use by the split feature tool.

Sponsored by Canton of Zug and the QGEP project
2016-11-16 14:19:24 +01:00
Nyall Dawson
747097d43d New method QgsVectorLayerUtils::createUniqueValue
Returns a new unique attribute value for a layer. For numeric
fields this is the max attribute value + 1, for strings we
attempt to create a unique value by append _1, _2, etc to either
a specified 'seed' value, or failing that to the end of the
value of that field from the first feature in the layer.
2016-11-16 14:19:24 +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
cb94b68d88 Move constraint handling to QgsFieldConstraints
Avoids cluttering QgsField API
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
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