Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
ae4d5f6e
Commit
ae4d5f6e
authored
Apr 19, 2019
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
e660ccce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
40 deletions
+38
-40
QGCMapTileSet.cpp
src/QtLocationPlugin/QGCMapTileSet.cpp
+38
-40
No files found.
src/QtLocationPlugin/QGCMapTileSet.cpp
View file @
ae4d5f6e
...
...
@@ -268,48 +268,46 @@ QGCCachedTileSet::_networkReplyFinished()
qWarning
()
<<
"QGCMapEngineManager::networkReplyFinished() NULL Reply"
;
return
;
}
if
(
reply
->
error
()
!=
QNetworkReply
::
NoError
)
{
// Error was already handled in _networkReplyError implementation
return
;
}
//-- Get tile hash
const
QString
hash
=
reply
->
request
().
attribute
(
QNetworkRequest
::
User
).
toString
();
if
(
!
hash
.
isEmpty
())
{
if
(
_replies
.
contains
(
hash
))
{
_replies
.
remove
(
hash
);
}
else
{
qWarning
()
<<
"QGCMapEngineManager::networkReplyFinished() Reply not in list: "
<<
hash
;
}
qCDebug
(
QGCCachedTileSetLog
)
<<
"Tile fetched"
<<
hash
;
QByteArray
image
=
reply
->
readAll
();
UrlFactory
::
MapType
type
=
getQGCMapEngine
()
->
hashToType
(
hash
);
if
(
type
==
UrlFactory
::
MapType
::
AirmapElevation
)
{
image
=
TerrainTile
::
serialize
(
image
);
}
QString
format
=
getQGCMapEngine
()
->
urlFactory
()
->
getImageFormat
(
type
,
image
);
if
(
!
format
.
isEmpty
())
{
//-- Cache tile
getQGCMapEngine
()
->
cacheTile
(
type
,
hash
,
image
,
format
,
_id
);
QGCUpdateTileDownloadStateTask
*
task
=
new
QGCUpdateTileDownloadStateTask
(
_id
,
QGCTile
::
StateComplete
,
hash
);
getQGCMapEngine
()
->
addTask
(
task
);
//-- Updated cached (downloaded) data
_savedTileSize
+=
image
.
size
();
_savedTileCount
++
;
emit
savedTileSizeChanged
();
emit
savedTileCountChanged
();
//-- Update estimate
if
(
_savedTileCount
%
10
==
0
)
{
quint32
avg
=
_savedTileSize
/
_savedTileCount
;
_totalTileSize
=
avg
*
_totalTileCount
;
_uniqueTileSize
=
avg
*
_uniqueTileCount
;
emit
totalTilesSizeChanged
();
emit
uniqueTileSizeChanged
();
if
(
reply
->
error
()
==
QNetworkReply
::
NoError
)
{
//-- Get tile hash
const
QString
hash
=
reply
->
request
().
attribute
(
QNetworkRequest
::
User
).
toString
();
if
(
!
hash
.
isEmpty
())
{
if
(
_replies
.
contains
(
hash
))
{
_replies
.
remove
(
hash
);
}
else
{
qWarning
()
<<
"QGCMapEngineManager::networkReplyFinished() Reply not in list: "
<<
hash
;
}
qCDebug
(
QGCCachedTileSetLog
)
<<
"Tile fetched"
<<
hash
;
QByteArray
image
=
reply
->
readAll
();
UrlFactory
::
MapType
type
=
getQGCMapEngine
()
->
hashToType
(
hash
);
if
(
type
==
UrlFactory
::
MapType
::
AirmapElevation
)
{
image
=
TerrainTile
::
serialize
(
image
);
}
QString
format
=
getQGCMapEngine
()
->
urlFactory
()
->
getImageFormat
(
type
,
image
);
if
(
!
format
.
isEmpty
())
{
//-- Cache tile
getQGCMapEngine
()
->
cacheTile
(
type
,
hash
,
image
,
format
,
_id
);
QGCUpdateTileDownloadStateTask
*
task
=
new
QGCUpdateTileDownloadStateTask
(
_id
,
QGCTile
::
StateComplete
,
hash
);
getQGCMapEngine
()
->
addTask
(
task
);
//-- Updated cached (downloaded) data
_savedTileSize
+=
image
.
size
();
_savedTileCount
++
;
emit
savedTileSizeChanged
();
emit
savedTileCountChanged
();
//-- Update estimate
if
(
_savedTileCount
%
10
==
0
)
{
quint32
avg
=
_savedTileSize
/
_savedTileCount
;
_totalTileSize
=
avg
*
_totalTileCount
;
_uniqueTileSize
=
avg
*
_uniqueTileCount
;
emit
totalTilesSizeChanged
();
emit
uniqueTileSizeChanged
();
}
}
//-- Setup a new download
_prepareDownload
();
}
else
{
qWarning
()
<<
"QGCMapEngineManager::networkReplyFinished() Empty Hash"
;
}
//-- Setup a new download
_prepareDownload
();
}
else
{
qWarning
()
<<
"QGCMapEngineManager::networkReplyFinished() Empty Hash"
;
}
reply
->
deleteLater
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment