C

Map tile fetcher integration (Technical Preview)

Implementing a map tile fetcher integration for Qt Quick Ultralite

An application that uses the Map item from Qt Quick Ultralite Location has to implement the Qul::MapTileFetcher class to fetch a map tile image from offline external storage, eg: SD card or eMMC, or from online service provider. The implementation has to be registered with the application using Qul::Application::addMapTileFetcher.

Check the map example for a reference implementation for fetching map tiles from offline external storage.

To provide a map tile image, implement the Qul::MapTileFetcher::getTileImage function:

class MyTileFetcher : public Qul::MapTileFetcher
{
public:
    bool getTileImage(const Qul::Private::TileSpec &spec, Qul::Private::TileImage &tileImage) override
    {
       // compose a tile address using zoom, x and y information provided from spec parameter
       // fetch a tile image
       // copy the tile image into Qul::PlatformInterface::Texture object.
    }
}

To make the implemented map tile fetcher known to Qt Quick Ultralite, it has to be registered with the application.

static MyTileFetcher tilefetcher;
Qul::Application::addMapTileFetcher(&tilefetcher);

Qt Quick Ultralite will iterate all registered map tile fetchers to call the getTileImage function until the first returns true.

Available under certain Qt licenses.
Find out more.