Long story short: calling provider's addFeatures
is implemented for some providers in a way that
will roll back all changes on errors, leaving
the backend storage unchanged.
Adding a QgsFeatureSink flag to control this
behavior allows certain providers to support
partial feature addition.
The issue comes from QgsVectorDataProvider::commitChanges
that is documented to leave the provider unchanged (roll
back) on any error, giving the client code the possibility
to fix errors (in the editing buffer) and re-commit.
Without a full rollback implementation in the memory
provider and after the type check introduction in this
PR we ended up with situations like this:
vl = ... an empty memory layer
self.assertTrue(vl.addFeatures([valid, invalid]))
self.assertFalse(vl.commitChanges())
self.assertEqual(vl.featureCount(), 1) <--- fails!
We actually had 3 features from vl.getFeatures():
[valid, invalid, valid] (the first from the provider
the second and third from the editing buffer).
On the other hand, QgsFeatureSink would probably assume
that addFeatures will allow partial additions.
BTW: This is for sure the longest commit message I've ever
written.
Fixes#36715
Adds a method to check for QVariant conversions, also
check for integral type narrowing so that for example
floating point 123.45 does not get down casted to integer
without raising an error.
Also
* in settings UI, add a 'Early resampling' checkbox
* in raster properties UI, add similar checkbox
* serialize/deserialize new settings in QgsRasterLayer XML
Fixes#36820
The way QGIS is currently handling resampling is sub-optimal given GDAL >= 2
capability of having sub-pixel accuracy. So when a QgsRasterResampleFilter
is set, make it try to delegate resampling back to the underlying input interface,
and implement that improved resampling in the GDAL provider.
The GDAL resampling will take into account the settings of the QGIS resample
filter: zoom-in resampling kernel, zoom-out resampling kernel and max resampling
factor. The later is important to avoid performance issues if not enough overview
levels are generated (in the case, we will fallback to the generic method, which
may introduce sub-pixel shifts)
occurring for drawing a symbol preview
Because these have no map association, certain settings like
sizes in "meters in map units" will have no meaning, and may need
special handling
Refs #28690
The issue was that renderer/labeling were only keeping "their" required fields,
but the final fields may have been extended by the other, making the field indices
cached in expressions invalid.
The fix is to keep the final QgsFields around and avoid creating those QgsFields on-the-fly
from previously requested fields.
Adds a layer + coordinateTransform context to pass
to the ogc utils functions that read the GML geometry
so that it can be transformed to layer's CRS when
constructing the feature filter.
Fixes#36398
refresh of ALL browser content
Instead limit refresh to the provider associated with the item only
(and provide a means for items to refresh a different provider, e.g.
to allow the geopackage connection item to be refreshed when a
new connection is added through a directory item)
Fixes#37007