Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
32a35ac9
Commit
32a35ac9
authored
Mar 16, 2018
by
Andreas Bircher
Browse files
remove tile download queue
parent
96fc6a8c
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Terrain.cc
View file @
32a35ac9
...
...
@@ -54,23 +54,18 @@ bool TerrainBatchManager::_getAltitudesForCoordinates(const QList<QGeoCoordinate
if
(
!
_tiles
.
contains
(
tileHash
))
{
qCDebug
(
ElevationProviderLog
)
<<
"Need to download tile "
<<
tileHash
;
if
(
!
_tileDownloadQueue
.
contains
(
tileHash
))
{
// Schedule the fetch task
if
(
_state
!=
State
::
Downloading
)
{
QNetworkRequest
request
=
getQGCMapEngine
()
->
urlFactory
()
->
getTileURL
(
UrlFactory
::
AirmapElevation
,
QGCMapEngine
::
long2elevationTileX
(
coordinate
.
longitude
(),
1
),
QGCMapEngine
::
lat2elevationTileY
(
coordinate
.
latitude
(),
1
),
1
,
&
_networkManager
);
QGeoTileSpec
spec
;
spec
.
setX
(
QGCMapEngine
::
long2elevationTileX
(
coordinate
.
longitude
(),
1
));
spec
.
setY
(
QGCMapEngine
::
lat2elevationTileY
(
coordinate
.
latitude
(),
1
));
spec
.
setZoom
(
1
);
spec
.
setMapId
(
UrlFactory
::
AirmapElevation
);
QGeoTiledMapReplyQGC
*
reply
=
new
QGeoTiledMapReplyQGC
(
&
_networkManager
,
request
,
spec
);
connect
(
reply
,
&
QGeoTiledMapReplyQGC
::
finished
,
this
,
&
TerrainBatchManager
::
_fetchedTile
);
connect
(
reply
,
&
QGeoTiledMapReplyQGC
::
aborted
,
this
,
&
TerrainBatchManager
::
_fetchedTile
);
_state
=
State
::
Downloading
;
}
_tileDownloadQueue
.
append
(
tileHash
);
// Schedule the fetch task
if
(
_state
!=
State
::
Downloading
)
{
QNetworkRequest
request
=
getQGCMapEngine
()
->
urlFactory
()
->
getTileURL
(
UrlFactory
::
AirmapElevation
,
QGCMapEngine
::
long2elevationTileX
(
coordinate
.
longitude
(),
1
),
QGCMapEngine
::
lat2elevationTileY
(
coordinate
.
latitude
(),
1
),
1
,
&
_networkManager
);
QGeoTileSpec
spec
;
spec
.
setX
(
QGCMapEngine
::
long2elevationTileX
(
coordinate
.
longitude
(),
1
));
spec
.
setY
(
QGCMapEngine
::
lat2elevationTileY
(
coordinate
.
latitude
(),
1
));
spec
.
setZoom
(
1
);
spec
.
setMapId
(
UrlFactory
::
AirmapElevation
);
QGeoTiledMapReplyQGC
*
reply
=
new
QGeoTiledMapReplyQGC
(
&
_networkManager
,
request
,
spec
);
connect
(
reply
,
&
QGeoTiledMapReplyQGC
::
finished
,
this
,
&
TerrainBatchManager
::
_fetchedTile
);
connect
(
reply
,
&
QGeoTiledMapReplyQGC
::
aborted
,
this
,
&
TerrainBatchManager
::
_fetchedTile
);
_state
=
State
::
Downloading
;
}
_tilesMutex
.
unlock
();
...
...
@@ -111,13 +106,6 @@ void TerrainBatchManager::_fetchedTile()
// remove from download queue
QGeoTileSpec
spec
=
reply
->
tileSpec
();
QString
hash
=
QGCMapEngine
::
getTileHash
(
UrlFactory
::
AirmapElevation
,
spec
.
x
(),
spec
.
y
(),
spec
.
zoom
());
_tilesMutex
.
lock
();
if
(
_tileDownloadQueue
.
contains
(
hash
))
{
_tileDownloadQueue
.
removeOne
(
hash
);
}
else
{
qCDebug
(
ElevationProviderLog
)
<<
"Loaded elevation tile, but not found in download queue."
;
}
_tilesMutex
.
unlock
();
// handle potential errors
if
(
reply
->
error
()
!=
QGeoTiledMapReply
::
NoError
)
{
...
...
src/Terrain.h
View file @
32a35ac9
...
...
@@ -57,7 +57,6 @@ private:
QMutex
_tilesMutex
;
QHash
<
QString
,
TerrainTile
>
_tiles
;
QStringList
_tileDownloadQueue
;
};
class
ElevationProvider
:
public
QObject
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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