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 Module

The Qt Location API provides positioning, mapping, navigation, and place search via QML and C++ interfaces.

Overview

The Qt Location API gives developers the ability to determine a position by using a variety of possible sources, including satellite, or wifi, or text file, and so on. That information can then be used to determine a position in a map context with appropriate navigation and to embed, in the map, defined places with descriptive metadata. These three parts allow a device to know where it is and its location with respect to important features. Using features such as roads, destinations, routes, and other navigation attributes, applications can specify beginning and end-points for navigation and awareness of objects that may aid or hinder a journey.

Getting Started

To load the Qt Location module, add the following statement to your .qml files

 import QtLocation 5.0

For C++ projects include the header appropriate for the current use case, for example applications using routes may use

 #include <QGeoRoute> 

The .pro file should have the location keyword added

    QT += location

Concepts (in a QML Context)

What follows assumes that we are using the Qt Location QML API.

Position information can come from a variety of sources including satellites, wifi, text files and so on.

The position is described by the usual latitude, longitude, and the altitude in meters. For more information see Geographic Coordinate.

The QML position is stored in a Coordinate which contains the latitude, longitude and altitude of the device. The Location contains this Coordinate and adds an address, and a bounding box thus making the location a region and not just a point.

Now that the device has a position, with regular updates the API can determine the speed and heading of the device. It can define a box or a circle that can produce a notification when the device either leaves or enters that region.

If we introduce the idea of a Map with positions of interest, Places, then the device can be made aware of nearby features and related information, displayed graphically. Features on the Map may be places of business, entertainment and so on. They may include paths, roads, or forms of transport leading to the idea that navigation optimization and assistance are possible.

To enable navigation we need Routes from start to destination. These routes are made up of segments. Each RouteSegment can be considered a navigation sub-task: drive 100 meters, turn left. The beginning and end of each segment is a waypoint, that is, one part of our journey.

A typical use case for the API is a user looking for a particular type of place, say a restaurant. The user could enter a search string into the map application and respond to a list or display of results for restaurants "near" the device. The application could then be used to navigate to the restaurant using an optimized route that is aware of features in the environment that can help or hinder the journey. The navigation then proceeds with the user's progress monitored by means of the current Location. In the context of this API the map application would be aware of the location and size of various places and the location of the user. Plugins would supply the data used by the application to determine routes and navigation instructions. The Place types would hold information about the destination and surrounding objects including displayable representations. The Map type would enable this information to be displayed, panned, zoomed and so on. The Route would be determined by a plugin with each RouteSegment holding the navigation instructions guided by the updated current Location.

Plugins are a means of specifying which Location based service to use. For example, a plugin may allow connection to a provider's service that handles geocoding and routing that the API and application can use. There may be various GeoServices plugins for various tasks with some plugins providing more than one service. One QML Plugin should be created for each required GeoService plugin. Plugins are required for maps, routing and geocoding, however the default plugin handles all three of these services. A plugin may require online access or may support on-board maps and data. The default "nokia" plugin only supports online use which would be managed by QNetworkInfo and QNetworkConfigurationManager.

Note: : Plugins may not provide various features such as paging or relevance hints. Since plugins may be supplied by other providers, support for these aspects is dependent on the provider's implementation.

API Sub-Modules

[ sub-module relationships diagram ]

The API is split into three core sub-modules, which each have QML and C++ APIs.

Positioning

Positioning includes all the functionality necessary to find and work with geographic coordinates. It can use a variety of external sources of information, including GPS. This provides us with a coordinate and altitude for the device with additional features such as speed and direction. This provides the fundamental location information used in the API.

Positioning introduction:for QMLfor C++

Places

Places is the natural complement to Positioning, providing a source of geographic data about places of interest (POIs). As well as providing the location, size and other vitals about a POI, the Places API can also retrieve images, reviews and other rich content, and integrate with platform sources or a user's favorites to add user content, such as photos or a review, related to the place.

Places introduction:for QMLfor C++

Maps and Navigation

[ Image showing Mapviewer containing place, map and navigation details ]

Maps and Navigation provides Qt Quick user interface components for displaying geographic information on a map, as well as allowing user interaction with map objects and the display itself. It also contains utilities for geocoding (finding a geographic coordinate from a street address) and navigation (including driving and walking directions).

Maps and Navigation introduction:for QMLfor C++

New Since Qt4

In Qt4 QtMobility provided some location functionality for positioning and Maps with landmarks support. The new Qt Location API has had an extensive reworking of Maps and Places (formerly Landmarks).

New features of Qt Location includes

  • Maps are now part of the QML2 scenegraph, and rendered using hardware- accelerated OpenGL
  • Arbitrary QML2 items on the map are supported using MapQuickItem
  • Model-view support for creating map objects from a QML model
  • Built-in support for pinch-to-zoom gestures, flicking and "kinetic" panning
  • Vast performance improvements over Mobility 1.2, especially for large map polylines and objects in general
  • Full QML API now available for routing and geocoding -- compatible with standard QML model-view design
  • Service provider feature detection without having to open all the available plugins
  • Unified "Plugin" QML element used by routing/geocoding/maps etc with easy-to-set PluginParameters
  • Two plugins are supplied with Qt. The Nokia plugin for GeoServices and the JsonDb plugin for storing locally created places. The JsonDb plugin can also be used to save Favorite places linked to another plugin.
  • Landmarks API is replaced by the Places API
  • Both C++ and QML APIs have been reworked to be simpler to use.
  • Supports viewing of richer content such as reviews, images, and editorials
  • Supports locale handling, sponsored search results, and supplier attribution

API References and Examples

Alphabetized lists of all classes and user interface components in the API, as well as detailed example applications to demonstrate their usage.

QML API ReferenceFull list of QML components in the Qt Location API
C++ API ReferenceFull list of C++ classes and methods in the Qt Location API
Example AppsExamples demonstrating use of the Qt Location APIs

Plugin References and Parameters

Information about plugins, important notes on their usage, parameters that can be provided to influence their behavior.

Qt Location JsonDb plugin

Local store for user defined favorite places.

Qt Location Nokia Plugin

Uses the relevant Nokia services provided by Nokia.

Implementing New Back-Ends and Porting

For systems integrators and distributors, information relating to making Qt Location available for a new platform.

GeoServicesInformation about the Qt Location GeoServices plugins
PlacesInformation for Places Backend Implementors
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