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

[BUGFIX][Server] In GetPrint, legend as to be fixed when it is not auto update or filter by map #7232

Merged

Conversation

rldhont
Copy link
Contributor

@rldhont rldhont commented Jun 13, 2018

Description

In release-2_14, a legend is fixed when it is not linked to a map. In
release-2_18, a leganed as to be fixed when it is not auto update or filter
by map.

Actually a legend with no auto update and a layer missing in the request, the
missing layer is repalced by (?)

It's fixed a regression in some.

Checklist

  • Commit messages are descriptive and explain the rationale for changes
  • I have read the QGIS Coding Standards and this PR complies with them
  • This PR passes all existing unit tests (test results will be reported by travis-ci after opening this PR)
  • I have run the scripts/prepare-commit.sh script before each commit

@rldhont
Copy link
Contributor Author

rldhont commented Jun 13, 2018

@gioman I think this PR will interested you.

@gioman
Copy link
Contributor

gioman commented Jun 13, 2018

@rldhont thanks! yes, I was vocal about this regression, but I don't think I was the only one affected. To be sure: does this re-introduce a way to select "none" as map object for a specific legend in the map composer? or us fixes the "?" showing when doing the GetPrint requests?

@rldhont
Copy link
Contributor Author

rldhont commented Jun 13, 2018

If you uncheck auto-update, the legend becomes fix like when you select "none" as map.

@gioman
Copy link
Contributor

gioman commented Jun 13, 2018

If you uncheck auto-update, the legend becomes fix like when you select "none" as map.

@rldhont that's the problem: "none" as option has been removed without any previous discussion in one of the first point releases of 2.18

@rldhont
Copy link
Contributor Author

rldhont commented Jun 13, 2018

none is not the problem, because, the legend is only filter by map if check the options. In the other case, the map context is not used.

@gioman
Copy link
Contributor

gioman commented Jun 13, 2018

none is not the problem, because, the legend is only filter by map if check the options. In the other case, the map context is not used.

@rldhont I'm not sure if I'm understanding but I'll give it a try with the patch and let you know. Thanks again.

@rldhont
Copy link
Contributor Author

rldhont commented Jun 13, 2018

I have try the option auto-update and filterByMap and only filterByMap using the linked map. But it's probably an other issue.

@pblottiere
Copy link
Member

Hi @rldhont!

Code LGTM but can you add a unit test to highlight the bugfix please?

However, I don't know the underlying mechanism with auto-update or filterByMap, so I leave @gioman judge :).

@gioman
Copy link
Contributor

gioman commented Jun 15, 2018

Trying to compile to test the patch.

@rldhont
Copy link
Contributor Author

rldhont commented Jun 15, 2018

This probably fixed this issue https://issues.qgis.org/issues/16899
Print composer: "none" value for the "map" option of a composer legend is not available anymore in 2.18.10 > no more fixed legends with QGIS Server GetPrint

@gioman
Copy link
Contributor

gioman commented Jun 17, 2018

@rldhont I tested your patch.

I was mistaken when I said (i.e. on Redmine) that the "none" value (for the "map" option in the legend properties of the map composer) was removed sometime at the beginning of the the 2.18 cycle, in fact I compiled also 2.18.0 and the option isn't there.

But compiling 2.18.0 was useful because it allowed me to understand that the problem (or "a" problem) also lies how the project were saved in early 2.18 releases and how they are in later ones.

To make things more clear I used LM to create the GetPrint requests and the Montpellier demo project with only the "Quartiers" and "Buildings" layers active (all the others not active).

All layouts where tested with the "auto-update" option of the legend disabled.

  1. if the project is saved and served with 2.18.0 then the GetPrint results are always the expected ones

a) with "filter legend by map content" OFF

screenshot_20180616_135632

b) with "filter legend by map content" ON

screenshot_20180616_135624

c) and even with "filter legend by map content" OFF and map=none, by manually editing the project file as this option is not available anymore in the GUI. This is the "fixed" legend I'm speaking about, and manually editing the project file (to tweak the legend object) is the only way to get again this in GetPrint with QGIS 2.18

screenshot_20180616_135611

  1. With the project saved in 2.18.0 and served in 2.18.20 (with the patch) the result for the case

b) with "filter legend by map content" ON

is different from the above one, and it actually seems to show a "fixed legend" behavior, which in my opinion is not correct in this case (if the filter for legend is on it should really show only the layers visible on map):

screenshot_20180617_100938

with results for a) and c) identical to the ones in the first scenario

  1. If the project is saved in 2.18.20 and served in 2.18.20 (with the patch or without) the results are only correct for the case b)

screenshot_20180617_101229

while for a) and c) are equals and show the "?" behavior

screenshot_20180617_101244

@rldhont
Copy link
Contributor Author

rldhont commented Jun 17, 2018

Hi @gioman for the review.

Firstly, you need the PR #7250 this one fixed "filter legend by map content" ON.

For the other case, I'll test it and update this PR.

@gioman
Copy link
Contributor

gioman commented Jun 17, 2018

Firstly, you need the PR #7250 this one fixed "filter legend by map content" ON.

@rldhont I also applied this patch, and for a project saved and served with 2.18.20 (with the patches) I don't see any difference from my previous report: with "filter legend by map content" ON result is ok, without the "?" are shown and there no option to select "none" as value for the legend "map" configuration (but even editing the project manually the result is still wrong with the "?").

Thanks for tackling this.

…to update or filter by map

In release-2_14, a legend is fixed when it is not linked to a map. In
release-2_18, a legend as to be fixed when it is not auto update or filter
by map.

Actually a legend with no auto update and a layer missing in the request, the
missing layer is repalced by `(?)`

It's fixed a regression in some.

To fix this regression, layers needed in legen composer has to be loaded
before the composer items has been parsed.
@rldhont rldhont force-pushed the server-wms-getprint-fix-legend-218 branch from 8709ab0 to e991380 Compare June 18, 2018 07:17
@rldhont
Copy link
Contributor Author

rldhont commented Jun 18, 2018

@gioman I have found why we have (?) in legend. All the layers has to be loaded before, the composer legends are parsed.

I update my commit to fix it.

Now I have to fix the "auto-update" option of the legend enabled. Actually the legend is empty!

@rldhont rldhont merged commit 9f01039 into qgis:release-2_18 Jun 21, 2018
@rldhont rldhont deleted the server-wms-getprint-fix-legend-218 branch January 2, 2020 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants