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
ff0e8f6d
Commit
ff0e8f6d
authored
Apr 21, 2017
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restoring MapBox
Experimenting with Esri
parent
76ced324
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
158 additions
and
39 deletions
+158
-39
QGCMapEngine.cpp
src/QtLocationPlugin/QGCMapEngine.cpp
+44
-1
QGCMapEngine.h
src/QtLocationPlugin/QGCMapEngine.h
+3
-0
QGCMapUrlEngine.cpp
src/QtLocationPlugin/QGCMapUrlEngine.cpp
+31
-5
QGCMapUrlEngine.h
src/QtLocationPlugin/QGCMapUrlEngine.h
+7
-1
QGeoTiledMappingManagerEngineQGC.cpp
src/QtLocationPlugin/QGeoTiledMappingManagerEngineQGC.cpp
+11
-19
QGeoTiledMappingManagerEngineQGC.h
src/QtLocationPlugin/QGeoTiledMappingManagerEngineQGC.h
+0
-2
OfflineMap.qml
src/QtLocationPlugin/QMLControl/OfflineMap.qml
+19
-0
QGCMapEngineManager.cc
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc
+14
-0
QGCMapEngineManager.h
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.h
+4
-0
FlightMap.SettingsGroup.json
src/Settings/FlightMap.SettingsGroup.json
+2
-2
FlightMapSettings.cc
src/Settings/FlightMapSettings.cc
+19
-8
FlightMapSettings.h
src/Settings/FlightMapSettings.h
+4
-1
No files found.
src/QtLocationPlugin/QGCMapEngine.cpp
View file @
ff0e8f6d
...
@@ -52,9 +52,9 @@ stQGeoTileCacheQGCMapTypes kMapTypes[] = {
...
@@ -52,9 +52,9 @@ stQGeoTileCacheQGCMapTypes kMapTypes[] = {
{
"Bing Satellite Map"
,
UrlFactory
::
BingSatellite
},
{
"Bing Satellite Map"
,
UrlFactory
::
BingSatellite
},
{
"Bing Hybrid Map"
,
UrlFactory
::
BingHybrid
},
{
"Bing Hybrid Map"
,
UrlFactory
::
BingHybrid
},
{
"Statkart Topo2"
,
UrlFactory
::
StatkartTopo
},
{
"Statkart Topo2"
,
UrlFactory
::
StatkartTopo
},
/*
{"MapQuest Street Map", UrlFactory::MapQuestMap},
{"MapQuest Street Map", UrlFactory::MapQuestMap},
{"MapQuest Satellite Map", UrlFactory::MapQuestSat}
{"MapQuest Satellite Map", UrlFactory::MapQuestSat}
/*
{"Open Street Map", UrlFactory::OpenStreetMap}
{"Open Street Map", UrlFactory::OpenStreetMap}
*/
*/
};
};
...
@@ -80,7 +80,16 @@ stQGeoTileCacheQGCMapTypes kMapBoxTypes[] = {
...
@@ -80,7 +80,16 @@ stQGeoTileCacheQGCMapTypes kMapBoxTypes[] = {
#define NUM_MAPBOXMAPS (sizeof(kMapBoxTypes) / sizeof(stQGeoTileCacheQGCMapTypes))
#define NUM_MAPBOXMAPS (sizeof(kMapBoxTypes) / sizeof(stQGeoTileCacheQGCMapTypes))
stQGeoTileCacheQGCMapTypes
kEsriTypes
[]
=
{
{
"Esri Street Map"
,
UrlFactory
::
EsriWorldStreet
},
{
"Esri Satellite Map"
,
UrlFactory
::
EsriWorldSatellite
},
{
"Esri Terrain Map"
,
UrlFactory
::
EsriTerrain
}
};
#define NUM_ESRIMAPS (sizeof(kEsriTypes) / sizeof(stQGeoTileCacheQGCMapTypes))
static
const
char
*
kMapBoxTokenKey
=
"MapBoxToken"
;
static
const
char
*
kMapBoxTokenKey
=
"MapBoxToken"
;
static
const
char
*
kEsriTokenKey
=
"EsriToken"
;
static
const
char
*
kMaxDiskCacheKey
=
"MaxDiskCache"
;
static
const
char
*
kMaxDiskCacheKey
=
"MaxDiskCache"
;
static
const
char
*
kMaxMemCacheKey
=
"MaxMemoryCache"
;
static
const
char
*
kMaxMemCacheKey
=
"MaxMemoryCache"
;
...
@@ -322,6 +331,10 @@ QGCMapEngine::getTypeFromName(const QString& name)
...
@@ -322,6 +331,10 @@ QGCMapEngine::getTypeFromName(const QString& name)
if
(
name
.
compare
(
kMapBoxTypes
[
i
].
name
,
Qt
::
CaseInsensitive
)
==
0
)
if
(
name
.
compare
(
kMapBoxTypes
[
i
].
name
,
Qt
::
CaseInsensitive
)
==
0
)
return
kMapBoxTypes
[
i
].
type
;
return
kMapBoxTypes
[
i
].
type
;
}
}
for
(
i
=
0
;
i
<
NUM_ESRIMAPS
;
i
++
)
{
if
(
name
.
compare
(
kEsriTypes
[
i
].
name
,
Qt
::
CaseInsensitive
)
==
0
)
return
kEsriTypes
[
i
].
type
;
}
return
UrlFactory
::
Invalid
;
return
UrlFactory
::
Invalid
;
}
}
...
@@ -338,6 +351,11 @@ QGCMapEngine::getMapNameList()
...
@@ -338,6 +351,11 @@ QGCMapEngine::getMapNameList()
mapList
<<
kMapBoxTypes
[
i
].
name
;
mapList
<<
kMapBoxTypes
[
i
].
name
;
}
}
}
}
if
(
!
getEsriToken
().
isEmpty
())
{
for
(
size_t
i
=
0
;
i
<
NUM_ESRIMAPS
;
i
++
)
{
mapList
<<
kEsriTypes
[
i
].
name
;
}
}
return
mapList
;
return
mapList
;
}
}
...
@@ -350,6 +368,15 @@ QGCMapEngine::setMapBoxToken(const QString& token)
...
@@ -350,6 +368,15 @@ QGCMapEngine::setMapBoxToken(const QString& token)
_mapBoxToken
=
token
;
_mapBoxToken
=
token
;
}
}
//-----------------------------------------------------------------------------
void
QGCMapEngine
::
setEsriToken
(
const
QString
&
token
)
{
QSettings
settings
;
settings
.
setValue
(
kEsriTokenKey
,
token
);
_esriToken
=
token
;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
QString
QString
QGCMapEngine
::
getMapBoxToken
()
QGCMapEngine
::
getMapBoxToken
()
...
@@ -361,6 +388,17 @@ QGCMapEngine::getMapBoxToken()
...
@@ -361,6 +388,17 @@ QGCMapEngine::getMapBoxToken()
return
_mapBoxToken
;
return
_mapBoxToken
;
}
}
//-----------------------------------------------------------------------------
QString
QGCMapEngine
::
getEsriToken
()
{
if
(
_esriToken
.
isEmpty
())
{
QSettings
settings
;
_esriToken
=
settings
.
value
(
kEsriTokenKey
).
toString
();
}
return
_esriToken
;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
quint32
quint32
QGCMapEngine
::
getMaxDiskCache
()
QGCMapEngine
::
getMaxDiskCache
()
...
@@ -467,10 +505,15 @@ QGCMapEngine::concurrentDownloads(UrlFactory::MapType type)
...
@@ -467,10 +505,15 @@ QGCMapEngine::concurrentDownloads(UrlFactory::MapType type)
case
UrlFactory
:
:
BingSatellite
:
case
UrlFactory
:
:
BingSatellite
:
case
UrlFactory
:
:
BingHybrid
:
case
UrlFactory
:
:
BingHybrid
:
case
UrlFactory
:
:
StatkartTopo
:
case
UrlFactory
:
:
StatkartTopo
:
case
UrlFactory
:
:
EsriWorldStreet
:
case
UrlFactory
:
:
EsriWorldSatellite
:
case
UrlFactory
:
:
EsriTerrain
:
return
12
;
return
12
;
/*
case UrlFactory::MapQuestMap:
case UrlFactory::MapQuestMap:
case UrlFactory::MapQuestSat:
case UrlFactory::MapQuestSat:
return 8;
return 8;
*/
default:
default:
break
;
break
;
}
}
...
...
src/QtLocationPlugin/QGCMapEngine.h
View file @
ff0e8f6d
...
@@ -79,7 +79,9 @@ public:
...
@@ -79,7 +79,9 @@ public:
void
setUserAgent
(
const
QString
&
ua
)
{
_userAgent
=
ua
;
}
void
setUserAgent
(
const
QString
&
ua
)
{
_userAgent
=
ua
;
}
UrlFactory
::
MapType
hashToType
(
const
QString
&
hash
);
UrlFactory
::
MapType
hashToType
(
const
QString
&
hash
);
QString
getMapBoxToken
();
QString
getMapBoxToken
();
QString
getEsriToken
();
void
setMapBoxToken
(
const
QString
&
token
);
void
setMapBoxToken
(
const
QString
&
token
);
void
setEsriToken
(
const
QString
&
token
);
quint32
getMaxDiskCache
();
quint32
getMaxDiskCache
();
void
setMaxDiskCache
(
quint32
size
);
void
setMaxDiskCache
(
quint32
size
);
quint32
getMaxMemCache
();
quint32
getMaxMemCache
();
...
@@ -120,6 +122,7 @@ private:
...
@@ -120,6 +122,7 @@ private:
QString
_cachePath
;
QString
_cachePath
;
QString
_cacheFile
;
QString
_cacheFile
;
QString
_mapBoxToken
;
QString
_mapBoxToken
;
QString
_esriToken
;
UrlFactory
*
_urlFactory
;
UrlFactory
*
_urlFactory
;
QString
_userAgent
;
QString
_userAgent
;
quint32
_maxDiskCache
;
quint32
_maxDiskCache
;
...
...
src/QtLocationPlugin/QGCMapUrlEngine.cpp
View file @
ff0e8f6d
...
@@ -30,6 +30,10 @@
...
@@ -30,6 +30,10 @@
#include <QStandardPaths>
#include <QStandardPaths>
#endif
#endif
static
const
unsigned
char
pngSignature
[]
=
{
0x89
,
0x50
,
0x4E
,
0x47
,
0x0D
,
0x0A
,
0x1A
,
0x0A
,
0x00
};
static
const
unsigned
char
jpegSignature
[]
=
{
0xFF
,
0xD8
,
0xFF
,
0x00
};
static
const
unsigned
char
gifSignature
[]
=
{
0x47
,
0x49
,
0x46
,
0x38
,
0x00
};
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
UrlFactory
::
UrlFactory
()
UrlFactory
::
UrlFactory
()
:
_timeout
(
5
*
1000
)
:
_timeout
(
5
*
1000
)
...
@@ -72,10 +76,12 @@ UrlFactory::getImageFormat(MapType type, const QByteArray& image)
...
@@ -72,10 +76,12 @@ UrlFactory::getImageFormat(MapType type, const QByteArray& image)
QString
format
;
QString
format
;
if
(
image
.
size
()
>
2
)
if
(
image
.
size
()
>
2
)
{
{
if
((
char
)
image
[
0
]
==
(
char
)
0xff
&&
(
char
)
image
[
1
]
==
(
char
)
0xd8
)
if
(
image
.
startsWith
(
reinterpret_cast
<
const
char
*>
(
pngSignature
)))
format
=
"jpg"
;
else
if
((
char
)
image
[
0
]
==
(
char
)
0x89
&&
(
char
)
image
[
1
]
==
(
char
)
0x50
)
format
=
"png"
;
format
=
"png"
;
else
if
(
image
.
startsWith
(
reinterpret_cast
<
const
char
*>
(
jpegSignature
)))
format
=
"jpg"
;
else
if
(
image
.
startsWith
(
reinterpret_cast
<
const
char
*>
(
gifSignature
)))
format
=
"gif"
;
else
{
else
{
switch
(
type
)
{
switch
(
type
)
{
case
GoogleMap
:
case
GoogleMap
:
...
@@ -83,12 +89,14 @@ UrlFactory::getImageFormat(MapType type, const QByteArray& image)
...
@@ -83,12 +89,14 @@ UrlFactory::getImageFormat(MapType type, const QByteArray& image)
case
GoogleTerrain
:
case
GoogleTerrain
:
case
GoogleHybrid
:
case
GoogleHybrid
:
case
BingMap
:
case
BingMap
:
case
OpenStreetMap
:
case
StatkartTopo
:
case
StatkartTopo
:
format
=
"png"
;
format
=
"png"
;
break
;
break
;
/*
case MapQuestMap:
case MapQuestMap:
case MapQuestSat:
case MapQuestSat:
case OpenStreetMap:
*/
case
MapBoxStreets
:
case
MapBoxStreets
:
case
MapBoxLight
:
case
MapBoxLight
:
case
MapBoxDark
:
case
MapBoxDark
:
...
@@ -128,7 +136,6 @@ UrlFactory::getTileURL(MapType type, int x, int y, int zoom, QNetworkAccessManag
...
@@ -128,7 +136,6 @@ UrlFactory::getTileURL(MapType type, int x, int y, int zoom, QNetworkAccessManag
return
request
;
return
request
;
request
.
setUrl
(
QUrl
(
url
));
request
.
setUrl
(
QUrl
(
url
));
request
.
setRawHeader
(
"Accept"
,
"*/*"
);
request
.
setRawHeader
(
"Accept"
,
"*/*"
);
request
.
setRawHeader
(
"User-Agent"
,
_userAgent
);
switch
(
type
)
{
switch
(
type
)
{
#ifndef QGC_NO_GOOGLE_MAPS
#ifndef QGC_NO_GOOGLE_MAPS
case
GoogleMap
:
case
GoogleMap
:
...
@@ -157,9 +164,20 @@ UrlFactory::getTileURL(MapType type, int x, int y, int zoom, QNetworkAccessManag
...
@@ -157,9 +164,20 @@ UrlFactory::getTileURL(MapType type, int x, int y, int zoom, QNetworkAccessManag
request.setRawHeader("Referrer", "https://www.openstreetmap.org/");
request.setRawHeader("Referrer", "https://www.openstreetmap.org/");
break;
break;
*/
*/
case
EsriWorldStreet
:
case
EsriWorldSatellite
:
case
EsriTerrain
:
{
QByteArray
token
=
getQGCMapEngine
()
->
getEsriToken
().
toLatin1
();
request
.
setRawHeader
(
"User-Agent"
,
QByteArrayLiteral
(
"Qt Location based application"
));
request
.
setRawHeader
(
"User-Token"
,
token
);
}
return
request
;
default:
default:
break
;
break
;
}
}
request
.
setRawHeader
(
"User-Agent"
,
_userAgent
);
return
request
;
return
request
;
}
}
...
@@ -281,6 +299,7 @@ UrlFactory::_getURL(MapType type, int x, int y, int zoom, QNetworkAccessManager*
...
@@ -281,6 +299,7 @@ UrlFactory::_getURL(MapType type, int x, int y, int zoom, QNetworkAccessManager*
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
QString
key
=
_tileXYToQuadKey
(
x
,
y
,
zoom
);
return
QString
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/h%2.jpeg?g=%3&mkt=%4"
).
arg
(
_getServerNum
(
x
,
y
,
4
)).
arg
(
key
).
arg
(
_versionBingMaps
).
arg
(
_language
);
return
QString
(
"http://ecn.t%1.tiles.virtualearth.net/tiles/h%2.jpeg?g=%3&mkt=%4"
).
arg
(
_getServerNum
(
x
,
y
,
4
)).
arg
(
key
).
arg
(
_versionBingMaps
).
arg
(
_language
);
}
}
/*
case MapQuestMap:
case MapQuestMap:
{
{
char letter = "1234"[_getServerNum(x, y, 4)];
char letter = "1234"[_getServerNum(x, y, 4)];
...
@@ -293,6 +312,13 @@ UrlFactory::_getURL(MapType type, int x, int y, int zoom, QNetworkAccessManager*
...
@@ -293,6 +312,13 @@ UrlFactory::_getURL(MapType type, int x, int y, int zoom, QNetworkAccessManager*
return QString("http://otile%1.mqcdn.com/tiles/1.0.0/sat/%2/%3/%4.jpg").arg(letter).arg(zoom).arg(x).arg(y);
return QString("http://otile%1.mqcdn.com/tiles/1.0.0/sat/%2/%3/%4.jpg").arg(letter).arg(zoom).arg(x).arg(y);
}
}
break;
break;
*/
case
EsriWorldStreet
:
return
QString
(
"http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/%1/%2/%3"
).
arg
(
zoom
).
arg
(
y
).
arg
(
x
);
case
EsriWorldSatellite
:
return
QString
(
"http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/%1/%2/%3"
).
arg
(
zoom
).
arg
(
y
).
arg
(
x
);
case
EsriTerrain
:
return
QString
(
"http://server.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/%1/%2/%3"
).
arg
(
zoom
).
arg
(
y
).
arg
(
x
);
case
MapBoxStreets
:
case
MapBoxStreets
:
case
MapBoxLight
:
case
MapBoxLight
:
...
...
src/QtLocationPlugin/QGCMapUrlEngine.h
View file @
ff0e8f6d
...
@@ -50,8 +50,10 @@ public:
...
@@ -50,8 +50,10 @@ public:
BingSatellite
=
555
,
BingSatellite
=
555
,
BingHybrid
=
666
,
BingHybrid
=
666
,
/*
MapQuestMap = 700,
MapQuestMap = 700,
MapQuestSat = 701,
MapQuestSat = 701,
*/
MapBoxStreets
=
6000
,
MapBoxStreets
=
6000
,
MapBoxLight
=
6001
,
MapBoxLight
=
6001
,
...
@@ -66,7 +68,11 @@ public:
...
@@ -66,7 +68,11 @@ public:
MapBoxPencil
=
6010
,
MapBoxPencil
=
6010
,
MapBoxPirates
=
6011
,
MapBoxPirates
=
6011
,
MapBoxEmerald
=
6012
,
MapBoxEmerald
=
6012
,
MapBoxHighContrast
=
6013
MapBoxHighContrast
=
6013
,
EsriWorldStreet
=
7000
,
EsriWorldSatellite
=
7001
,
EsriTerrain
=
7002
};
};
UrlFactory
();
UrlFactory
();
...
...
src/QtLocationPlugin/QGeoTiledMappingManagerEngineQGC.cpp
View file @
ff0e8f6d
...
@@ -87,10 +87,9 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
...
@@ -87,10 +87,9 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
setTileSize
(
QSize
(
256
,
256
));
setTileSize
(
QSize
(
256
,
256
));
/*
/*
*
Most of these
don't seem kosher at all. This was based on original code from OpenPilot and heavily modified to be used in QGC.
*
Google and Bing
don't seem kosher at all. This was based on original code from OpenPilot and heavily modified to be used in QGC.
*/
*/
//-- IMPORTANT
//-- IMPORTANT
// Changes here must reflect those in QGCMapEngine.cpp
// Changes here must reflect those in QGCMapEngine.cpp
...
@@ -103,19 +102,24 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
...
@@ -103,19 +102,24 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
#endif
#endif
/* TODO:
/* TODO:
* Proper google hybrid maps requires collecting two separate bimaps and overlaying them.
* Proper google hybrid maps requires collecting two separate bi
t
maps and overlaying them.
*
*
* mapTypes << QGeoMapType(QGeoMapType::HybridMap, "Google Hybrid Map", "Google hybrid map", false, false, UrlFactory::GoogleHybrid);
* mapTypes << QGeoMapType(QGeoMapType::HybridMap, "Google Hybrid Map", "Google hybrid map", false, false, UrlFactory::GoogleHybrid);
*
*
*/
*/
// Bing
// Bing
mapTypes
<<
QGeoMapType
(
QGeoMapType
::
StreetMap
,
"Bing Street Map"
,
"Bing street map"
,
false
,
false
,
UrlFactory
::
BingMap
);
mapTypes
<<
QGeoMapType
(
QGeoMapType
::
StreetMap
,
"Bing Street Map"
,
"Bing street map"
,
false
,
false
,
UrlFactory
::
BingMap
);
mapTypes
<<
QGeoMapType
(
QGeoMapType
::
SatelliteMapDay
,
"Bing Satellite Map"
,
"Bing satellite map"
,
false
,
false
,
UrlFactory
::
BingSatellite
);
mapTypes
<<
QGeoMapType
(
QGeoMapType
::
SatelliteMapDay
,
"Bing Satellite Map"
,
"Bing satellite map"
,
false
,
false
,
UrlFactory
::
BingSatellite
);
mapTypes
<<
QGeoMapType
(
QGeoMapType
::
HybridMap
,
"Bing Hybrid Map"
,
"Bing hybrid map"
,
false
,
false
,
UrlFactory
::
BingHybrid
);
mapTypes
<<
QGeoMapType
(
QGeoMapType
::
HybridMap
,
"Bing Hybrid Map"
,
"Bing hybrid map"
,
false
,
false
,
UrlFactory
::
BingHybrid
);
// Statkart
// Statkart
mapTypes
<<
QGeoMapType
(
QGeoMapType
::
TerrainMap
,
"Statkart Topo2"
,
"Statkart Topo2"
,
false
,
false
,
UrlFactory
::
StatkartTopo
);
mapTypes
<<
QGeoMapType
(
QGeoMapType
::
TerrainMap
,
"Statkart Topo2"
,
"Statkart Topo2"
,
false
,
false
,
UrlFactory
::
StatkartTopo
);
// Esri
mapTypes
<<
QGeoMapType
(
QGeoMapType
::
StreetMap
,
"Esri Street Map"
,
"ArcGIS Online World Street Map"
,
true
,
false
,
UrlFactory
::
EsriWorldStreet
);
mapTypes
<<
QGeoMapType
(
QGeoMapType
::
SatelliteMapDay
,
"Esri Satellite Map"
,
"ArcGIS Online World Imagery"
,
true
,
false
,
UrlFactory
::
EsriWorldSatellite
);
mapTypes
<<
QGeoMapType
(
QGeoMapType
::
TerrainMap
,
"Esri Terrain Map"
,
"World Terrain Base"
,
false
,
false
,
UrlFactory
::
EsriTerrain
);
/* See: https://wiki.openstreetmap.org/wiki/Tile_usage_policy
/* See: https://wiki.openstreetmap.org/wiki/Tile_usage_policy
mapTypes << QGeoMapType(QGeoMapType::StreetMap, "Open Street Map", "Open Street map", false, false, UrlFactory::OpenStreetMap);
mapTypes << QGeoMapType(QGeoMapType::StreetMap, "Open Street Map", "Open Street map", false, false, UrlFactory::OpenStreetMap);
...
@@ -161,11 +165,6 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
...
@@ -161,11 +165,6 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
*
error
=
QGeoServiceProvider
::
NoError
;
*
error
=
QGeoServiceProvider
::
NoError
;
errorString
->
clear
();
errorString
->
clear
();
#if QT_VERSION >= 0x050500
if
(
parameters
.
contains
(
QStringLiteral
(
"mapping.copyright"
)))
m_customCopyright
=
parameters
.
value
(
QStringLiteral
(
"mapping.copyright"
)).
toString
().
toLatin1
();
#endif
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
...
@@ -190,13 +189,6 @@ QGeoTiledMappingManagerEngineQGC::createMap()
...
@@ -190,13 +189,6 @@ QGeoTiledMappingManagerEngineQGC::createMap()
return
new
QGeoTiledMapQGC
(
this
);
return
new
QGeoTiledMapQGC
(
this
);
}
}
//-----------------------------------------------------------------------------
QString
QGeoTiledMappingManagerEngineQGC
::
customCopyright
()
const
{
return
m_customCopyright
;
}
#endif
#endif
#if QT_VERSION >= 0x050500
#if QT_VERSION >= 0x050500
...
...
src/QtLocationPlugin/QGeoTiledMappingManagerEngineQGC.h
View file @
ff0e8f6d
...
@@ -74,11 +74,9 @@ public:
...
@@ -74,11 +74,9 @@ public:
QGeoMapData
*
createMapData
();
QGeoMapData
*
createMapData
();
#else
#else
QGeoMap
*
createMap
();
QGeoMap
*
createMap
();
QString
customCopyright
()
const
;
#endif
#endif
private:
private:
#if QT_VERSION >= 0x050500
#if QT_VERSION >= 0x050500
QString
m_customCopyright
;
void
_setCache
(
const
QVariantMap
&
parameters
);
void
_setCache
(
const
QVariantMap
&
parameters
);
#endif
#endif
};
};
...
...
src/QtLocationPlugin/QMLControl/OfflineMap.qml
View file @
ff0e8f6d
...
@@ -89,8 +89,10 @@ QGCView {
...
@@ -89,8 +89,10 @@ QGCView {
function
updateMap
()
{
function
updateMap
()
{
for
(
var
i
=
0
;
i
<
_map
.
supportedMapTypes
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
_map
.
supportedMapTypes
.
length
;
i
++
)
{
console
.
log
(
_map
.
supportedMapTypes
[
i
].
name
)
if
(
mapType
===
_map
.
supportedMapTypes
[
i
].
name
)
{
if
(
mapType
===
_map
.
supportedMapTypes
[
i
].
name
)
{
_map
.
activeMapType
=
_map
.
supportedMapTypes
[
i
]
_map
.
activeMapType
=
_map
.
supportedMapTypes
[
i
]
console
.
log
(
"
Update Map:
"
+
"
"
+
_map
.
activeMapType
)
handleChanges
()
handleChanges
()
return
return
}
}
...
@@ -226,6 +228,7 @@ QGCView {
...
@@ -226,6 +228,7 @@ QGCView {
function
accept
()
{
function
accept
()
{
QGroundControl
.
mapEngineManager
.
mapboxToken
=
mapBoxToken
.
text
QGroundControl
.
mapEngineManager
.
mapboxToken
=
mapBoxToken
.
text
QGroundControl
.
mapEngineManager
.
esriToken
=
esriToken
.
text
QGroundControl
.
mapEngineManager
.
maxDiskCache
=
parseInt
(
maxCacheSize
.
text
)
QGroundControl
.
mapEngineManager
.
maxDiskCache
=
parseInt
(
maxCacheSize
.
text
)
QGroundControl
.
mapEngineManager
.
maxMemCache
=
parseInt
(
maxCacheMemSize
.
text
)
QGroundControl
.
mapEngineManager
.
maxMemCache
=
parseInt
(
maxCacheMemSize
.
text
)
optionDialog
.
hideDialog
()
optionDialog
.
hideDialog
()
...
@@ -285,6 +288,22 @@ QGCView {
...
@@ -285,6 +288,22 @@ QGCView {
text
:
qsTr
(
"
With an access token, you can use MapBox Maps.
"
)
text
:
qsTr
(
"
With an access token, you can use MapBox Maps.
"
)
font.pointSize
:
_adjustableFontPointSize
font.pointSize
:
_adjustableFontPointSize
}
}
Item
{
width
:
1
;
height
:
1
}
QGCLabel
{
text
:
qsTr
(
"
Esri Access Token
"
)
}
QGCTextField
{
id
:
esriToken
maximumLength
:
256
width
:
ScreenTools
.
defaultFontPixelWidth
*
30
text
:
QGroundControl
.
mapEngineManager
.
esriToken
}
QGCLabel
{
text
:
qsTr
(
"
With an access token, you can use Esri Maps.
"
)
font.pointSize
:
_adjustableFontPointSize
}
}
// GridLayout
}
// GridLayout
}
// QGCFlickable
}
// QGCFlickable
}
// QGCViewDialog - optionsDialog
}
// QGCViewDialog - optionsDialog
...
...
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc
View file @
ff0e8f6d
...
@@ -209,6 +209,20 @@ QGCMapEngineManager::setMapboxToken(QString token)
...
@@ -209,6 +209,20 @@ QGCMapEngineManager::setMapboxToken(QString token)
getQGCMapEngine
()
->
setMapBoxToken
(
token
);
getQGCMapEngine
()
->
setMapBoxToken
(
token
);
}
}
//-----------------------------------------------------------------------------
QString
QGCMapEngineManager
::
esriToken
()
{
return
getQGCMapEngine
()
->
getEsriToken
();
}
//-----------------------------------------------------------------------------
void
QGCMapEngineManager
::
setEsriToken
(
QString
token
)
{
getQGCMapEngine
()
->
setEsriToken
(
token
);
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
quint32
quint32
QGCMapEngineManager
::
maxMemCache
()
QGCMapEngineManager
::
maxMemCache
()
...
...
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.h
View file @
ff0e8f6d
...
@@ -48,6 +48,7 @@ public:
...
@@ -48,6 +48,7 @@ public:
Q_PROPERTY
(
QmlObjectListModel
*
tileSets
READ
tileSets
NOTIFY
tileSetsChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
tileSets
READ
tileSets
NOTIFY
tileSetsChanged
)
Q_PROPERTY
(
QStringList
mapList
READ
mapList
CONSTANT
)
Q_PROPERTY
(
QStringList
mapList
READ
mapList
CONSTANT
)
Q_PROPERTY
(
QString
mapboxToken
READ
mapboxToken
WRITE
setMapboxToken
NOTIFY
mapboxTokenChanged
)
Q_PROPERTY
(
QString
mapboxToken
READ
mapboxToken
WRITE
setMapboxToken
NOTIFY
mapboxTokenChanged
)
Q_PROPERTY
(
QString
esriToken
READ
esriToken
WRITE
setEsriToken
NOTIFY
esriTokenChanged
)
Q_PROPERTY
(
quint32
maxMemCache
READ
maxMemCache
WRITE
setMaxMemCache
NOTIFY
maxMemCacheChanged
)
Q_PROPERTY
(
quint32
maxMemCache
READ
maxMemCache
WRITE
setMaxMemCache
NOTIFY
maxMemCacheChanged
)
Q_PROPERTY
(
quint32
maxDiskCache
READ
maxDiskCache
WRITE
setMaxDiskCache
NOTIFY
maxDiskCacheChanged
)
Q_PROPERTY
(
quint32
maxDiskCache
READ
maxDiskCache
WRITE
setMaxDiskCache
NOTIFY
maxDiskCacheChanged
)
Q_PROPERTY
(
QString
errorMessage
READ
errorMessage
NOTIFY
errorMessageChanged
)
Q_PROPERTY
(
QString
errorMessage
READ
errorMessage
NOTIFY
errorMessageChanged
)
...
@@ -85,6 +86,7 @@ public:
...
@@ -85,6 +86,7 @@ public:
QString
tileSizeStr
();
QString
tileSizeStr
();
QStringList
mapList
();
QStringList
mapList
();
QString
mapboxToken
();
QString
mapboxToken
();
QString
esriToken
();
QmlObjectListModel
*
tileSets
()
{
return
&
_tileSets
;
}
QmlObjectListModel
*
tileSets
()
{
return
&
_tileSets
;
}
quint32
maxMemCache
();
quint32
maxMemCache
();
quint32
maxDiskCache
();
quint32
maxDiskCache
();
...
@@ -97,6 +99,7 @@ public:
...
@@ -97,6 +99,7 @@ public:
bool
importReplace
()
{
return
_importReplace
;
}
bool
importReplace
()
{
return
_importReplace
;
}
void
setMapboxToken
(
QString
token
);
void
setMapboxToken
(
QString
token
);
void
setEsriToken
(
QString
token
);
void
setMaxMemCache
(
quint32
size
);
void
setMaxMemCache
(
quint32
size
);
void
setMaxDiskCache
(
quint32
size
);
void
setMaxDiskCache
(
quint32
size
);
void
setImportReplace
(
bool
replace
)
{
_importReplace
=
replace
;
emit
importReplaceChanged
();
}
void
setImportReplace
(
bool
replace
)
{
_importReplace
=
replace
;
emit
importReplaceChanged
();
}
...
@@ -114,6 +117,7 @@ signals:
...
@@ -114,6 +117,7 @@ signals:
void
tileCountChanged
();
void
tileCountChanged
();
void
tileSizeChanged
();
void
tileSizeChanged
();
void
mapboxTokenChanged
();
void
mapboxTokenChanged
();
void
esriTokenChanged
();
void
tileSetsChanged
();
void
tileSetsChanged
();
void
maxMemCacheChanged
();
void
maxMemCacheChanged
();
void
maxDiskCacheChanged
();
void
maxDiskCacheChanged
();
...
...
src/Settings/FlightMap.SettingsGroup.json
View file @
ff0e8f6d
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
"name"
:
"MapProvider"
,
"name"
:
"MapProvider"
,
"shortDescription"
:
"Currently selected map provider for flight maps"
,
"shortDescription"
:
"Currently selected map provider for flight maps"
,
"type"
:
"uint32"
,
"type"
:
"uint32"
,
"enumStrings"
:
"Bing,Google,Statkart"
,
"enumStrings"
:
"Bing,Google,Statkart
,MapBox,Esri
"
,
"enumValues"
:
"0,1,2"
,
"enumValues"
:
"0,1,2
,3,4
"
,
"defaultValue"
:
0
"defaultValue"
:
0
},
},
{
{
...
...
src/Settings/FlightMapSettings.cc
View file @
ff0e8f6d
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
****************************************************************************/
****************************************************************************/
#include "FlightMapSettings.h"
#include "FlightMapSettings.h"
#include "QGCMapEngine.h"
#include <QQmlEngine>
#include <QQmlEngine>
#include <QtQml>
#include <QtQml>
...
@@ -27,17 +28,18 @@ FlightMapSettings::FlightMapSettings(QObject* parent)
...
@@ -27,17 +28,18 @@ FlightMapSettings::FlightMapSettings(QObject* parent)
// Save the original version since we modify based on map provider
// Save the original version since we modify based on map provider
_savedMapTypeStrings
=
_nameToMetaDataMap
[
mapTypeSettingsName
]
->
enumStrings
();
_savedMapTypeStrings
=
_nameToMetaDataMap
[
mapTypeSettingsName
]
->
enumStrings
();
_savedMapTypeValues
=
_nameToMetaDataMap
[
mapTypeSettingsName
]
->
enumValues
();
_savedMapTypeValues
=
_nameToMetaDataMap
[
mapTypeSettingsName
]
->
enumValues
();
#ifdef QGC_NO_GOOGLE_MAPS
#ifdef QGC_NO_GOOGLE_MAPS
// Find google in the list and remove it
//-- Remove Google
FactMetaData
*
metaData
=
_nameToMetaDataMap
[
mapProviderSettingsName
];
_excludeProvider
(
mapProviderGoogle
);
QVariantList
enumValues
=
metaData
->
enumValues
();
QStringList
enumStrings
=
metaData
->
enumStrings
();
_removeEnumValue
(
mapProviderGoogle
,
enumStrings
,
enumValues
);
metaData
->
setEnumInfo
(
enumStrings
,
enumValues
);
#endif
#endif
if
(
getQGCMapEngine
()
->
getMapBoxToken
().
isEmpty
())
{
_excludeProvider
(
mapProviderMapBox
);
}
if
(
getQGCMapEngine
()
->
getEsriToken
().
isEmpty
())
{
_excludeProvider
(
mapProviderEsri
);
}
_newMapProvider
(
mapProvider
()
->
rawValue
());
_newMapProvider
(
mapProvider
()
->
rawValue
());
}
}
...
@@ -60,6 +62,15 @@ Fact* FlightMapSettings::mapType(void)
...
@@ -60,6 +62,15 @@ Fact* FlightMapSettings::mapType(void)
return
_mapTypeFact
;
return
_mapTypeFact
;
}
}
void
FlightMapSettings
::
_excludeProvider
(
MapProvider_t
provider
)
{
FactMetaData
*
metaData
=
_nameToMetaDataMap
[
mapProviderSettingsName
];
QVariantList
enumValues
=
metaData
->
enumValues
();
QStringList
enumStrings
=
metaData
->
enumStrings
();
_removeEnumValue
(
provider
,
enumStrings
,
enumValues
);
metaData
->
setEnumInfo
(
enumStrings
,
enumValues
);
}
void
FlightMapSettings
::
_removeEnumValue
(
int
value
,
QStringList
&
enumStrings
,
QVariantList
&
enumValues
)
void
FlightMapSettings
::
_removeEnumValue
(
int
value
,
QStringList
&
enumStrings
,
QVariantList
&
enumValues
)
{
{
bool
found
=
false
;
bool
found
=
false
;
...
...
src/Settings/FlightMapSettings.h
View file @
ff0e8f6d
...
@@ -23,7 +23,9 @@ public:
...
@@ -23,7 +23,9 @@ public:
typedef
enum
{
typedef
enum
{
mapProviderBing
,
mapProviderBing
,
mapProviderGoogle
,
mapProviderGoogle
,
mapProviderStarkart
mapProviderStarkart
,
mapProviderMapBox
,
mapProviderEsri
}
MapProvider_t
;
}
MapProvider_t
;
// This enum must match the json meta data
// This enum must match the json meta data
...
@@ -52,6 +54,7 @@ private slots:
...
@@ -52,6 +54,7 @@ private slots:
private:
private:
void
_removeEnumValue
(
int
value
,
QStringList
&
enumStrings
,
QVariantList
&
enumValues
);
void
_removeEnumValue
(
int
value
,
QStringList
&
enumStrings
,
QVariantList
&
enumValues
);
void
_excludeProvider
(
MapProvider_t
provider
);
SettingsFact
*
_mapProviderFact
;
SettingsFact
*
_mapProviderFact
;
SettingsFact
*
_mapTypeFact
;
SettingsFact
*
_mapTypeFact
;
...
...
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