Bug 310464 - Support remote images/icons
Summary: Support remote images/icons
Status: RESOLVED FIXED
Alias: None
Product: marble
Classification: Applications
Component: general (show other bugs)
Version: 1.6 (KDE 4.11)
Platform: unspecified Linux
: NOR task
Target Milestone: ---
Assignee: Abhinav Gangwar
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2012-11-21 21:05 UTC by Dennis Nienhüser
Modified: 2014-07-13 10:10 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
RemoteIcon.zip (3.89 KB, application/zip)
2012-11-28 10:55 UTC, Dennis Nienhüser
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Nienhüser 2012-11-21 21:05:25 UTC
Currently only local images can be specified in .kml files, but the kml reference allows remote ones as well. A basic version would support absolute URIs (starting e.g. with http://), more advanced would be to resolve them relative to the .kml location (which could be remote).
Comment 1 Dennis Nienhüser 2012-11-28 10:55:50 UTC
Created attachment 75515 [details]
RemoteIcon.zip

The .zip contains two .kml files and an icon. Rabet.kml uses a remote icon, Rabet_local.kml the icon from the .zip. Currently Marble display the icon for Rabet_local.kml only.
Comment 2 Dennis Nienhüser 2012-11-28 11:09:16 UTC
To support remote icons, a good place to start making modifications is 
QImage GeoDataIconStyle::icon() const
in src/lib/geodata/data/GeoDataIconStyle.cpp

Ideally I'd like to see a new class RemoteIconLoader which is used by GeoDataIconStyle to load icons in the background. This class should use HttpDownloadManager from Marble or QNetworkAccessManager from Qt to download passed URLs and create an icon from it. This icon should then be stored in GeoDataIconStylePrivate::m_icon.

More thoughts:
- The RemoteIconLoader should be shared among all GeoDataIconStyle instances. Possibly making it a static member is enough
- Caching of icons in memory would be nice to avoid downloading the same icon several times
- Caching icons on disk might be nice to avoid downloading the same icon several times over subsequent executions of Marble (HttpDownloadManager would make that very easy)
- The download must be asynchronous, and icon() will return a null icon because of that the first time it is queried. Ideally we find a way to signalize the change of the icon when the download is finished to have it available everywhere
Comment 3 Dennis Nienhüser 2013-03-12 12:24:27 UTC
Note that there's a patch in https://git.reviewboard.kde.org/r/107846/
I haven't tested it yet.
Comment 4 Abhinav Gangwar 2014-02-26 21:12:23 UTC
I want to work on this task
Comment 5 Abhinav Gangwar 2014-07-13 10:10:00 UTC
Git commit 0857ab2bf7923bb42f3393fb091513165c90475c by Abhinav Gangwar.
Committed on 13/07/2014 at 10:02.
Pushed by agangwar into branch 'master'.

Added support to download remote images
specified in <Icon> tag.

REVIEW: 116525

M  +1    -0    src/lib/marble/CMakeLists.txt
M  +1    -0    src/lib/marble/PlacemarkLayout.cpp
A  +163  -0    src/lib/marble/RemoteIconLoader.cpp     [License: LGPL]
A  +52   -0    src/lib/marble/RemoteIconLoader.h     [License: LGPL]
M  +19   -0    src/lib/marble/VisiblePlacemark.cpp
M  +10   -1    src/lib/marble/VisiblePlacemark.h
M  +26   -2    src/lib/marble/geodata/data/GeoDataIconStyle.cpp
M  +3    -0    src/lib/marble/geodata/data/GeoDataIconStyle.h

http://commits.kde.org/marble/0857ab2bf7923bb42f3393fb091513165c90475c