This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Custom datasource for raster

Tags: None
(comma "," separated)
Registered Member

Custom datasource for raster

Mon Dec 07, 2015 2:11 am
I'm trying to draw raster data from a custom datasource which serves a QImage in return for tile coordinates and zoom level, or some other specification of the required geography. It is under my control so I can adapt it, but it isn't a web server: it's a C++ class which generates procedural raster data instead of serving saved maps.

The "Marble Secrets" architecture descriptions contain the following apparently helpful remarks (contemplating the use of one's own database, not dissimilar to my problem).

"If you're a real GIS person you might wonder whether it's possible to just replace this HttpDownloadManager with something "more sane" - like an enterprise database that has this data stored already. Yes, a suitable solution might be available in marble/src/lib/MarbleWidget.{cpp,h} where you'll find a method called: void MarbleWidget::setDownloadManager( HttpDownloadManager *downloadManager );
(soon to be changed to "AbstractTileProvider"). Just replace the HttpDownloadManager pointer with a pointer to your very own custom TileProvider class."

Based on that then I would make a subclass of HttpDownloadManager, overriding it to obtain data from my C++ class instead of the provided URL, receive a QImage and return that. The problem is that, according to the changelogs, soon after the above article was written (in 2007), the developers did away with MarbleWidget::setDownloadManager (HttpDownloadManager*), and it is seemingly no longer a straightforward matter to replace this with an alternative TileProvider as suggested.

I tried putting my procedural tile generator behind an http: web service and running that on localhost so I could connect to that just as though it were a URL using the existing architecture unchanged. This had the attraction that it would be possible to separate the UI from the model, perhaps running them on separate machines. But it was very slow, my class generates a 256x256 tile in 0.1 seconds on my machine but the web server takes another 0.3 seconds to write it to the output stream and then it's another quarter of a second to pipe it back to a QImage. I'd therefore really just like to build a QImage from procedural data and pass a pointer to it back to the TileProvider for use in the map.

Can anyone suggest how nowadays one should go about replacing the native HttpDownloadManager with an alternative implementation along the lines proposed in Marble Secrets?


Who is online

Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], mesutakcan, Sogou [Bot]