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
5683020f
Commit
5683020f
authored
Sep 16, 2019
by
Pierre TILAK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change map settings to string
parent
1f6c8d1a
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
152 additions
and
285 deletions
+152
-285
AirmapSettings.qml
src/Airmap/AirmapSettings.qml
+1
-1
FlightMap.qml
src/FlightMap/FlightMap.qml
+4
-1
GoogleMapProvider.h
src/QtLocationPlugin/GoogleMapProvider.h
+3
-3
MapProvider.h
src/QtLocationPlugin/MapProvider.h
+6
-6
QGCMapUrlEngine.cpp
src/QtLocationPlugin/QGCMapUrlEngine.cpp
+119
-110
OfflineMap.qml
src/QtLocationPlugin/QMLControl/OfflineMap.qml
+3
-3
FlightMap.SettingsGroup.json
src/Settings/FlightMap.SettingsGroup.json
+3
-8
FlightMapSettings.cc
src/Settings/FlightMapSettings.cc
+1
-100
FlightMapSettings.h
src/Settings/FlightMapSettings.h
+0
-30
GeneralSettings.qml
src/ui/preferences/GeneralSettings.qml
+12
-23
No files found.
src/Airmap/AirmapSettings.qml
View file @
5683020f
...
...
@@ -681,7 +681,7 @@ Item {
visible
:
!
QGroundControl
.
airspaceManager
.
flightPlan
.
loadingFlightList
&&
_flightList
.
count
>
0
&&
tableView
.
currentRow
>=
0
function
updateActiveMapType
()
{
var
settings
=
QGroundControl
.
settingsManager
.
flightMapSettings
var
fullMapName
=
settings
.
mapProvider
.
enumStringValue
+
"
"
+
settings
.
mapType
.
enumStringV
alue
var
fullMapName
=
settings
.
mapProvider
.
value
+
"
"
+
settings
.
mapType
.
v
alue
for
(
var
i
=
0
;
i
<
map
.
supportedMapTypes
.
length
;
i
++
)
{
if
(
fullMapName
===
map
.
supportedMapTypes
[
i
].
name
)
{
map
.
activeMapType
=
map
.
supportedMapTypes
[
i
]
...
...
src/FlightMap/FlightMap.qml
View file @
5683020f
...
...
@@ -95,7 +95,10 @@ Map {
function
updateActiveMapType
()
{
var
settings
=
QGroundControl
.
settingsManager
.
flightMapSettings
var
fullMapName
=
settings
.
mapProvider
.
enumStringValue
+
"
"
+
settings
.
mapType
.
enumStringValue
//var fullMapName = settings.mapProvider.value + " " + settings.mapType.value
var
fullMapName
=
settings
.
mapProvider
.
value
console
.
log
(
"
updateActiveMapType
"
,
fullMapName
)
for
(
var
i
=
0
;
i
<
_map
.
supportedMapTypes
.
length
;
i
++
)
{
if
(
fullMapName
===
_map
.
supportedMapTypes
[
i
].
name
)
{
_map
.
activeMapType
=
_map
.
supportedMapTypes
[
i
]
...
...
src/QtLocationPlugin/GoogleMapProvider.h
View file @
5683020f
...
...
@@ -56,9 +56,9 @@ class GoogleMapProvider : public MapProvider {
// CycleMap,
// CustomMap = 100
const
unsigned
int
AVERAGE_GOOGLE_STREET_MAP
=
4913
;
const
unsigned
int
AVERAGE_GOOGLE_SAT_MAP
=
56887
;
const
unsigned
int
AVERAGE_GOOGLE_TERRAIN_MAP
=
19391
;
const
quint32
AVERAGE_GOOGLE_STREET_MAP
=
4913
;
const
quint32
AVERAGE_GOOGLE_SAT_MAP
=
56887
;
const
quint32
AVERAGE_GOOGLE_TERRAIN_MAP
=
19391
;
// -----------------------------------------------------------
// Google Street Map
...
...
src/QtLocationPlugin/MapProvider.h
View file @
5683020f
...
...
@@ -11,12 +11,12 @@ static const unsigned char pngSignature[] = {0x89, 0x50, 0x4E, 0x47, 0x0D,
static
const
unsigned
char
jpegSignature
[]
=
{
0xFF
,
0xD8
,
0xFF
,
0x00
};
static
const
unsigned
char
gifSignature
[]
=
{
0x47
,
0x49
,
0x46
,
0x38
,
0x00
};
const
unsigned
int
AVERAGE_BING_STREET_MAP
=
1297
;
const
unsigned
int
AVERAGE_BING_SAT_MAP
=
19597
;
const
unsigned
int
AVERAGE_MAPBOX_SAT_MAP
=
15739
;
const
unsigned
int
AVERAGE_MAPBOX_STREET_MAP
=
5648
;
const
unsigned
int
AVERAGE_TILE_SIZE
=
13652
;
const
unsigned
int
AVERAGE_AIRMAP_ELEV_SIZE
=
2786
;
const
quint32
AVERAGE_BING_STREET_MAP
=
1297
;
const
quint32
AVERAGE_BING_SAT_MAP
=
19597
;
const
quint32
AVERAGE_MAPBOX_SAT_MAP
=
15739
;
const
quint32
AVERAGE_MAPBOX_STREET_MAP
=
5648
;
const
quint32
AVERAGE_TILE_SIZE
=
13652
;
const
quint32
AVERAGE_AIRMAP_ELEV_SIZE
=
2786
;
class
MapProvider
:
public
QObject
{
Q_OBJECT
...
...
src/QtLocationPlugin/QGCMapUrlEngine.cpp
View file @
5683020f
This diff is collapsed.
Click to expand it.
src/QtLocationPlugin/QMLControl/OfflineMap.qml
View file @
5683020f
...
...
@@ -38,7 +38,7 @@ Item {
property
Fact
_mapboxFact
:
_settingsManager
?
_settingsManager
.
appSettings
.
mapboxToken
:
null
property
Fact
_esriFact
:
_settingsManager
?
_settingsManager
.
appSettings
.
esriToken
:
null
property
string
mapType
:
_fmSettings
?
(
_fmSettings
.
mapProvider
.
enumStringValue
+
"
"
+
_fmSettings
.
mapType
.
enumStringV
alue
)
:
""
property
string
mapType
:
_fmSettings
?
(
_fmSettings
.
mapProvider
.
value
+
"
"
+
_fmSettings
.
mapType
.
v
alue
)
:
""
property
bool
isMapInteractive
:
false
property
var
savedCenter
:
undefined
property
real
savedZoom
:
3
...
...
@@ -93,10 +93,10 @@ Item {
function
updateMap
()
{
for
(
var
i
=
0
;
i
<
_map
.
supportedMapTypes
.
length
;
i
++
)
{
//console.log(_map.supportedMapTypes[i].name
)
console
.
log
(
_map
.
supportedMapTypes
[
i
].
name
,
i
)
if
(
mapType
===
_map
.
supportedMapTypes
[
i
].
name
)
{
_map
.
activeMapType
=
_map
.
supportedMapTypes
[
i
]
//
console.log("Update Map:" + " " + _map.activeMapType)
console
.
log
(
"
Update Map:
"
+
"
"
+
_map
.
activeMapType
)
handleChanges
()
return
}
...
...
src/Settings/FlightMap.SettingsGroup.json
View file @
5683020f
...
...
@@ -2,17 +2,12 @@
{
"name"
:
"mapProvider"
,
"shortDescription"
:
"Currently selected map provider for flight maps"
,
"type"
:
"uint32"
,
"enumStrings"
:
"Bing,Google,Statkart,Mapbox,Esri,Eniro,VWorld"
,
"enumValues"
:
"0,1,2,3,4,5,6"
,
"defaultValue"
:
0
"type"
:
"string"
},
{
"name"
:
"mapType"
,
"shortDescription"
:
"Currently selected map type for flight maps"
,
"type"
:
"uint32"
,
"enumStrings"
:
"Street Map,Satellite Map,Hybrid Map,Terrain Map"
,
"enumValues"
:
"0,1,2,3"
,
"defaultValue"
:
2
"type"
:
"string"
,
"default"
:
""
}
]
src/Settings/FlightMapSettings.cc
View file @
5683020f
...
...
@@ -19,106 +19,7 @@
DECLARE_SETTINGGROUP
(
FlightMap
,
"FlightMap"
)
{
qmlRegisterUncreatableType
<
FlightMapSettings
>
(
"QGroundControl.SettingsManager"
,
1
,
0
,
"FlightMapSettings"
,
"Reference only"
);
// Save the original version since we modify based on map provider
_savedMapTypeStrings
=
_nameToMetaDataMap
[
mapTypeName
]
->
enumStrings
();
_savedMapTypeValues
=
_nameToMetaDataMap
[
mapTypeName
]
->
enumValues
();
#ifdef QGC_NO_GOOGLE_MAPS
//-- Remove Google
_excludeProvider
(
mapProviderGoogle
);
#endif
if
(
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
mapboxToken
()
->
rawValue
().
toString
().
isEmpty
())
{
_excludeProvider
(
mapProviderMapbox
);
}
if
(
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
esriToken
()
->
rawValue
().
toString
().
isEmpty
())
{
_excludeProvider
(
mapProviderEsri
);
}
_newMapProvider
(
mapProvider
()
->
rawValue
());
}
DECLARE_SETTINGSFACT
(
FlightMapSettings
,
mapProvider
)
DECLARE_SETTINGSFACT
(
FlightMapSettings
,
mapType
)
DECLARE_SETTINGSFACT_NO_FUNC
(
FlightMapSettings
,
mapProvider
)
{
if
(
!
_mapProviderFact
)
{
_mapProviderFact
=
_createSettingsFact
(
mapProviderName
);
connect
(
_mapProviderFact
,
&
Fact
::
rawValueChanged
,
this
,
&
FlightMapSettings
::
_newMapProvider
);
}
return
_mapProviderFact
;
}
void
FlightMapSettings
::
_excludeProvider
(
MapProvider_t
provider
)
{
FactMetaData
*
metaData
=
_nameToMetaDataMap
[
mapProviderName
];
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
)
{
bool
found
=
false
;
int
removeIndex
;
for
(
removeIndex
=
0
;
removeIndex
<
enumValues
.
count
();
removeIndex
++
)
{
if
(
enumValues
[
removeIndex
].
toInt
()
==
value
)
{
found
=
true
;
break
;
}
}
if
(
found
)
{
enumValues
.
removeAt
(
removeIndex
);
enumStrings
.
removeAt
(
removeIndex
);
}
}
void
FlightMapSettings
::
_newMapProvider
(
QVariant
value
)
{
FactMetaData
*
metaData
=
_nameToMetaDataMap
[
mapTypeName
];
QStringList
enumStrings
=
_savedMapTypeStrings
;
QVariantList
enumValues
=
_savedMapTypeValues
;
switch
(
value
.
toInt
())
{
case
mapProviderBing
:
_removeEnumValue
(
mapTypeTerrain
,
enumStrings
,
enumValues
);
break
;
case
mapProviderGoogle
:
_removeEnumValue
(
mapTypeHybrid
,
enumStrings
,
enumValues
);
break
;
case
mapProviderStarkart
:
_removeEnumValue
(
mapTypeStreet
,
enumStrings
,
enumValues
);
_removeEnumValue
(
mapTypeSatellite
,
enumStrings
,
enumValues
);
_removeEnumValue
(
mapTypeHybrid
,
enumStrings
,
enumValues
);
break
;
case
mapProviderEniro
:
_removeEnumValue
(
mapTypeStreet
,
enumStrings
,
enumValues
);
_removeEnumValue
(
mapTypeSatellite
,
enumStrings
,
enumValues
);
_removeEnumValue
(
mapTypeHybrid
,
enumStrings
,
enumValues
);
break
;
case
mapProviderEsri
:
_removeEnumValue
(
mapTypeHybrid
,
enumStrings
,
enumValues
);
break
;
case
mapProviderVWorld
:
_removeEnumValue
(
mapTypeHybrid
,
enumStrings
,
enumValues
);
_removeEnumValue
(
mapTypeTerrain
,
enumStrings
,
enumValues
);
}
metaData
->
setEnumInfo
(
enumStrings
,
enumValues
);
emit
mapTypeChanged
();
// Check that map type is still valid for this new map provider
bool
found
=
false
;
int
currentMapType
=
mapType
()
->
rawValue
().
toInt
();
for
(
int
i
=
0
;
i
<
enumValues
.
count
();
i
++
)
{
if
(
currentMapType
==
enumValues
[
i
].
toInt
())
{
found
=
true
;
break
;
}
}
if
(
!
found
)
{
mapType
()
->
setRawValue
(
0
);
}
}
src/Settings/FlightMapSettings.h
View file @
5683020f
...
...
@@ -18,39 +18,9 @@ class FlightMapSettings : public SettingsGroup
public:
FlightMapSettings
(
QObject
*
parent
=
nullptr
);
// This enum must match the json meta data
typedef
enum
{
mapProviderBing
,
mapProviderGoogle
,
mapProviderStarkart
,
mapProviderMapbox
,
mapProviderEsri
,
mapProviderEniro
,
mapProviderVWorld
}
MapProvider_t
;
// This enum must match the json meta data
typedef
enum
{
mapTypeStreet
,
mapTypeSatellite
,
mapTypeHybrid
,
mapTypeTerrain
}
MapType_t
;
DEFINE_SETTING_NAME_GROUP
()
DEFINE_SETTINGFACT
(
mapProvider
)
DEFINE_SETTINGFACT
(
mapType
)
signals:
void
mapTypeChanged
(
void
);
private
slots
:
void
_newMapProvider
(
QVariant
value
);
private:
void
_removeEnumValue
(
int
value
,
QStringList
&
enumStrings
,
QVariantList
&
enumValues
);
void
_excludeProvider
(
MapProvider_t
provider
);
QStringList
_savedMapTypeStrings
;
QVariantList
_savedMapTypeValues
;
};
src/ui/preferences/GeneralSettings.qml
View file @
5683020f
...
...
@@ -38,8 +38,8 @@ Rectangle {
property
real
_labelWidth
:
ScreenTools
.
defaultFontPixelWidth
*
20
property
real
_comboFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
28
property
real
_valueFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
10
property
Fact
_mapProvider
:
QGroundControl
.
settingsManager
.
flightMapSettings
.
mapProvider
property
Fact
_mapType
:
QGroundControl
.
settingsManager
.
flightMapSettings
.
mapTyp
e
property
string
_mapProvider
:
QGroundControl
.
settingsManager
.
flightMapSettings
.
mapProvider
.
value
property
string
_mapType
:
QGroundControl
.
settingsManager
.
flightMapSettings
.
mapType
.
valu
e
property
Fact
_followTarget
:
QGroundControl
.
settingsManager
.
appSettings
.
followTarget
property
real
_panelWidth
:
_root
.
width
*
_internalWidthRatio
property
real
_margins
:
ScreenTools
.
defaultFontPixelWidth
...
...
@@ -160,30 +160,19 @@ Rectangle {
QGCLabel
{
text
:
qsTr
(
"
Map Provider
"
)
width
:
_labelWidth
visible
:
_mapProvider
.
visible
//
visible: _mapProvider.visible
}
FactComboBox
{
QGCComboBox
{
id
:
mapCombo
model
:
QGroundControl
.
mapEngineManager
.
mapList
Layout.preferredWidth
:
_comboFieldWidth
fact
:
_mapProvider
indexModel
:
false
visible
:
_mapProvider
.
visible
}
QGCLabel
{
text
:
qsTr
(
"
Map Type
"
)
visible
:
_mapType
&&
_mapType
.
visible
onActivated
:
{
_mapProvider
=
textAt
(
index
)
QGroundControl
.
settingsManager
.
flightMapSettings
.
mapProvider
.
value
=
textAt
(
index
)
}
FactComboBox
{
id
:
mapTypes
Layout.preferredWidth
:
_comboFieldWidth
fact
:
_mapType
indexModel
:
false
visible
:
_mapType
&&
_mapType
.
visible
Connections
{
target
:
QGroundControl
.
settingsManager
.
flightMapSettings
onMapTypeChanged
:
{
mapTypes
.
model
=
_mapType
.
enumStrings
}
Component.onCompleted
:
{
var
index
=
mapCombo
.
find
(
_mapProvider
)
mapCombo
.
currentIndex
=
index
}
}
...
...
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