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).
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.
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
Note that there's a patch in https://git.reviewboard.kde.org/r/107846/ I haven't tested it yet.
I want to work on this task
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