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  · 

Coordinate

The Coordinate element represents and stores a geographic position. More...

Inherits QtObject

This type was introduced in Qt Location 5.0.

Properties

Methods

Detailed Description

Coordinate elements represent a geographic location in the form of numbers: in particular, latitude, longitude and altitude. These, together, specify a 3-dimensional position anywhere on or near the Earth's surface.

Coordinates are used by many other elements in the Qt Location module, for specifying the position of an object on a Map, the current position of a device and many other tasks. They also feature a number of important utility methods that make otherwise complex calculations simple to use, such as atDistanceAndAzimuth.

Accuracy

The latitude, longitude and altitude numbers stored in a Coordinate are represented as doubles, giving them approximately 16 decimal digits of precision -- enough to specify micrometers. The calculations performed in Coordinate's methods such as azimuthTo and distanceTo also use doubles for all intermediate values, but the inherent inaccuracies in their spherical Earth model dominate the amount of error in their output.

Example Usage

The following snippet defines two coordinates near Brisbane, Australia.

 Coordinate {
     id: coord1
     latitude: -27.2
     longitude: 153.1
     altitude: 1.0
 }

 Coordinate {
     id: coord2
     latitude: -27.5
     longitude: 153.2
     altitude: 5.0
 }

As an example, the value of coord1.distanceTo(coord2) would now be approximately 34790 (34.8 km).

NOTE: if another element has a Coordinate property, a change notification signal for that property will only be emitted if that property is assigned a new Coordinate, and not if the position data of the existing Coordinate assigned to the property changes. The only exception to this rule is that the Position element does emit change signals if its coordinate property's values change.

Property Documentation

altitude : double

This property holds the value of altitude (meters above sea level). If the property has not been set, its default value is zero.


coordinate : QGeoCoordinate

For details on how to use this property to interface between C++ and QML see "Interfaces between C++ and QML Code".


read-onlyisValid : bool

This property holds the current validity of the coordinate. Coordinates are considered valid if they have been set with a valid latitude and longitude (altitude is not required).

The latitude must be between -90 to 90 inclusive to be considered valid, and the longitude must be between -180 to 180 inclusive to be considered valid.


latitude : double

This property holds latitude value of the geographical position (decimal degrees). A positive latitude indicates the Northern Hemisphere, and a negative latitude indicates the Southern Hemisphere. If the property has not been set, its default value is zero.


longitude : double

This property holds the longitude value of the geographical position (decimal degrees). A positive longitude indicates the Eastern Hemisphere, and a negative longitude indicates the Western Hemisphere If the property has not been set, its default value is zero.


Method Documentation

Coordinate::atDistanceAndAzimuth(qreal, qreal)

Returns the coordinate that is reached by traveling distance metres from the current coordinate at azimuth degrees along a great-circle.

There is an assumption that the Earth is spherical for the purpose of this calculation.


Coordinate::azimuthTo(Coordinate)

Returns the azimuth (or bearing) in degrees from this coordinate to the coordinate specified by other. Altitude is not used in the calculation.

There is an assumption that the Earth is spherical for the purpose of this calculation.


Coordinate::distanceTo(Coordinate)

Returns the distance (in meters) from this coordinate to the coordinate specified by other. Altitude is not used in the calculation.

This calculation returns the great-circle distance between the two coordinates, with an assumption that the Earth is spherical for the purpose of this calculation.


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