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
dd5229fa
Commit
dd5229fa
authored
Sep 19, 2019
by
Pierre TILAK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove Airmap from MapReplyQGC
parent
9f48f6a4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
26 deletions
+17
-26
QGCMapUrlEngine.cpp
src/QtLocationPlugin/QGCMapUrlEngine.cpp
+7
-17
QGCMapUrlEngine.h
src/QtLocationPlugin/QGCMapUrlEngine.h
+2
-0
QGeoMapReplyQGC.cpp
src/QtLocationPlugin/QGeoMapReplyQGC.cpp
+8
-9
No files found.
src/QtLocationPlugin/QGCMapUrlEngine.cpp
View file @
dd5229fa
...
...
@@ -146,7 +146,7 @@ QString UrlFactory::getTypeFromId(int id) {
while
(
i
.
hasNext
())
{
i
.
next
();
if
(
abs
(
qHash
(
i
.
key
())
)
==
id
)
{
if
(
(
int
)(
qHash
(
i
.
key
())
>>
1
)
==
id
)
{
return
i
.
key
();
}
}
...
...
@@ -155,9 +155,9 @@ QString UrlFactory::getTypeFromId(int id) {
}
// Todo : qHash produce a uint bigger than max(int)
// There is still a low probability for
ab
s to
// There is still a low probability for
thi
s to
// generate similar hash for different types
int
UrlFactory
::
getIdFromType
(
QString
type
)
{
return
abs
(
qHash
(
type
)
);
}
int
UrlFactory
::
getIdFromType
(
QString
type
)
{
return
(
int
)(
qHash
(
type
)
>>
1
);
}
//-----------------------------------------------------------------------------
int
...
...
@@ -178,19 +178,9 @@ UrlFactory::lat2tileY(QString mapType, double lat, int z)
QGCTileSet
UrlFactory
::
getTileCount
(
int
zoom
,
double
topleftLon
,
double
topleftLat
,
double
bottomRightLon
,
double
bottomRightLat
,
QString
mapType
)
{
//QGCTileSet set;
//if(mapType != "Airmap Elevation"){
// set.tileX0 = long2tileX(mapType, topleftLon, zoom);
// set.tileY0 = lat2tileY(mapType, topleftLat, zoom);
// set.tileX1 = long2tileX(mapType, bottomRightLon, zoom);
// set.tileY1 = lat2tileY(mapType, bottomRightLat, zoom);
//}else{
// set.tileX0 = getQGCMapEngine()->urlFactory()->long2tileX(mapType, topleftLon, zoom);
// set.tileY0 = getQGCMapEngine()->urlFactory()->lat2tileY(mapType, bottomRightLat, zoom);
// set.tileX1 = getQGCMapEngine()->urlFactory()->long2tileX(mapType, bottomRightLon, zoom);
// set.tileY1 = getQGCMapEngine()->urlFactory()->lat2tileY(mapType, topleftLat, zoom);
//}
//set.tileCount = (static_cast<quint64>(set.tileX1) - static_cast<quint64>(set.tileX0) + 1) * (static_cast<quint64>(set.tileY1) - static_cast<quint64>(set.tileY0) + 1);
//set.tileSize = getQGCMapEngine()->urlFactory()->averageSizeForType(mapType) * set.tileCount;
return
_providersTable
[
mapType
]
->
getTileCount
(
zoom
,
topleftLon
,
topleftLat
,
bottomRightLon
,
bottomRightLat
);
}
bool
UrlFactory
::
isElevation
(
int
mapId
){
return
_providersTable
[
getTypeFromId
(
mapId
)]
->
_isElevationProvider
();
}
src/QtLocationPlugin/QGCMapUrlEngine.h
View file @
dd5229fa
...
...
@@ -53,6 +53,8 @@ public:
double
bottomRightLon
,
double
bottomRightLat
,
QString
mapType
);
bool
isElevation
(
int
mapId
);
private:
int
_timeout
;
QHash
<
QString
,
MapProvider
*>
_providersTable
;
...
...
src/QtLocationPlugin/QGeoMapReplyQGC.cpp
View file @
dd5229fa
...
...
@@ -124,12 +124,14 @@ QGeoTiledMapReplyQGC::networkReplyFinished()
QByteArray
a
=
_reply
->
readAll
();
QString
format
=
getQGCMapEngine
()
->
urlFactory
()
->
getImageFormat
(
tileSpec
().
mapId
(),
a
);
//-- Test for a specialized, elevation data (not map tile)
int
AirmapElevationId
=
getQGCMapEngine
()
->
urlFactory
()
->
getIdFromType
(
"Airmap Elevation"
);
if
(
tileSpec
().
mapId
()
==
AirmapElevationId
)
{
if
(
getQGCMapEngine
()
->
urlFactory
()
->
isElevation
(
tileSpec
().
mapId
())){
a
=
TerrainTile
::
serialize
(
a
);
//-- Cache it if valid
if
(
!
a
.
isEmpty
())
{
getQGCMapEngine
()
->
cacheTile
(
"Airmap Elevation"
,
tileSpec
().
x
(),
tileSpec
().
y
(),
tileSpec
().
zoom
(),
a
,
format
);
getQGCMapEngine
()
->
cacheTile
(
getQGCMapEngine
()
->
urlFactory
()
->
getTypeFromId
(
tileSpec
().
mapId
()),
tileSpec
().
x
(),
tileSpec
().
y
(),
tileSpec
().
zoom
(),
a
,
format
);
}
emit
terrainDone
(
a
,
QNetworkReply
::
NoError
);
}
else
{
...
...
@@ -153,8 +155,7 @@ QGeoTiledMapReplyQGC::networkReplyError(QNetworkReply::NetworkError error)
return
;
}
//-- Test for a specialized, elevation data (not map tile)
int
AirmapElevationId
=
getQGCMapEngine
()
->
urlFactory
()
->
getIdFromType
(
"Airmap Elevation"
);
if
(
tileSpec
().
mapId
()
==
AirmapElevationId
)
{
if
(
getQGCMapEngine
()
->
urlFactory
()
->
isElevation
(
tileSpec
().
mapId
())){
emit
terrainDone
(
QByteArray
(),
error
);
}
else
{
//-- Regular map tile
...
...
@@ -172,8 +173,7 @@ void
QGeoTiledMapReplyQGC
::
cacheError
(
QGCMapTask
::
TaskType
type
,
QString
/*errorString*/
)
{
if
(
!
getQGCMapEngine
()
->
isInternetActive
())
{
int
AirmapElevationId
=
getQGCMapEngine
()
->
urlFactory
()
->
getIdFromType
(
"Airmap Elevation"
);
if
(
tileSpec
().
mapId
()
==
AirmapElevationId
)
{
if
(
getQGCMapEngine
()
->
urlFactory
()
->
isElevation
(
tileSpec
().
mapId
())){
emit
terrainDone
(
QByteArray
(),
QNetworkReply
::
NetworkSessionFailedError
);
}
else
{
setError
(
QGeoTiledMapReply
::
CommunicationError
,
"Network not available"
);
...
...
@@ -210,8 +210,7 @@ void
QGeoTiledMapReplyQGC
::
cacheReply
(
QGCCacheTile
*
tile
)
{
//-- Test for a specialized, elevation data (not map tile)
int
AirmapElevationId
=
getQGCMapEngine
()
->
urlFactory
()
->
getIdFromType
(
"Airmap Elevation"
);
if
(
tileSpec
().
mapId
()
==
AirmapElevationId
)
{
if
(
getQGCMapEngine
()
->
urlFactory
()
->
isElevation
(
tileSpec
().
mapId
())){
emit
terrainDone
(
tile
->
img
(),
QNetworkReply
::
NoError
);
}
else
{
//-- Regular map tile
...
...
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