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
e9914d19
Commit
e9914d19
authored
Aug 01, 2016
by
dogmaphobic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restrict map providers for iOS.
parent
0538e94e
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
86 additions
and
34 deletions
+86
-34
QGCCommon.pri
QGCCommon.pri
+1
-0
iOS-Info.plist
ios/iOS-Info.plist
+2
-2
FlightMapSettings.cc
src/FlightMap/FlightMapSettings.cc
+12
-21
FlightMapSettings.h
src/FlightMap/FlightMapSettings.h
+16
-0
QGCMapEngine.cpp
src/QtLocationPlugin/QGCMapEngine.cpp
+2
-0
QGCMapUrlEngine.cpp
src/QtLocationPlugin/QGCMapUrlEngine.cpp
+22
-1
QGCMapUrlEngine.h
src/QtLocationPlugin/QGCMapUrlEngine.h
+13
-5
QGeoCodeReplyQGC.cpp
src/QtLocationPlugin/QGeoCodeReplyQGC.cpp
+4
-4
QGeoTiledMappingManagerEngineQGC.cpp
src/QtLocationPlugin/QGeoTiledMappingManagerEngineQGC.cpp
+5
-0
GeneralSettings.qml
src/ui/preferences/GeneralSettings.qml
+9
-1
No files found.
QGCCommon.pri
View file @
e9914d19
...
...
@@ -71,6 +71,7 @@ equals(QT_MAJOR_VERSION, 5) | greaterThan(QT_MINOR_VERSION, 5) {
message("iOS build")
CONFIG += iOSBuild MobileBuild app_bundle
DEFINES += __ios__
DEFINES += QGC_NO_GOOGLE_MAPS
QMAKE_IOS_DEPLOYMENT_TARGET = 8.0
QMAKE_IOS_TARGETED_DEVICE_FAMILY = 1,2 # Universal
QMAKE_LFLAGS += -Wl,-no_pie
...
...
ios/iOS-Info.plist
View file @
e9914d19
...
...
@@ -5,7 +5,7 @@
<key>
CFBundleDisplayName
</key>
<string>
QGroundControl
</string>
<key>
CFBundleExecutable
</key>
<string>
qgroundcontrol
</string>
<string>
$(EXECUTABLE_NAME)
</string>
<key>
NSHumanReadableCopyright
</key>
<string>
Open Source Flight Systems GmbH - Internal Build
</string>
<key>
CFBundleIconFile
</key>
...
...
@@ -13,7 +13,7 @@
<key>
CFBundleIdentifier
</key>
<string>
org.QGroundControl.qgc
</string>
<key>
CFBundleName
</key>
<string>
QGroundControl
</string>
<string>
$(PRODUCT_NAME)
</string>
<key>
CFBundlePackageType
</key>
<string>
APPL
</string>
<key>
CFBundleShortVersionString
</key>
...
...
src/FlightMap/FlightMapSettings.cc
View file @
e9914d19
...
...
@@ -27,33 +27,33 @@ FlightMapSettings::FlightMapSettings(QGCApplication* app)
void
FlightMapSettings
::
setToolbox
(
QGCToolbox
*
toolbox
)
{
QGCTool
::
setToolbox
(
toolbox
);
qmlRegisterUncreatableType
<
FlightMapSettings
>
(
"QGroundControl"
,
1
,
0
,
"FlightMapSetting"
,
"Reference only"
);
_supportedMapProviders
<<
"Bing"
<<
"Google"
;
// << "OpenStreetMap";
_supportedMapProviders
<<
"Bing"
;
#ifndef QGC_NO_GOOGLE_MAPS
_supportedMapProviders
<<
"Google"
;
#endif
_loadSettings
();
}
void
FlightMapSettings
::
_storeSettings
(
void
)
{
QSettings
settings
;
settings
.
beginGroup
(
_settingsGroup
);
settings
.
setValue
(
_mapProviderKey
,
_supportedMapProviders
.
contains
(
_mapProvider
)
?
_mapProvider
:
_defaultMapProvider
);
}
void
FlightMapSettings
::
_loadSettings
(
void
)
{
#ifdef QGC_NO_GOOGLE_MAPS
_mapProvider
=
_defaultMapProvider
;
#else
QSettings
settings
;
settings
.
beginGroup
(
_settingsGroup
);
_mapProvider
=
settings
.
value
(
_mapProviderKey
,
_defaultMapProvider
).
toString
();
if
(
!
_supportedMapProviders
.
contains
(
_mapProvider
))
{
_mapProvider
=
_defaultMapProvider
;
}
#endif
_setMapTypesForCurrentProvider
();
}
...
...
@@ -75,24 +75,21 @@ void FlightMapSettings::setMapProvider(const QString& mapProvider)
void
FlightMapSettings
::
_setMapTypesForCurrentProvider
(
void
)
{
_mapTypes
.
clear
();
#ifdef QGC_NO_GOOGLE_MAPS
_mapTypes
<<
"Street Map"
<<
"Satellite Map"
<<
"Hybrid Map"
;
#else
if
(
_mapProvider
==
"Bing"
)
{
_mapTypes
<<
"Street Map"
<<
"Satellite Map"
<<
"Hybrid Map"
;
}
else
if
(
_mapProvider
==
"Google"
)
{
_mapTypes
<<
"Street Map"
<<
"Satellite Map"
<<
"Terrain Map"
;
/*
} else if (_mapProvider == "OpenStreetMap") {
_mapTypes << "Street Map";
*/
}
#endif
emit
mapTypesChanged
(
_mapTypes
);
}
QString
FlightMapSettings
::
mapType
(
void
)
{
QSettings
settings
;
settings
.
beginGroup
(
_settingsGroup
);
settings
.
beginGroup
(
_mapProvider
);
return
settings
.
value
(
_mapTypeKey
,
"Satellite Map"
).
toString
();
...
...
@@ -101,18 +98,15 @@ QString FlightMapSettings::mapType(void)
void
FlightMapSettings
::
setMapType
(
const
QString
&
mapType
)
{
QSettings
settings
;
settings
.
beginGroup
(
_settingsGroup
);
settings
.
beginGroup
(
_mapProvider
);
settings
.
setValue
(
_mapTypeKey
,
mapType
);
emit
mapTypeChanged
(
mapType
);
}
void
FlightMapSettings
::
saveMapSetting
(
const
QString
&
mapName
,
const
QString
&
key
,
const
QString
&
value
)
{
QSettings
settings
;
settings
.
beginGroup
(
_settingsGroup
);
settings
.
beginGroup
(
mapName
);
settings
.
setValue
(
key
,
value
);
...
...
@@ -121,7 +115,6 @@ void FlightMapSettings::saveMapSetting (const QString &mapName, const QString& k
QString
FlightMapSettings
::
loadMapSetting
(
const
QString
&
mapName
,
const
QString
&
key
,
const
QString
&
defaultValue
)
{
QSettings
settings
;
settings
.
beginGroup
(
_settingsGroup
);
settings
.
beginGroup
(
mapName
);
return
settings
.
value
(
key
,
defaultValue
).
toString
();
...
...
@@ -130,7 +123,6 @@ QString FlightMapSettings::loadMapSetting (const QString &mapName, const QString
void
FlightMapSettings
::
saveBoolMapSetting
(
const
QString
&
mapName
,
const
QString
&
key
,
bool
value
)
{
QSettings
settings
;
settings
.
beginGroup
(
_settingsGroup
);
settings
.
beginGroup
(
mapName
);
settings
.
setValue
(
key
,
value
);
...
...
@@ -139,7 +131,6 @@ void FlightMapSettings::saveBoolMapSetting (const QString &mapName, const QStrin
bool
FlightMapSettings
::
loadBoolMapSetting
(
const
QString
&
mapName
,
const
QString
&
key
,
bool
defaultValue
)
{
QSettings
settings
;
settings
.
beginGroup
(
_settingsGroup
);
settings
.
beginGroup
(
mapName
);
return
settings
.
value
(
key
,
defaultValue
).
toBool
();
...
...
src/FlightMap/FlightMapSettings.h
View file @
e9914d19
...
...
@@ -16,6 +16,12 @@
#include <QObject>
#include <QStringList>
/*
TODO: Map settings should come from QGCMapEngineManager. What is currently in
FlightMapSettings should be moved there so all map related funtions are in
one place.
*/
class
FlightMapSettings
:
public
QGCTool
{
Q_OBJECT
...
...
@@ -35,6 +41,9 @@ public:
/// Map type to be used for all maps
Q_PROPERTY
(
QString
mapType
READ
mapType
WRITE
setMapType
NOTIFY
mapTypeChanged
)
/// Is Google Maps Enabled
Q_PROPERTY
(
bool
googleMapEnabled
READ
googleMapEnabled
CONSTANT
)
Q_INVOKABLE
void
saveMapSetting
(
const
QString
&
mapName
,
const
QString
&
key
,
const
QString
&
value
);
Q_INVOKABLE
QString
loadMapSetting
(
const
QString
&
mapName
,
const
QString
&
key
,
const
QString
&
defaultValue
);
Q_INVOKABLE
void
saveBoolMapSetting
(
const
QString
&
mapName
,
const
QString
&
key
,
bool
value
);
...
...
@@ -53,6 +62,13 @@ public:
QStringList
mapProviders
()
{
return
_supportedMapProviders
;
}
#ifdef QGC_NO_GOOGLE_MAPS
bool
googleMapEnabled
()
{
return
false
;
}
#else
bool
googleMapEnabled
()
{
return
true
;
}
#endif
signals:
void
mapProviderChanged
(
const
QString
&
mapProvider
);
void
mapTypesChanged
(
const
QStringList
&
mapTypes
);
...
...
src/QtLocationPlugin/QGCMapEngine.cpp
View file @
e9914d19
...
...
@@ -43,9 +43,11 @@ struct stQGeoTileCacheQGCMapTypes {
// Changes here must reflect those in QGeoTiledMappingManagerEngineQGC.cpp
stQGeoTileCacheQGCMapTypes
kMapTypes
[]
=
{
#ifndef QGC_LIMITED_MAPS
{
"Google Street Map"
,
UrlFactory
::
GoogleMap
},
{
"Google Satellite Map"
,
UrlFactory
::
GoogleSatellite
},
{
"Google Terrain Map"
,
UrlFactory
::
GoogleTerrain
},
#endif
{
"Bing Street Map"
,
UrlFactory
::
BingMap
},
{
"Bing Satellite Map"
,
UrlFactory
::
BingSatellite
},
{
"Bing Hybrid Map"
,
UrlFactory
::
BingHybrid
},
...
...
src/QtLocationPlugin/QGCMapUrlEngine.cpp
View file @
e9914d19
...
...
@@ -33,20 +33,24 @@
//-----------------------------------------------------------------------------
UrlFactory
::
UrlFactory
()
:
_timeout
(
5
*
1000
)
#ifndef QGC_NO_GOOGLE_MAPS
,
_googleVersionRetrieved
(
false
)
,
_googleReply
(
NULL
)
#endif
{
QStringList
langs
=
QLocale
::
system
().
uiLanguages
();
if
(
langs
.
length
()
>
0
)
{
_language
=
langs
[
0
];
}
#ifndef QGC_NO_GOOGLE_MAPS
// Google version strings
_versionGoogleMap
=
"m@338000000"
;
_versionGoogleSatellite
=
"198"
;
_versionGoogleLabels
=
"h@336"
;
_versionGoogleTerrain
=
"t@132,r@338000000"
;
_secGoogleWord
=
"Galileo"
;
#endif
// BingMaps
_versionBingMaps
=
"563"
;
}
...
...
@@ -54,8 +58,10 @@ UrlFactory::UrlFactory()
//-----------------------------------------------------------------------------
UrlFactory
::~
UrlFactory
()
{
#ifndef QGC_NO_GOOGLE_MAPS
if
(
_googleReply
)
_googleReply
->
deleteLater
();
#endif
}
...
...
@@ -123,6 +129,7 @@ UrlFactory::getTileURL(MapType type, int x, int y, int zoom, QNetworkAccessManag
request
.
setRawHeader
(
"Accept"
,
"*/*"
);
request
.
setRawHeader
(
"User-Agent"
,
_userAgent
);
switch
(
type
)
{
#ifndef QGC_NO_GOOGLE_MAPS
case
GoogleMap
:
case
GoogleSatellite
:
case
GoogleLabels
:
...
...
@@ -130,6 +137,7 @@ UrlFactory::getTileURL(MapType type, int x, int y, int zoom, QNetworkAccessManag
case
GoogleHybrid
:
request
.
setRawHeader
(
"Referrer"
,
"https://www.google.com/maps/preview"
);
break
;
#endif
case
BingHybrid
:
case
BingMap
:
case
BingSatellite
:
...
...
@@ -152,6 +160,7 @@ UrlFactory::getTileURL(MapType type, int x, int y, int zoom, QNetworkAccessManag
}
//-----------------------------------------------------------------------------
#ifndef QGC_NO_GOOGLE_MAPS
void
UrlFactory
::
_getSecGoogleWords
(
int
x
,
int
y
,
QString
&
sec1
,
QString
&
sec2
)
{
...
...
@@ -163,12 +172,16 @@ UrlFactory::_getSecGoogleWords(int x, int y, QString &sec1, QString &sec2)
sec1
=
"&s="
;
}
}
#endif
//-----------------------------------------------------------------------------
QString
UrlFactory
::
_getURL
(
MapType
type
,
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
switch
(
type
)
{
#ifdef QGC_NO_GOOGLE_MAPS
Q_UNUSED
(
networkManager
);
#else
case
GoogleMap
:
{
// http://mt1.google.com/vt/lyrs=m
...
...
@@ -215,6 +228,7 @@ UrlFactory::_getURL(MapType type, int x, int y, int zoom, QNetworkAccessManager*
return
QString
(
"http://%1%2.google.com/%3/v=%4&hl=%5&x=%6%7&y=%8&z=%9&s=%10"
).
arg
(
server
).
arg
(
_getServerNum
(
x
,
y
,
4
)).
arg
(
request
).
arg
(
_versionGoogleTerrain
).
arg
(
_language
).
arg
(
x
).
arg
(
sec1
).
arg
(
y
).
arg
(
zoom
).
arg
(
sec2
);
}
break
;
#endif
/*
case OpenStreetMap:
{
...
...
@@ -376,6 +390,7 @@ UrlFactory::_getServerNum(int x, int y, int max)
}
//-----------------------------------------------------------------------------
#ifndef QGC_NO_GOOGLE_MAPS
void
UrlFactory
::
_networkReplyError
(
QNetworkReply
::
NetworkError
error
)
{
...
...
@@ -386,15 +401,18 @@ UrlFactory::_networkReplyError(QNetworkReply::NetworkError error)
_googleReply
=
NULL
;
}
}
#endif
//-----------------------------------------------------------------------------
#ifndef QGC_NO_GOOGLE_MAPS
void
UrlFactory
::
_replyDestroyed
()
{
_googleReply
=
NULL
;
}
#endif
//-----------------------------------------------------------------------------
#ifndef QGC_NO_GOOGLE_MAPS
void
UrlFactory
::
_googleVersionCompleted
()
{
...
...
@@ -433,8 +451,10 @@ UrlFactory::_googleVersionCompleted()
_googleReply
->
deleteLater
();
_googleReply
=
NULL
;
}
#endif
//-----------------------------------------------------------------------------
#ifndef QGC_NO_GOOGLE_MAPS
void
UrlFactory
::
_tryCorrectGoogleVersions
(
QNetworkAccessManager
*
networkManager
)
{
...
...
@@ -466,6 +486,7 @@ UrlFactory::_tryCorrectGoogleVersions(QNetworkAccessManager* networkManager)
networkManager
->
setProxy
(
proxy
);
}
}
#endif
#define AVERAGE_GOOGLE_STREET_MAP 4913
#define AVERAGE_GOOGLE_TERRAIN_MAP 19391
...
...
src/QtLocationPlugin/QGCMapUrlEngine.h
View file @
e9914d19
...
...
@@ -76,30 +76,38 @@ public:
static
quint32
averageSizeForType
(
MapType
type
);
private
slots
:
#ifndef QGC_NO_GOOGLE_MAPS
void
_networkReplyError
(
QNetworkReply
::
NetworkError
error
);
void
_googleVersionCompleted
();
void
_replyDestroyed
();
#endif
private:
QString
_getURL
(
MapType
type
,
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
);
void
_getSecGoogleWords
(
int
x
,
int
y
,
QString
&
sec1
,
QString
&
sec2
);
QString
_tileXYToQuadKey
(
int
tileX
,
int
tileY
,
int
levelOfDetail
);
int
_getServerNum
(
int
x
,
int
y
,
int
max
);
#ifndef QGC_NO_GOOGLE_MAPS
void
_getSecGoogleWords
(
int
x
,
int
y
,
QString
&
sec1
,
QString
&
sec2
);
void
_tryCorrectGoogleVersions
(
QNetworkAccessManager
*
networkManager
);
QString
_tileXYToQuadKey
(
int
tileX
,
int
tileY
,
int
levelOfDetail
);
#endif
private:
int
_timeout
;
bool
_googleVersionRetrieved
;
QNetworkReply
*
_googleReply
;
QMutex
_googleVersionMutex
;
QByteArray
_userAgent
;
QString
_language
;
// Google version strings
#ifndef QGC_NO_GOOGLE_MAPS
bool
_googleVersionRetrieved
;
QNetworkReply
*
_googleReply
;
QMutex
_googleVersionMutex
;
QString
_versionGoogleMap
;
QString
_versionGoogleSatellite
;
QString
_versionGoogleLabels
;
QString
_versionGoogleTerrain
;
QString
_secGoogleWord
;
#endif
// BingMaps
QString
_versionBingMaps
;
...
...
src/QtLocationPlugin/QGeoCodeReplyQGC.cpp
View file @
e9914d19
...
...
@@ -56,7 +56,7 @@
#include <QSet>
#include <QDebug>
enum
QG
eoCodeTypeGoogl
e
{
enum
QG
CGeoCodeTyp
e
{
GeoCodeTypeUnknown
,
StreetAddress
,
// indicates a precise street address.
Route
,
// indicates a named route (such as "US 101").
...
...
@@ -97,7 +97,7 @@ enum QGeoCodeTypeGoogle {
class
JasonMonger
{
public:
JasonMonger
();
QSet
<
int
>
json2QG
eoCodeTypeGoogl
e
(
const
QJsonArray
&
types
);
QSet
<
int
>
json2QG
CGeoCodeTyp
e
(
const
QJsonArray
&
types
);
private:
int
_getCode
(
const
QString
&
key
);
QMap
<
QString
,
int
>
_m
;
...
...
@@ -145,7 +145,7 @@ int JasonMonger::_getCode(const QString &key) {
return
_m
.
value
(
key
,
GeoCodeTypeUnknown
);
}
QSet
<
int
>
JasonMonger
::
json2QG
eoCodeTypeGoogl
e
(
const
QJsonArray
&
types
)
{
QSet
<
int
>
JasonMonger
::
json2QG
CGeoCodeTyp
e
(
const
QJsonArray
&
types
)
{
QSet
<
int
>
result
;
for
(
int
i
=
0
;
i
<
types
.
size
();
++
i
)
{
result
|=
_getCode
(
types
[
i
].
toString
());
...
...
@@ -228,7 +228,7 @@ void QGeoCodeReplyQGC::networkReplyFinished()
if
(
!
c
.
contains
(
QStringLiteral
(
"types"
)))
continue
;
QSet
<
int
>
types
=
kMonger
.
json2QG
eoCodeTypeGoogl
e
(
c
[
QStringLiteral
(
"types"
)].
toArray
());
QSet
<
int
>
types
=
kMonger
.
json2QG
CGeoCodeTyp
e
(
c
[
QStringLiteral
(
"types"
)].
toArray
());
QString
long_name
=
c
[
QStringLiteral
(
"long_name"
)].
toString
();
QString
short_name
=
c
[
QStringLiteral
(
"short_name"
)].
toString
();
if
(
types
.
contains
(
Country
))
{
...
...
src/QtLocationPlugin/QGeoTiledMappingManagerEngineQGC.cpp
View file @
e9914d19
...
...
@@ -95,9 +95,12 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
// Changes here must reflect those in QGCMapEngine.cpp
QList
<
QGeoMapType
>
mapTypes
;
#ifndef QGC_NO_GOOGLE_MAPS
mapTypes
<<
QGeoMapType
(
QGeoMapType
::
StreetMap
,
"Google Street Map"
,
"Google street map"
,
false
,
false
,
UrlFactory
::
GoogleMap
);
mapTypes
<<
QGeoMapType
(
QGeoMapType
::
SatelliteMapDay
,
"Google Satellite Map"
,
"Google satellite map"
,
false
,
false
,
UrlFactory
::
GoogleSatellite
);
mapTypes
<<
QGeoMapType
(
QGeoMapType
::
TerrainMap
,
"Google Terrain Map"
,
"Google terrain map"
,
false
,
false
,
UrlFactory
::
GoogleTerrain
);
#endif
/* TODO:
* Proper google hybrid maps requires collecting two separate bimaps and overlaying them.
...
...
@@ -116,8 +119,10 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
*/
// MapQuest
/*
mapTypes << QGeoMapType(QGeoMapType::StreetMap, "MapQuest Street Map", "MapQuest street map", false, false, UrlFactory::MapQuestMap);
mapTypes << QGeoMapType(QGeoMapType::SatelliteMapDay, "MapQuest Satellite Map", "MapQuest satellite map", false, false, UrlFactory::MapQuestSat);
*/
/*
* These are OK as you need your own token for accessing it. Out-of-the box, QGC does not even offer these unless you enter a proper MapBox token.
...
...
src/ui/preferences/GeneralSettings.qml
View file @
e9914d19
...
...
@@ -280,7 +280,15 @@ QGCView {
//-----------------------------------------------------------------
//-- Map Providers
Row
{
/*
TODO: Map settings should come from QGroundControl.mapEngineManager. What is currently in
QGroundControl.flightMapSettings should be moved there so all map related funtions are in
one place.
*/
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
QGroundControl
.
flightMapSettings
.
googleMapEnabled
QGCLabel
{
id
:
mapProvidersLabel
...
...
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