Qt Location JsonDb pluginOverviewIncluded with Qt Location is a plugin which stores places in a Json Database (aka JsonDb). This plugin is intended to be used as a local store for user defined favorite places. The JsonDb GeoServices plugin can be loaded by using the plugin key "nokia_places_jsondb". Note that in order to use this plugin, the JsonDb daemon must be running in the background. ParametersThe following table lists optional parameters that can be passed to the Nokia plugin.
PlacesThe Nokia JsonDb provider accesses places stored locally on device. It provides read/write access to the place repository. The specific capabilities are outlined below: Capabilities
Plugin Specific BehaviorsSearchThe following list shows what core place data is returned during a place search:
The JsonDb plugin does not support any other details so all available details are fetched during a search. The JsonDb plugin does not support saving of any other details. IconsParameter ReferenceThe JsonDbPlugin supports the following icon parameter values
In C++ the value of the URLs must always be a QUrl. In QML the values of the URLs may be url or string types. Typical UsageDuring a typical place search, the icon parameters might be populated like so smallUrl: file:///foo/bar/icon_s.png smallSize: QSize(20,20) largeUrl: file:///foo/bar/icon_l.png largeSize: QSize(50,50) Only small and large icons were available in this case. Note that for a given size URL, its dimensions will also be populated. These URLs and dimensions are used by the JsonDb plugin to determine the correct URL to return when QPlaceIcon::url() or Icon::url() is called. If we wish to change the icons we, can simply specify a different set of parameter values and then save the place or category containing the icon. smallUrl: file:///opt/icons/new_icon_small.png (smallSize: QSize(20,20)) //optional largeUrl: file:///opt/icons/new_icon_large.png (largeSize: QSize(50,50)) // optional All we need to do is set the URLs to where the new icon image is. The size typically does not need to be specified since it is generally automatically calculated. In some cases where the size cannot be calculated, for example if the specified URL cannot currently be accessed, it is necessary to specify a recommended size. If the size of the image can be calculated and a size is also specified, then the specified size is ignored. Copying/Downloading Icons to a Specified DestinationWhen saving icons, we use the source parameters to hold the URL of the source image we are copying from smallSourceUrl: http://www.example.com/icon_s.png smallUrl: file:///bar/icon_small.png (smallSize: QSize(20,20) //optional Using the parameters above will copy the icon from smallSourceUrl to the smallUrl. The smallSourceUrl can be a remote or local URL, but the smallUrl must be local. If the smallUrl already exists, it is overwritten, otherwise it is created. smallSize typically does not need to be set since an attempt will be made to calculate the icon's size. In some cases where the size cannot be calculated, for example if the specified URL cannot currently be accessed, it is necessary to specify a recommended size. If the size of the image can be calculated and a size is also specified, then the specified size is ignored. Copying/Downloading Icons Without a Specified DestinationIt is possible to copy icons, when a place or category is saved and not have to specify a destination. In this case, a data URL will be created for the icon in the underlying database. A data URL contains the icon image embedded into the URL itself. A destination size is chosen for the icon depending on it's calculated size. //input parameters smallSourceUrl: http://www.example.com/icon_small.png //(1) Result if the source icon's actual size corresponded to small smallUrl: data:image/png;base64,iVBORw0K…. smallSize: QSize(20,20) //(2) Result if the source icon's actual size corresponded to medium mediumUrl: data:image/png;base64,iVBORw0K…. mediumSize: QSize(30,30) The above shows that for a given input source URL, an appropriate destination is chosen for the data URL. The icon will not necessarily be placed into smallUrl, since the size is calculated and a destination chosen. The image at the sourceUrl must always been accessible so that the data URL can be generated, consequently this prerequisite also means that a size need not be specified since can always be calculated. This behavior of automatically choosing a destination is necessary because when an icon from a different plugin is saved, it isn't known whether there is only one URL by the JsonDb plugin. When creating a compatible place from another plugin, the JsonDbPlugin tries to get the URLs for the standard small, medium and large sizes. It is possible however that all these may end up being the same URL. The JsonDb plugn filters out these duplicates and chooses an appropriate destination based on size. //The resultant place's icon after calling QPlaceManager::compatiblePlace() smallSourceUrl: http://www.example.com/foo.png mediumSourceUrl: http://www.example.com/foo.png largeSourceUrl: http://www.example.com/foo.png //on save, the plugin filters out the duplicates and determines an appropriate size //in this case the data URL for the large size has been created. largeUrl: data:image/png;base64,qVyOZw0p... largeSize: QSize(50,50) The fullscreen icon is never retrieved and converted into a data URL because data URLs are only meant for small icon images. Visibility ScopeThe JsonDb plugin only supports places of the QtLocation::PrivateVisibility scope. Specifying the QtLocation::UnspecifiedVisibility when saving a place will default to the QtLocation::PrivateVisibility scope. Favorites Matching ParametersThe JsonDb plugin can be used as a favorites store and thus supports the following parameters.
|