[QGIS-Developer] Empty vs. Null rectangle, bogus ?

Sandro Santilli strk at kbt.io
Mon Oct 18 11:05:22 PDT 2021


Still chasing bug
QgsVectorLayerFeatureIterator::QgsVectorLayerFeatureIterator
I reached QgsRectangle, whose "Null" or "Empty" nature changes
behavior of QgsFeatureVectorFeatureIterator in a way that prevents
proper WithinDistance filter from working.

Details are written in
https://github.com/qgis/QGIS/issues/45352
but what I wanted to ask here is:

According to the comments Empty means that some information is still
available (bounding box of a point) but the unit test for QgsRectangle
(and the isEmpty method implementation) seem to check for Max < Min,
which would NOT be the case for the bounding box of a point,
so is puzzling.

I'm not sure how to proceed for fixing the bug I'm seeing because
one simple fix would be avoiding to call setRectangle on a QgsRequest
if the iterator's mFilterRect is Empty, but a more complex solution
could be to *allow* those QgsRequests to have multiple filters, rather
than one excluding the other.

Also I've yet to understand WHY at construction time a
QgsAbstractFeatureIterator shoul dhave an Empty rather than Null
rectangle, which brings back to the first question (is the distinction
really defined?).

--strk; 

  Libre GIS consultant/developer
  https://strk.kbt.io/services.html


More information about the QGIS-Developer mailing list