Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qgeotiledmapreply.cpp
Go to the documentation of this file.
1
// Copyright (C) 2015 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
"qgeotiledmapreply_p.h"
5
#
include
"qgeotiledmapreply_p_p.h"
6
7
#
include
<
qdebug
.
h
>
8
9
QT_BEGIN_NAMESPACE
10
/*!
11
\class QGeoTiledMapReply
12
\inmodule QtLocation
13
\ingroup QtLocation-impl
14
\since 5.6
15
\internal
16
17
\brief The QGeoTiledMapReply class manages a tile fetch operation started
18
by an instance of QGeoTiledManagerEngine.
19
20
Instances of QGeoTiledMapReply manage the state and results of these
21
operations.
22
23
The isFinished(), error() and errorString() methods provide information
24
on whether the operation has completed and if it completed successfully.
25
26
The finished() and errorOccurred(QGeoTiledMapReply::Error,QString)
27
signals can be used to monitor the progress of the operation.
28
29
It is possible that a newly created QGeoTiledMapReply may be in a finished
30
state, most commonly because an error has occurred. Since such an instance
31
will never emit the finished() or
32
errorOccurred(QGeoTiledMapReply::Error,QString) signals, it is
33
important to check the result of isFinished() before making the connections
34
to the signals.
35
36
If the operation completes successfully the results are accessed by
37
mapImageData() and mapImageFormat().
38
*/
39
40
/*!
41
\enum QGeoTiledMapReply::Error
42
43
Describes an error which prevented the completion of the operation.
44
45
\value NoError
46
No error has occurred.
47
\value CommunicationError
48
An error occurred while communicating with the service provider.
49
\value ParseError
50
The response from the service provider was in an unrecognizable format
51
supported by the service provider.
52
\value UnknownError
53
An error occurred which does not fit into any of the other categories.
54
*/
55
56
/*!
57
Constructs a tiled map reply object based on \a request, with parent \a parent.
58
*/
59
QGeoTiledMapReply::QGeoTiledMapReply(
const
QGeoTileSpec &spec, QObject *parent)
60
: QObject(parent),
61
d_ptr(
new
QGeoTiledMapReplyPrivate(spec))
62
{
63
}
64
65
/*!
66
Constructs a tiled map reply object with a given \a error and \a errorString and the specified \a parent.
67
*/
68
QGeoTiledMapReply::QGeoTiledMapReply(Error error,
const
QString &errorString, QObject *parent)
69
: QObject(parent),
70
d_ptr(
new
QGeoTiledMapReplyPrivate(error, errorString)) {}
71
72
/*!
73
Destroys this tiled map reply object.
74
*/
75
QGeoTiledMapReply::~QGeoTiledMapReply()
76
{
77
delete
d_ptr;
78
}
79
80
/*!
81
Sets whether or not this reply has finished to \a finished.
82
83
If \a finished is true, this will cause the finished() signal to be
84
emitted.
85
86
If the operation completed successfully,
87
QGeoTiledMapReply::setMapImageData() should be called before this
88
function. If an error occurred, QGeoTiledMapReply::setError() should be used
89
instead.
90
*/
91
void
QGeoTiledMapReply::setFinished(
bool
finished)
92
{
93
d_ptr->isFinished = finished;
94
if
(d_ptr->isFinished)
95
emit
this
->finished();
96
}
97
98
/*!
99
Return true if the operation completed successfully or encountered an
100
error which cause the operation to come to a halt.
101
*/
102
bool
QGeoTiledMapReply::isFinished()
const
103
{
104
return
d_ptr->isFinished;
105
}
106
107
/*!
108
Sets the error state of this reply to \a error and the textual
109
representation of the error to \a errorString.
110
111
This will also cause errorOccurred() and finished() signals to be emitted, in that
112
order.
113
*/
114
void
QGeoTiledMapReply::setError(QGeoTiledMapReply::Error error,
const
QString &errorString)
115
{
116
d_ptr->error = error;
117
d_ptr->errorString = errorString;
118
emit errorOccurred(error, errorString);
119
setFinished(
true
);
120
}
121
122
/*!
123
Returns the error state of this reply.
124
125
If the result is QGeoTiledMapReply::NoError then no error has occurred.
126
*/
127
QGeoTiledMapReply::Error QGeoTiledMapReply::error()
const
128
{
129
return
d_ptr->error;
130
}
131
132
/*!
133
Returns the textual representation of the error state of this reply.
134
135
If no error has occurred this will return an empty string. It is possible
136
that an error occurred which has no associated textual representation, in
137
which case this will also return an empty string.
138
139
To determine whether an error has occurred, check to see if
140
QGeoTiledMapReply::error() is equal to QGeoTiledMapReply::NoError.
141
*/
142
QString QGeoTiledMapReply::errorString()
const
143
{
144
return
d_ptr->errorString;
145
}
146
147
/*!
148
Returns whether the reply is coming from a cache.
149
*/
150
bool
QGeoTiledMapReply::isCached()
const
151
{
152
return
d_ptr->isCached;
153
}
154
155
/*!
156
Sets whether the reply is coming from a cache to \a cached.
157
*/
158
void
QGeoTiledMapReply::setCached(
bool
cached)
159
{
160
d_ptr->isCached = cached;
161
}
162
163
/*!
164
Returns the request which corresponds to this reply.
165
*/
166
QGeoTileSpec QGeoTiledMapReply::tileSpec()
const
167
{
168
return
d_ptr->spec;
169
}
170
171
/*!
172
Returns the tile image data.
173
*/
174
QByteArray QGeoTiledMapReply::mapImageData()
const
175
{
176
return
d_ptr->mapImageData;
177
}
178
179
/*!
180
Sets the tile image data to \a data.
181
*/
182
void
QGeoTiledMapReply::setMapImageData(
const
QByteArray &data)
183
{
184
d_ptr->mapImageData = data;
185
}
186
187
/*!
188
Returns the format of the tile image.
189
*/
190
QString QGeoTiledMapReply::mapImageFormat()
const
191
{
192
return
d_ptr->mapImageFormat;
193
}
194
195
/*!
196
Sets the format of the tile image to \a format.
197
*/
198
void
QGeoTiledMapReply::setMapImageFormat(
const
QString &format)
199
{
200
d_ptr->mapImageFormat = format;
201
}
202
203
/*!
204
Cancels the operation immediately.
205
206
This will do nothing if the reply is finished.
207
*/
208
void
QGeoTiledMapReply::abort()
209
{
210
if
(!isFinished())
211
setFinished(
true
);
212
emit aborted();
213
}
214
215
/*!
216
\fn void QGeoTiledMapReply::finished()
217
218
This signal is emitted when this reply has finished processing.
219
220
If error() equals QGeoTiledMapReply::NoError then the processing
221
finished successfully.
222
223
This signal and QGeoRoutingManager::finished() will be
224
emitted at the same time.
225
226
\note Do not delete this reply object in the slot connected to this
227
signal. Use deleteLater() instead.
228
*/
229
230
/*!
231
\fn void QGeoTiledMapReply::errorOccurred(QGeoTiledMapReply::Error error, const QString &errorString)
232
233
This signal is emitted when an error has been detected in the processing of
234
this reply. The finished() signal will probably follow.
235
236
The error will be described by the error code \a error. If \a errorString is
237
not empty it will contain a textual description of the error.
238
239
This signal and QGeoRoutingManager::errorOccurred() will be emitted at the same time.
240
241
\note Do not delete this reply object in the slot connected to this
242
signal. Use deleteLater() instead.
243
*/
244
245
/*******************************************************************************
246
*******************************************************************************/
247
248
QGeoTiledMapReplyPrivate::QGeoTiledMapReplyPrivate(
const
QGeoTileSpec &spec)
249
: spec(spec)
250
{}
251
252
QGeoTiledMapReplyPrivate::QGeoTiledMapReplyPrivate(QGeoTiledMapReply::Error error,
const
QString &errorString)
253
: error(error),
254
errorString(errorString),
255
isFinished(
true
)
256
{}
257
258
QT_END_NAMESPACE
QPlatformGraphicsBufferHelper
\inmodule QtGui
qtlocation
src
location
maps
qgeotiledmapreply.cpp
Generated on
for Qt by
1.14.0