Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qgeotilefetcherohosmapkit.cpp
Go to the documentation of this file.
1
// Copyright (C) 2025 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#
include
<
QtCore
/
qurlquery
.
h
>
5
#
include
<
QtCore
/
qurl
.
h
>
6
#
include
<
QtLocation
/
private
/
qgeotilespec_p
.
h
>
7
#
include
<
QtNetwork
/
qnetworkaccessmanager
.
h
>
8
#
include
<
QtNetwork
/
qnetworkrequest
.
h
>
9
#
include
<
qgeomapreplyohosmapkit
.
h
>
10
#
include
<
qgeotilefetcherohosmapkit
.
h
>
11
#
include
<
qohosmapkitcommon
.
h
>
12
13
QT_BEGIN_NAMESPACE
14
15
namespace
{
16
17
constexpr
int
minScaleFactor = 1;
18
constexpr
int
maxScaleFactor = 2;
19
20
const
QString
tilesApiPath
= QLatin1String(
"https://mapapi.cloud.huawei.com/mapApi/v1/mapService/getTile"
);
21
22
class
QGeoTileFetcherOhosMapKit
:
public
QGeoTileFetcher
23
{
24
public
:
25
QGeoTileFetcherOhosMapKit
(
26
const
QString &authenticationKey,
const
QString &userAgent,
int
scaleFactor,
27
QGeoTiledMappingManagerEngine *parent);
28
29
private
:
30
QGeoTiledMapReply
*
getTileImage
(
const
QGeoTileSpec &spec)
override
;
31
32
QNetworkAccessManager m_networkManager;
33
QString m_userAgent;
34
QString m_authenticationKey;
35
int
m_scaleFactor;
36
};
37
38
QGeoTileFetcherOhosMapKit
::
QGeoTileFetcherOhosMapKit
(
39
const
QString &authenticationKey,
const
QString &userAgent,
int
scaleFactor,
40
QGeoTiledMappingManagerEngine *parent)
41
:
QGeoTileFetcher
(
parent
)
42
,
m_userAgent
(
userAgent
)
43
,
m_authenticationKey
(
authenticationKey
)
44
, m_scaleFactor(qBound(minScaleFactor, scaleFactor, maxScaleFactor))
45
{
46
}
47
48
QGeoTiledMapReply
*
QGeoTileFetcherOhosMapKit
::
getTileImage
(
const
QGeoTileSpec &spec)
49
{
50
QUrlQuery query;
51
query.addQueryItem(QLatin1String(
"x"
), QString::number(spec.x()));
52
query.addQueryItem(QLatin1String(
"y"
), QString::number(spec.y()));
53
query.addQueryItem(QLatin1String(
"z"
), QString::number(spec.zoom()));
54
query.addQueryItem(QLatin1String(
"language"
), OhosMapKit::getLanguageCode());
55
query.addQueryItem(QLatin1String(
"scale"
), QString::number(m_scaleFactor));
56
57
QUrl url(
tilesApiPath
);
58
url.setQuery(query);
59
60
return
makeGeoTiledMapReplyOhosMapKit(
61
m_networkManager.get(
62
OhosMapKit::createOhosMapKitNetworkRequest(url, m_userAgent, m_authenticationKey)),
63
spec,
this
);
64
}
65
66
}
67
68
QGeoTileFetcher
*
makeGeoTileFetcherOhosMapKit
(
69
const
QString &authenticationKey,
const
QString &userAgent,
int
scaleFactor,
70
QGeoTiledMappingManagerEngine *parent)
71
{
72
return
new
QGeoTileFetcherOhosMapKit
(authenticationKey, userAgent, scaleFactor, parent);
73
}
74
75
QT_END_NAMESPACE
QT_BEGIN_NAMESPACE::QGeoTileFetcherOhosMapKit
Definition
qgeotilefetcherohosmapkit.cpp:23
QT_BEGIN_NAMESPACE::QGeoTileFetcherOhosMapKit::QGeoTileFetcherOhosMapKit
QGeoTileFetcherOhosMapKit(const QString &authenticationKey, const QString &userAgent, int scaleFactor, QGeoTiledMappingManagerEngine *parent)
Definition
qgeotilefetcherohosmapkit.cpp:38
QT_BEGIN_NAMESPACE::QGeoTileFetcherOhosMapKit::getTileImage
QGeoTiledMapReply * getTileImage(const QGeoTileSpec &spec) override
Definition
qgeotilefetcherohosmapkit.cpp:48
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QT_BEGIN_NAMESPACE::tilesApiPath
const QString tilesApiPath
Definition
qgeotilefetcherohosmapkit.cpp:20
makeGeoTileFetcherOhosMapKit
QGeoTileFetcher * makeGeoTileFetcherOhosMapKit(const QString &authenticationKey, const QString &userAgent, int scaleFactor, QGeoTiledMappingManagerEngine *parent)
Definition
qgeotilefetcherohosmapkit.cpp:68
qtlocation
src
plugins
geoservices
ohosmapkit
qgeotilefetcherohosmapkit.cpp
Generated on
for Qt by
1.18.0