Qt Location GeoServices
Qt位置地理服务
The Qt Location provides the majority of its functionality through GeoService plugins. This document outlines how to develop a new GeoService plugin.
Qt Location通过GeoService插件提供其大部分功能。本文档概述了如何开发新的GeoService插件。
Plugin Description
插件说明
Each plugin is described by a json file. The json describes the plugins capabilities and version. Below is an example of a json file used by the OpenStreenMap plugin:
每个插件都由一个json文件描述。json描述了插件的功能和版本。下面是OpenStreenMap插件使用的json文件的示例:
{
"Keys": ["osm"],
"Provider": "osm",
"Version": 100,
"Experimental": false,
"Features": [
"OnlineMappingFeature",
"OnlineGeocodingFeature",
"ReverseGeocodingFeature",
"OnlineRoutingFeature",
"OnlinePlacesFeature"
]
}
The entries have the following meaning:
这些条目具有以下含义:
Key | Description |
---|---|
Keys | The unique name/key of the plugin. Each GeoService plugin must have a unique name. 插件的唯一名称/密钥。每个GeoService插件都必须有一个唯一的名称。 |
Provider | The provider name of the services. Multiple plugins may have the same name. In such cases the Version string will be used to further distinguish the plugins. 服务的提供者名称。多个插件可能具有相同的名称。在这种情况下,版本字符串将用于进一步区分插件。 |
Experimental | Marks the service plugin as experimental. API developers may choose to ignore such plugins when instanciating QGeoServiceProvider::QGeoServiceProvider(). 将服务插件标记为实验性。API开发人员在安装QGeoServiceProvider::QGeoServiceProvider()时可能会选择忽略此类插件。 |
Version | The plugin version. If multiple plugins have the same provider name, the plugin with the higest version will be used. 插件版本。如果多个插件具有相同的提供者名称,则将使用版本最高的插件。 |
Features | List of features provided by the plugin/service. Each feature is a string representation of the corresponding features in QGeoServiceProvider. For more details see QGeoServiceProvider::routingFeatures(), QGeoServiceProvider::geocodingFeatures() and QGeoServiceProvider::placesFeatures(). 插件/服务提供的功能列表。每个功能都是QGeoServiceProvider中相应功能的字符串表示。有关更多详细信息,请参阅QGeoServiceProvider::routingFeatures()、QGeoService Provider::geocodingFeature()和QGeoServicesProvider::placesFeatures()。 |
Implementing Plugins
实现插件
A plugin implementer needs to subclass QGeoServiceProviderFactory and as many of the ManagerEngine classes as they want to provide implementations for.
插件实现者需要子类QGeoServiceProviderFactory和尽可能多的ManagerEngine类,因为他们想为这些类提供实现。
Subclassing QGeoServiceProviderFactory will only involves overriding of one of the following methods:
对QGeoServiceProviderFactory进行子分类只涉及覆盖以下方法之一:
- QGeoServiceProviderFactory::createGeocodingManagerEngine()
- QGeoServiceProviderFactory::createRoutingManagerEngine()
- QGeoServiceProviderFactory::createPlaceManagerEngine()
If a plugin does not provide an engine the relevant function should return nullptr
.
如果插件不提供引擎,则相关函数应返回nullptr。
Interface and convenience methods to implementers of QGeoServiceProvider plugins who want to provide support for geocoding operations 为希望为地理编码操作提供支持的QGeoServiceProvider插件的实现者提供接口和便利方法 | |
Interface and convenience methods to implementers of QGeoServiceProvider plugins who want to provide access to geographic routing information QGeoServiceProvider插件的实现者想要提供对地理路由信息的访问的接口和便利方法 | |
Interface for implementers of QGeoServiceProvider plugins who want to provide access to place functionality QGeoServiceProvider插件实现者的接口,他们希望提供对位置功能的访问 |
Maps QML APIOpen Street Map 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.