Re: [QGIS-Developer] Default QgsFeatureFid ?

2021-10-15 Thread Sandro Santilli
On Fri, Oct 15, 2021 at 01:41:59PM -0400, Greg Troxel wrote: > > Sandro Santilli writes: > > > On Fri, Oct 15, 2021 at 08:12:07AM -0400, Greg Troxel wrote: > > > >> There's a larger question lurking behind that, which is something about > >> if tables in SQL can have NULL values and how that NUL

Re: [QGIS-Developer] Default QgsFeatureFid ?

2021-10-15 Thread Greg Troxel
Sandro Santilli writes: > On Fri, Oct 15, 2021 at 08:12:07AM -0400, Greg Troxel wrote: > >> There's a larger question lurking behind that, which is something about >> if tables in SQL can have NULL values and how that NULL is mapped into >> qgis's main internal representation and then back out t

[QGIS-Developer] QgsFeatureSource::getFeatures - why returning Iterator by value instead of pointer ?

2021-10-15 Thread Sandro Santilli
I'm still trying to understand why a QgsFeatureRequest that's being built with a DistanceWithin filter ends up loosing that at some point and reached the point in which: QgsFeatureIterator QgsPostgresFeatureSource::getFeatures( const QgsFeatureRequest &request ) Is returning: return Q

Re: [QGIS-Developer] Default QgsFeatureFid ?

2021-10-15 Thread Sandro Santilli
On Fri, Oct 15, 2021 at 08:12:07AM -0400, Greg Troxel wrote: > There's a larger question lurking behind that, which is something about > if tables in SQL can have NULL values and how that NULL is mapped into > qgis's main internal representation and then back out to various > formats. (I know the

Re: [QGIS-Developer] Default QgsFeatureFid ?

2021-10-15 Thread Greg Troxel
Sandro Santilli writes: > On Fri, Oct 15, 2021 at 10:45:52AM +0200, Alessandro Pasotti wrote: >> Hi, >> >> maybe you can use >> >> #define FID_NULLstd::numeric_limits::min() > > Maybe, but the question is more generic: *should* a QgsFeatureId have > a default value ? There's a lar

Re: [QGIS-Developer] Default QgsFeatureFid ?

2021-10-15 Thread Alessandro Pasotti
IMO the default value should be FID_NULL, IIRC 0 is a valid fid for some providers. On Fri, Oct 15, 2021 at 11:50 AM Sandro Santilli wrote: > On Fri, Oct 15, 2021 at 10:45:52AM +0200, Alessandro Pasotti wrote: > > Hi, > > > > maybe you can use > > > > #define FID_NULLstd::numeric_lim

Re: [QGIS-Developer] Default QgsFeatureFid ?

2021-10-15 Thread Sandro Santilli
On Fri, Oct 15, 2021 at 10:45:52AM +0200, Alessandro Pasotti wrote: > Hi, > > maybe you can use > > #define FID_NULLstd::numeric_limits::min() Maybe, but the question is more generic: *should* a QgsFeatureId have a default value ? In that case maybe we could change its definition fro

Re: [QGIS-Developer] Default QgsFeatureFid ?

2021-10-15 Thread Alessandro Pasotti
Hi, maybe you can use #define FID_NULLstd::numeric_limits::min() On Fri, Oct 15, 2021 at 10:40 AM Sandro Santilli wrote: > While writing unit test for QgsFeatureRequest in core I found > that the filterFid() method for the default-constructed > QgsFeatureRequest returns -1 rather

[QGIS-Developer] Default QgsFeatureFid ?

2021-10-15 Thread Sandro Santilli
While writing unit test for QgsFeatureRequest in core I found that the filterFid() method for the default-constructed QgsFeatureRequest returns -1 rather than what a default-constructed QgsFeatureId() would return (0) So I've been wondering: *should* a QgsFeatureFid have a default value of -1 inst