Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

Qt Location JsonDb plugin

Overview

Included 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.

Parameters

The following table lists optional parameters that can be passed to the Nokia plugin.

ParameterDescription
places.partitionSpecifies which JsonDb partition to store Places and Categories. If no partition is specified, the default partition is used.

Places

The 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

Storagelocal
Read/Writeread/write
Iconsyes
Search term suggestionsno
Recommendationsno
Category structureHierarchical
(Rich) Content imagesno
(Rich) Content reviewsno
(Rich) Content editorialsno
All details fetched during searchyes
Paging offset indexyes
Paging limityes
Distance relevance hintyes
Lexical name relevance hintyes
Search term correctionsno
Extended Attributesno
Notifications for added/removed places/categoriesyes
visibility scopesdevice
favorites matching/(usable as favoritesPlugin)yes

Plugin Specific Behaviors

Search

The following list shows what core place data is returned during a place search:

  • name
  • location
  • contact information
  • icon
  • categories

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.

Icons

Parameter Reference

The JsonDbPlugin supports the following icon parameter values

KeyValue
smallUrlHolds the URL for the small icon
smallSizeHolds the dimensions of the small icon
smallSourceUrlHolds the source URL from which the small icon is to be copied/downloaded from.
mediumUrlHolds the URL for the medium sized icon.
mediumSizeHolds the dimensions of the medium sized icon.
mediumSourceUrlHolds the source URL from which the medium icon is to be copied/downloaded from.
largeUrlHolds the URL for the large icon.
largeSizeHolds the dimensions of the large icon.
largeSourceUrlHolds the source URL from which the large icon is to be copied/downloaded from.
fullscreenUrlHolds the URL for the fullscreen icon.
fullscreenSizeHolds the dimensions of the fullscreen icon.
fullscreenSourceUrlHolds the source URL from which the fullscreen icon is to be copied/downloaded from.

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 Usage

During 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 Destination

When 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 Destination

It 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 Scope

The 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 Parameters

The JsonDb plugin can be used as a favorites store and thus supports the following parameters.

keyvalue
"alternativeId" (aka QPlaceMatchRequest::AlternativeId)alternative identifier attribute type, of the form "x_id_<provider name>" for example "x_id_nokia"
"proximity"The distance (m) allowed between places in order to be considered a match.
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web