Qt定位Android插件

Qt Positioning Android plugin

Qt定位Android插件

Overview

概述

The Qt Positioning Android plugin wraps native Android APIs and provides access to positioning and satellite information.

Qt Positioning Android插件封装了原生Android API,并提供对定位和卫星信息的访问。

The plugin can be loaded by using the provider name android.

该插件可以通过使用提供者名称android加载。

Parameters

参数

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

下表列出了可以传递给Android插件的参数。

ParameterDescription
useMslAltitude

The parameter is introduced in Qt 6.8. It determines if the plugin will try to provide an altitude above Mean Sea Level (MSL). The default value is false, which means that it provides the altitude in WGS84 format. This parameter is only relevant for Android 14 and later. See Altitude Conversion section for more details.

​Qt 6.8中引入了该参数。它确定插件是否会尝试提供高于平均海平面(MSL)的高度。默认值为false,这意味着它以WGS84格式提供高度。此参数仅适用于Android 14及更高版本。有关更多详细信息,请参阅高度转换部分。

Altitude conversion

高度转换

Android traditionally provides altitude above the World Geodetic System 1984 (WGS84) reference ellipsoid. However, starting from Android 14, a new AltitudeConverter class was introduced. This class allows to convert the WGS84 altitude into altitude above Mean Sea Level (MSL) format.

​安卓系统传统上提供1984年世界大地测量系统(WGS84)参考椭球面以上的高度。然而,从Android 14开始,引入了一个新的AltitudeConverter类。此类允许将WGS84高度转换为平均海平面以上高度(MSL)格式。

If the useMslAltitude plugin parameter is set to true, and the application is running on Android 14 or later, the QGeoCoordinate::altitude component of QGeoPositionInfo objects retrieved during position updates will contain the MSL altitude.

​如果useMslAltitude插件参数设置为true,并且应用程序在Android 14或更高版本上运行,则在位置更新期间检索到的QGeoPositionInfo对象的QGeoCoordinate::altitude组件将包含MSL高度。

Note: According to the Android documentation, the conversion to the MSL altitude may take several seconds. It means that lastKnownPosition() requests may execute longer when this feature is enabled, because the method is synchronous. Other position update requests are not affected.


注意:根据Android文档,转换为MSL高度可能需要几秒钟。这意味着当启用此功能时,lastKnownPosition()请求可能会执行更长时间,因为该方法是同步的。其他位置更新请求不受影响。

Examples

示例

The following examples show how to create an android PositionSource from C++ and QML.

​以下示例显示了如何从C++和QML创建android PositionSource。

QML

The following snippet creates a PositionSource with no parameters. The altitude will be reported in WGS84 format.

​以下代码段创建了一个没有参数的PositionSource。高度将以WGS84格式报告。

PositionSource {
    name: "android"
}

The next snippet explicitly adds the useMslAltitude PluginParameter and sets its value to true. This PositionSource will report the altitude in MSL format.

​下一个代码段显式添加useMslAltitude PluginParameter并将其值设置为true。此位置源将以MSL格式报告高度。

PositionSource {
    name: "android"
    PluginParameter {
        name: "useMslAltitude"
        value: true
    }
}

C++

The following snippet shows how to use C++ to create a position source which reports the altitude in MSL format.

​以下代码段显示了如何使用C++创建以MSL格式报告高度的位置源。

QVariantMap params;
params["useMslAltitude"] = true;
QGeoPositionInfoSource *positionSource = QGeoPositionInfoSource::createSource("android", params, this);

PluginsGeoClue v2 plugin

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值