Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop considering Rectangle(0,0,0,0) null - while Rectangle(1,1,1,1) is not null #54646

Merged
merged 4 commits into from
Oct 23, 2023

Conversation

strk
Copy link
Contributor

@strk strk commented Sep 18, 2023

Superceeds GH-53323

Aims at closing GH-45563

@github-actions github-actions bot added this to the 3.34.0 milestone Sep 18, 2023
@strk strk force-pushed the rectangle-null branch 2 times, most recently from 8b19439 to a60739f Compare October 2, 2023 10:03
@strk
Copy link
Contributor Author

strk commented Oct 4, 2023

Next failure is TestQgsLabelingEngine::testRegisterFeatureUnprojectible in tests/src/core/testqgslabelingengine.cpp which is reported as being a test for bug #23431

It looks like that test was written by myself in 4ed096b so I can't blame anyone else for missing comments (oops :)

@strk
Copy link
Contributor Author

strk commented Oct 4, 2023

Difference spotted is again an Empty vs. Null difference, in

tests/src/core/testqgslabelingengine.cpp:947 : (testRegisterFeatureUnprojectible) [1ms] vl2->extent(): Null

vl2->extent() prints as Empty in master branch, as Null in the branch associated with this PR

Honestly I don't know what the correct answer should be, as vl2 is a QgsVectorLayer started empty. An EMPTY Rectangle is defined as being a rectangle with no area (a point, at this moment, which I'd also extend to a line). But an empty layer cannot have a point information in it. I start wondering if we really need the distinction between EMPTY and NULL, for a rectangle.

@strk
Copy link
Contributor Author

strk commented Oct 4, 2023

Ok the Null vs. Empty is a non-issue as it's just an improved distinction output in the branch associated with this PR. Master would never print Null, always Empty, even for Null rectangles.

@strk
Copy link
Contributor Author

strk commented Oct 5, 2023

Next issue is with a WMS test of QGIS server that expects a GetFeatureInfoResponse having this bounding box:

 <BoundingBox maxy="0" maxx="0" miny="0" CRS="EPSG:3857" minx="0"/>

We're now outputting the -inf,+inf bounding box instead.

The question is: what is expected as a BoundingBox for a response with an empty bounding box ?

The file in question is https://github.com/qgis/QGIS/blob/master/tests/testdata/qgis_server/get_postgres_types_json_list.txt

@elpaso should we just omit the BoundingBox tag when the box is null ? What is the reference spec ?

@strk
Copy link
Contributor Author

strk commented Oct 5, 2023

I've filed PR #54858 to address the null BoundingBox in WMS output

@nyalldawson
Copy link
Collaborator

@strk

Can you open PRS for 0dc22c1,
d5d9e5c,
6372bae
And
c74837a

?

Those can all be merged now

@strk
Copy link
Contributor Author

strk commented Oct 7, 2023

@strk

Can you open PRS for 0dc22c1, d5d9e5c, 6372bae And c74837a

?

Those can all be merged now

Done in GH-54872 - I will rebase this one once that one is merged

@strk strk force-pushed the rectangle-null branch 2 times, most recently from 76a8ee9 to 0ff14a1 Compare October 11, 2023 23:23
@strk
Copy link
Contributor Author

strk commented Oct 12, 2023

I don't understand the "testExtent" test from tests/src/python/providertestbase.py:

    def testExtent(self):
        reference = QgsGeometry.fromRect(
            QgsRectangle(-71.123, 66.33, -65.32, 78.3))
        provider_extent = self.source.extent()
        self.assertAlmostEqual(provider_extent.xMinimum(), -71.123, 3)

How is assigning the "reference" local variable expected to affects self.source.extent() ?

@strk strk force-pushed the rectangle-null branch 2 times, most recently from baf8156 to 87b7dad Compare October 18, 2023 13:13
strk added a commit to strk/QGIS that referenced this pull request Oct 19, 2023
This was suggested by Benoit in
qgis#54646 (comment)

It may make it easier to spot missing isNull() checks by callers.
@strk strk added the API Break! Breaks stable API. Proceed with extreme caution!! label Oct 19, 2023
strk added 3 commits October 22, 2023 15:44
Expose these methods:
  - referenceExtent()
  - referenceSubsetString3Extent()
Construct a proper null rectangle by default.

Make sure a Null rectangle is always also considered Empty.

Print Null rectangle as Null, still print details of Empty rectangles.
Update expected QgsRectangle::toString output on Null rectangle

Includes unit tests

Closes qgisGH-45563
@strk
Copy link
Contributor Author

strk commented Oct 22, 2023

Nyall since this is now working, and has the default QgsRectangle constructor construct a null rectangle, should I re-move the ::createNull() in this PR ? I'd lean toward yes :)

@nyalldawson
Copy link
Collaborator

Woohoo! Nice work @strk!

@nyalldawson nyalldawson merged commit f426999 into qgis:master Oct 23, 2023
@strk strk deleted the rectangle-null branch October 23, 2023 07:42
strk added a commit to strk/QGIS that referenced this pull request Oct 23, 2023
strk added a commit to strk/QGIS that referenced this pull request Oct 31, 2023
@agiudiceandrea
Copy link
Member

Hi @strk, it seems to me this PR may have generated an issue in the "TIN interpolation" and "IDW interpolation" QGIS processing algorithms. Please see #55138.

ptitjano added a commit to ptitjano/QGIS that referenced this pull request Jan 22, 2024
According to the WFS 1.1.0 specs "The <WGS84BoundingBox> element is
used to indicate the edges of an enclosing rectangle in decimal
degrees of latitude and longitude in WGS84" but the expected behavior
is not specified when the data are empty.

Up to QGIS 3.32, QGIS server returned:
```
<ows:WGS84BoundingBox dimensions="2">
<ows:LowerCorner>0 0</ows:LowerCorner>
<ows:UpperCorner>0 0</ows:UpperCorner>
```

However, as a side effect of a change in `QGSRectangle` (see:
qgis#54646), QGIS server now returns
since the 3.34 version:
```
<ows:WGS84BoundingBox dimensions="2">
<ows:LowerCorner>inf inf</ows:LowerCorner>
<ows:UpperCorner>-inf -inf</ows:UpperCorner>
```

This changes restores the QGIS 3.32 behavior.
ptitjano added a commit to ptitjano/QGIS that referenced this pull request Jan 23, 2024
According to the WFS 1.1.0 specs "The <WGS84BoundingBox> element is
used to indicate the edges of an enclosing rectangle in decimal
degrees of latitude and longitude in WGS84" but the expected behavior
is not specified when the data are empty.

Up to QGIS 3.32, QGIS server returned:
```
<ows:WGS84BoundingBox dimensions="2">
<ows:LowerCorner>0 0</ows:LowerCorner>
<ows:UpperCorner>0 0</ows:UpperCorner>
```

However, as a side effect of a change in `QGSRectangle` (see:
qgis#54646), QGIS server now returns
since the 3.34 version:
```
<ows:WGS84BoundingBox dimensions="2">
<ows:LowerCorner>inf inf</ows:LowerCorner>
<ows:UpperCorner>-inf -inf</ows:UpperCorner>
```

This changes restores the QGIS 3.32 behavior.
nyalldawson pushed a commit that referenced this pull request Feb 1, 2024
According to the WFS 1.1.0 specs "The <WGS84BoundingBox> element is
used to indicate the edges of an enclosing rectangle in decimal
degrees of latitude and longitude in WGS84" but the expected behavior
is not specified when the data are empty.

Up to QGIS 3.32, QGIS server returned:
```
<ows:WGS84BoundingBox dimensions="2">
<ows:LowerCorner>0 0</ows:LowerCorner>
<ows:UpperCorner>0 0</ows:UpperCorner>
```

However, as a side effect of a change in `QGSRectangle` (see:
#54646), QGIS server now returns
since the 3.34 version:
```
<ows:WGS84BoundingBox dimensions="2">
<ows:LowerCorner>inf inf</ows:LowerCorner>
<ows:UpperCorner>-inf -inf</ows:UpperCorner>
```

This changes restores the QGIS 3.32 behavior.
qgis-bot pushed a commit that referenced this pull request Feb 1, 2024
According to the WFS 1.1.0 specs "The <WGS84BoundingBox> element is
used to indicate the edges of an enclosing rectangle in decimal
degrees of latitude and longitude in WGS84" but the expected behavior
is not specified when the data are empty.

Up to QGIS 3.32, QGIS server returned:
```
<ows:WGS84BoundingBox dimensions="2">
<ows:LowerCorner>0 0</ows:LowerCorner>
<ows:UpperCorner>0 0</ows:UpperCorner>
```

However, as a side effect of a change in `QGSRectangle` (see:
#54646), QGIS server now returns
since the 3.34 version:
```
<ows:WGS84BoundingBox dimensions="2">
<ows:LowerCorner>inf inf</ows:LowerCorner>
<ows:UpperCorner>-inf -inf</ows:UpperCorner>
```

This changes restores the QGIS 3.32 behavior.
qgis-bot pushed a commit that referenced this pull request Feb 2, 2024
According to the WFS 1.1.0 specs "The <WGS84BoundingBox> element is
used to indicate the edges of an enclosing rectangle in decimal
degrees of latitude and longitude in WGS84" but the expected behavior
is not specified when the data are empty.

Up to QGIS 3.32, QGIS server returned:
```
<ows:WGS84BoundingBox dimensions="2">
<ows:LowerCorner>0 0</ows:LowerCorner>
<ows:UpperCorner>0 0</ows:UpperCorner>
```

However, as a side effect of a change in `QGSRectangle` (see:
#54646), QGIS server now returns
since the 3.34 version:
```
<ows:WGS84BoundingBox dimensions="2">
<ows:LowerCorner>inf inf</ows:LowerCorner>
<ows:UpperCorner>-inf -inf</ows:UpperCorner>
```

This changes restores the QGIS 3.32 behavior.
lbartoletti pushed a commit that referenced this pull request Feb 2, 2024
According to the WFS 1.1.0 specs "The <WGS84BoundingBox> element is
used to indicate the edges of an enclosing rectangle in decimal
degrees of latitude and longitude in WGS84" but the expected behavior
is not specified when the data are empty.

Up to QGIS 3.32, QGIS server returned:
```
<ows:WGS84BoundingBox dimensions="2">
<ows:LowerCorner>0 0</ows:LowerCorner>
<ows:UpperCorner>0 0</ows:UpperCorner>
```

However, as a side effect of a change in `QGSRectangle` (see:
#54646), QGIS server now returns
since the 3.34 version:
```
<ows:WGS84BoundingBox dimensions="2">
<ows:LowerCorner>inf inf</ows:LowerCorner>
<ows:UpperCorner>-inf -inf</ows:UpperCorner>
```

This changes restores the QGIS 3.32 behavior.
strk added a commit to strk/QGIS that referenced this pull request Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Break! Breaks stable API. Proceed with extreme caution!!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants