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
285afe82
Commit
285afe82
authored
Jul 09, 2020
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
665ef88d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
7 deletions
+33
-7
qgcresources.qrc
qgcresources.qrc
+1
-0
BingNoTileBytes.dat
resources/BingNoTileBytes.dat
+0
-0
QGCMapEngine.cpp
src/QtLocationPlugin/QGCMapEngine.cpp
+9
-0
QGCMapUrlEngine.h
src/QtLocationPlugin/QGCMapUrlEngine.h
+1
-1
QGeoMapReplyQGC.cpp
src/QtLocationPlugin/QGeoMapReplyQGC.cpp
+21
-6
QGeoMapReplyQGC.h
src/QtLocationPlugin/QGeoMapReplyQGC.h
+1
-0
No files found.
qgcresources.qrc
View file @
285afe82
...
...
@@ -22,6 +22,7 @@
<file alias="gear-black.svg">resources/gear-black.svg</file>
<file alias="gear-white.svg">resources/gear-white.svg</file>
<file alias="helicoptericon.svg">resources/helicoptericon.svg</file>
<file alias="BingNoTileBytes.dat">resources/BingNoTileBytes.dat</file>
<file alias="JoystickBezel.png">resources/JoystickBezel.png</file>
<file alias="JoystickBezelLight.png">resources/JoystickBezelLight.png</file>
<file alias="land.svg">resources/land.svg</file>
...
...
resources/BingNoTileBytes.dat
0 → 100644
View file @
285afe82
File added
src/QtLocationPlugin/QGCMapEngine.cpp
View file @
285afe82
...
...
@@ -222,6 +222,15 @@ QGCMapEngine::cacheTile(QString type, const QString& hash, const QByteArray& ima
QString
QGCMapEngine
::
getTileHash
(
QString
type
,
int
x
,
int
y
,
int
z
)
{
#if 0
int maxCachedZoom = 15;
if (z > maxCachedZoom) {
double unZoomFactor = qPow(2, z - maxCachedZoom);
x = (double)x / unZoomFactor;
y = (double)y / unZoomFactor;
z = maxCachedZoom;
}
#endif
return
QString
::
asprintf
(
"%010d%08d%08d%03d"
,
getQGCMapEngine
()
->
urlFactory
()
->
getIdFromType
(
type
),
x
,
y
,
z
);
}
...
...
src/QtLocationPlugin/QGCMapUrlEngine.h
View file @
285afe82
...
...
@@ -24,7 +24,7 @@
#include "MapboxMapProvider.h"
#include "ElevationMapProvider.h"
#define MAX_MAP_ZOOM (2
0
.0)
#define MAX_MAP_ZOOM (2
3
.0)
class
UrlFactory
:
public
QObject
{
Q_OBJECT
...
...
src/QtLocationPlugin/QGeoMapReplyQGC.cpp
View file @
285afe82
...
...
@@ -53,7 +53,8 @@
#include <QFile>
#include "TerrainTile.h"
int
QGeoTiledMapReplyQGC
::
_requestCount
=
0
;
int
QGeoTiledMapReplyQGC
::
_requestCount
=
0
;
QByteArray
QGeoTiledMapReplyQGC
::
_bingNoTileImage
;
//-----------------------------------------------------------------------------
QGeoTiledMapReplyQGC
::
QGeoTiledMapReplyQGC
(
QNetworkAccessManager
*
networkManager
,
const
QNetworkRequest
&
request
,
const
QGeoTileSpec
&
spec
,
QObject
*
parent
)
...
...
@@ -62,6 +63,12 @@ QGeoTiledMapReplyQGC::QGeoTiledMapReplyQGC(QNetworkAccessManager *networkManager
,
_request
(
request
)
,
_networkManager
(
networkManager
)
{
if
(
_bingNoTileImage
.
count
()
==
0
)
{
QFile
file
(
":/res/BingNoTileBytes.dat"
);
file
.
open
(
QFile
::
ReadOnly
);
_bingNoTileImage
=
file
.
readAll
();
file
.
close
();
}
if
(
_request
.
url
().
isEmpty
())
{
if
(
!
_badMapbox
.
size
())
{
QFile
b
(
":/res/notile.png"
);
...
...
@@ -135,11 +142,19 @@ QGeoTiledMapReplyQGC::networkReplyFinished()
}
emit
terrainDone
(
a
,
QNetworkReply
::
NoError
);
}
else
{
//-- This is a map tile. Process and cache it if valid.
setMapImageData
(
a
);
if
(
!
format
.
isEmpty
())
{
setMapImageFormat
(
format
);
getQGCMapEngine
()
->
cacheTile
(
getQGCMapEngine
()
->
urlFactory
()
->
getTypeFromId
(
tileSpec
().
mapId
()),
tileSpec
().
x
(),
tileSpec
().
y
(),
tileSpec
().
zoom
(),
a
,
format
);
if
(
a
==
_bingNoTileImage
)
{
// Bing doesn't return an error if you request a tile above supported zoom level
// It instead returns an image of a missing tile graphic. We need to detect that
// and error out so Qt will deal with zooming correctly even if it doesn't have the tile.
// This allows us to zoom up to level 23 even though the tiles don't actually exist
setError
(
QGeoTiledMapReply
::
CommunicationError
,
"Bing tile above zoom level"
);
}
else
{
//-- This is a map tile. Process and cache it if valid.
setMapImageData
(
a
);
if
(
!
format
.
isEmpty
())
{
setMapImageFormat
(
format
);
getQGCMapEngine
()
->
cacheTile
(
getQGCMapEngine
()
->
urlFactory
()
->
getTypeFromId
(
tileSpec
().
mapId
()),
tileSpec
().
x
(),
tileSpec
().
y
(),
tileSpec
().
zoom
(),
a
,
format
);
}
}
setFinished
(
true
);
}
...
...
src/QtLocationPlugin/QGeoMapReplyQGC.h
View file @
285afe82
...
...
@@ -81,6 +81,7 @@ private:
QByteArray
_badMapbox
;
QByteArray
_badTile
;
QTimer
_timer
;
static
QByteArray
_bingNoTileImage
;
static
int
_requestCount
;
};
...
...
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