-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add support for map-contextual WMS legend #1735
Conversation
TODO:
|
The new commits ensures legend is not fetched again while not expanded, implementing the lazy loading approach suggested by @wonder-sk TODO:
|
Per-layer configuration implemented with last commit (at add WMS layer level). TODO:
|
NOTE: @nyalldawson suggested to use an existing class, already tested, in place of the QgsImageDownloader. Nyall, could you take a look at my interface to see how you like it ? https://github.com/strk/QGIS/blob/wmslegend/src/core/raster/qgsrasterdataprovider.h#L51-L72 I guess it could be renamed to QgsImageFetcher ... The class you suggested is this one: |
With the latest commit I'm also happy with the autoredrawing of the legend. So the only left over is the test for composer. |
@strk I'm strongly of the opinion that QgsImageFetcher should be merged with QgsNetworkContentFetcher. The intention with QgsNetworkContentFetcher is to collect all the various implementations of handling redirects, authorisation, conversion of replies to different formats, etc which are currently scattered and duplicated throughout QGIS, so it'd be good to get this image handling added to that class rather then reimplemented here. It's a pretty straightforward change:
What's your thoughts? I'd definitely find this useful in composer, as it would allow me to remove some extra duplicated code for downloading images which is present there. |
I've tested composer to also work, so I think I'm done with this.
|
@nyalldawson my ImageFetcher class is virtual, and that allows me to provide a Fetcher that basically returns an already-available (cached) WMS legend. That kind of feature is not possible with the NetworkContentFetched (it needs be a virtual interface for that to work). |
I've rebased the branch to master and force-pushed here |
Final squash and forced update. Ready for master merge. |
A question to strk (and to all)... reading the code of ImageFetcher is architectural similar to the old code of getLegendGraphic that was modified due to MT adding an internal eventLoop. My question is, if imageChecher works, there is a structural problem or use case in getLegendGraphic that overcomplicate it's code, or ther is something in imageFetcher that is not considered. |
Who (or what) is RT ? |
@luipir if that answers your question, the difference between ImageFetcher and getLegendGraphic is that the former is asyncrhonous while the latter (pre-existing one) was syncrhonous. |
I've added another commit to report download progress |
@wonder-sk the latest commit here reverts the hack of invoking the recursive dataChanged emission by properly emitting dataChanged from WMSLegendNode::invalidateMapBasedData. There should be nothing more pending here as far as I can tell. |
I haven't had time yet to inspect the code in detail. (and I will be on holiday for the next 10 days) But in general please:
Also I believe the newly adopted QEP process expects that a QEP is first accepted before the work based on the QEP is merged. |
Ok, I'll indent, drop sponsor name from code, squash and force a push of a single commit again. The QEP, for reference, is here: qgis/QGIS-Enhancement-Proposals#15 |
Developed with funding from Regione Toscana SITA (CIG: Z410C90D94)
I'd like to merge this to master before end of the year. |
@strk I'm happy for there to be no QEP for something like this. I know it's a bit hard to tell at times what does and doesn't need a QEP. So feel free to close the QEP and we can just work of this PR for comments. (again sorry it took me this long to raise that) The code looks good to me but that isn't really my area and I don't have anything to test with. I need to talk to Martin tonight about some other things so let me see what he says. |
Thanks Nathan, QEP closed. Looking forward to Martin's response. |
Add support for map-contextual WMS legend
@strk @wonder-sk I have merged this for now so we can get some wider testing on it. I didn't see any real issues with it from me looking over it. @strk it would be nice to see the points that Nyall raised considered, no point having duplicate logic for the same kind of thing if we can avoid it. Do you have any more time/money to make those tweaks? |
I've commented about Nyall points in a comment: Basically I don't see it possible to merge the two classes. Eventually it could be that the new class internally uses an enhancement version of the old one. New one is still needed as a virtual interface. |
See http://hub.qgis.org/issues/11859