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
1c123b3d
Commit
1c123b3d
authored
Jun 09, 2016
by
Don Gagne
Committed by
GitHub
Jun 09, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3515 from DonLakeFlyer/OfflineMapSmallScreen
Offline map small screen
parents
92de1d21
28b482e6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
827 additions
and
905 deletions
+827
-905
qgroundcontrol.qrc
qgroundcontrol.qrc
+1
-0
MapScale.qml
src/FlightMap/MapScale.qml
+135
-0
qmldir
src/FlightMap/qmldir
+1
-0
OfflineMap.qml
src/QtLocationPlugin/QMLControl/OfflineMap.qml
+690
-905
No files found.
qgroundcontrol.qrc
View file @
1c123b3d
...
@@ -102,6 +102,7 @@
...
@@ -102,6 +102,7 @@
<file alias="VirtualJoystick.qml">src/FlightDisplay/VirtualJoystick.qml</file>
<file alias="VirtualJoystick.qml">src/FlightDisplay/VirtualJoystick.qml</file>
<file alias="QGroundControl/FlightMap/qmldir">src/FlightMap/qmldir</file>
<file alias="QGroundControl/FlightMap/qmldir">src/FlightMap/qmldir</file>
<file alias="QGroundControl/FlightMap/FlightMap.qml">src/FlightMap/FlightMap.qml</file>
<file alias="QGroundControl/FlightMap/FlightMap.qml">src/FlightMap/FlightMap.qml</file>
<file alias="QGroundControl/FlightMap/MapScale.qml">src/FlightMap/MapScale.qml</file>
<file alias="QGroundControl/FlightMap/MissionItemIndicator.qml">src/FlightMap/MapItems/MissionItemIndicator.qml</file>
<file alias="QGroundControl/FlightMap/MissionItemIndicator.qml">src/FlightMap/MapItems/MissionItemIndicator.qml</file>
<file alias="QGroundControl/FlightMap/MissionItemView.qml">src/FlightMap/MapItems/MissionItemView.qml</file>
<file alias="QGroundControl/FlightMap/MissionItemView.qml">src/FlightMap/MapItems/MissionItemView.qml</file>
<file alias="QGroundControl/FlightMap/MissionLineView.qml">src/FlightMap/MapItems/MissionLineView.qml</file>
<file alias="QGroundControl/FlightMap/MissionLineView.qml">src/FlightMap/MapItems/MissionLineView.qml</file>
...
...
src/FlightMap/MapScale.qml
0 → 100644
View file @
1c123b3d
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import
QtQuick
2.4
import
QtQuick
.
Controls
1.3
import
QGroundControl
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
ScreenTools
1.0
/// Map scale control
Item
{
id
:
scale
width
:
rightEnd
.
x
+
rightEnd
.
width
height
:
rightEnd
.
y
+
rightEnd
.
height
property
var
mapControl
///< Map control for which this scale control is being used
property
variant
_scaleLengths
:
[
5
,
10
,
25
,
50
,
100
,
150
,
250
,
500
,
1000
,
2000
,
5000
,
10000
,
20000
,
50000
,
100000
,
200000
,
500000
,
1000000
,
2000000
]
property
bool
_isSatelliteMap
:
mapControl
.
activeMapType
.
name
.
indexOf
(
qsTr
(
"
Street
"
))
==
-
1
///< Scale control being displayed over satellite map
property
var
_color
:
_isSatelliteMap
?
"
white
"
:
"
black
"
function
formatDistance
(
meters
)
{
var
dist
=
Math
.
round
(
meters
)
if
(
dist
>
1000
){
if
(
dist
>
100000
){
dist
=
Math
.
round
(
dist
/
1000
)
}
else
{
dist
=
Math
.
round
(
dist
/
100
)
dist
=
dist
/
10
}
dist
=
dist
+
"
km
"
}
else
{
dist
=
dist
+
"
m
"
}
return
dist
}
function
calculateScale
()
{
var
scaleLineWidth
=
100
var
coord1
,
coord2
,
dist
,
text
,
f
f
=
0
coord1
=
mapControl
.
toCoordinate
(
Qt
.
point
(
0
,
scale
.
y
))
coord2
=
mapControl
.
toCoordinate
(
Qt
.
point
(
scaleLineWidth
,
scale
.
y
))
dist
=
Math
.
round
(
coord1
.
distanceTo
(
coord2
))
if
(
dist
===
0
)
{
// not visible
}
else
{
for
(
var
i
=
0
;
i
<
_scaleLengths
.
length
-
1
;
i
++
)
{
if
(
dist
<
(
_scaleLengths
[
i
]
+
_scaleLengths
[
i
+
1
])
/
2
)
{
f
=
_scaleLengths
[
i
]
/
dist
dist
=
_scaleLengths
[
i
]
break
;
}
}
if
(
f
===
0
)
{
f
=
dist
/
_scaleLengths
[
i
]
dist
=
_scaleLengths
[
i
]
}
}
text
=
formatDistance
(
dist
)
centerLine
.
width
=
(
scaleLineWidth
*
f
)
-
(
2
*
leftEnd
.
width
)
scaleText
.
text
=
text
}
Connections
{
target
:
mapControl
onWidthChanged
:
scaleTimer
.
restart
()
onHeightChanged
:
scaleTimer
.
restart
()
onZoomLevelChanged
:
scaleTimer
.
restart
()
}
Timer
{
id
:
scaleTimer
interval
:
100
running
:
false
repeat
:
false
onTriggered
:
calculateScale
()
}
QGCLabel
{
id
:
scaleText
color
:
_color
font.family
:
ScreenTools
.
demiboldFontFamily
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
horizontalAlignment
:
Text
.
AlignRight
text
:
"
0 m
"
}
Rectangle
{
id
:
leftEnd
anchors.top
:
scaleText
.
bottom
anchors.left
:
parent
.
left
width
:
2
height
:
ScreenTools
.
defaultFontPixelHeight
color
:
_color
}
Rectangle
{
id
:
centerLine
anchors.bottomMargin
:
2
anchors.bottom
:
leftEnd
.
bottom
anchors.left
:
leftEnd
.
right
height
:
2
color
:
_color
}
Rectangle
{
id
:
rightEnd
anchors.top
:
leftEnd
.
top
anchors.left
:
centerLine
.
right
width
:
2
height
:
ScreenTools
.
defaultFontPixelHeight
color
:
_color
}
Component.onCompleted
:
{
if
(
scale
.
visible
)
{
calculateScale
();
}
}
}
src/FlightMap/qmldir
View file @
1c123b3d
...
@@ -6,6 +6,7 @@ QGCVideoBackground 1.0 QGCVideoBackground.qml
...
@@ -6,6 +6,7 @@ QGCVideoBackground 1.0 QGCVideoBackground.qml
# Widgets
# Widgets
InstrumentSwipeView 1.0 InstrumentSwipeView.qml
InstrumentSwipeView 1.0 InstrumentSwipeView.qml
MapScale 1.0 MapScale.qml
QGCArtificialHorizon 1.0 QGCArtificialHorizon.qml
QGCArtificialHorizon 1.0 QGCArtificialHorizon.qml
QGCAttitudeHUD 1.0 QGCAttitudeHUD.qml
QGCAttitudeHUD 1.0 QGCAttitudeHUD.qml
QGCAttitudeWidget 1.0 QGCAttitudeWidget.qml
QGCAttitudeWidget 1.0 QGCAttitudeWidget.qml
...
...
src/QtLocationPlugin/QMLControl/OfflineMap.qml
View file @
1c123b3d
...
@@ -16,25 +16,22 @@ import QtQuick.Layouts 1.2
...
@@ -16,25 +16,22 @@ import QtQuick.Layouts 1.2
import
QtLocation
5.5
import
QtLocation
5.5
import
QtPositioning
5.5
import
QtPositioning
5.5
import
QGroundControl
1.0
import
QGroundControl
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
FlightMap
1.0
Rectangle
{
QGCView
{
id
:
_offlineMapRoot
id
:
offlineMapView
color
:
qgcPal
.
window
viewPanel
:
panel
anchors.fill
:
parent
anchors.fill
:
parent
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
property
var
_currentSelection
:
null
property
var
_currentSelection
:
null
property
string
mapKey
:
"
lastMapType
"
property
string
mapKey
:
"
lastMapType
"
property
string
mapType
:
QGroundControl
.
mapEngineManager
.
loadSetting
(
mapKey
,
"
Google Street Map
"
)
property
string
mapType
:
QGroundControl
.
mapEngineManager
.
loadSetting
(
mapKey
,
"
Google Street Map
"
)
property
int
mapMargin
:
(
ScreenTools
.
defaultFontPixelHeight
*
0.2
).
toFixed
(
0
)
property
real
infoWidth
:
Math
.
max
(
infoCol
.
width
,
(
ScreenTools
.
defaultFontPixelWidth
*
40
))
property
bool
isDefaultSet
:
_offlineMapRoot
.
_currentSelection
&&
_offlineMapRoot
.
_currentSelection
.
defaultSet
property
bool
isMapInteractive
:
true
property
bool
isMapInteractive
:
true
property
var
savedCenter
:
undefined
property
var
savedCenter
:
undefined
property
real
savedZoom
:
3
property
real
savedZoom
:
3
...
@@ -51,10 +48,13 @@ Rectangle {
...
@@ -51,10 +48,13 @@ Rectangle {
property
int
oldz0
:
0
property
int
oldz0
:
0
property
int
oldz1
:
0
property
int
oldz1
:
0
property
bool
_saveRealEstate
:
ScreenTools
.
isTinyScreen
||
ScreenTools
.
isShortScreen
property
real
_adjustableFontPointSize
:
_saveRealEstate
?
ScreenTools
.
smallFontPointSize
:
ScreenTools
.
defaultFontPointSize
readonly
property
real
minZoomLevel
:
3
readonly
property
real
minZoomLevel
:
3
readonly
property
real
maxZoomLevel
:
20
readonly
property
real
maxZoomLevel
:
20
QGCPalette
{
id
:
qgc
p
al
}
QGCPalette
{
id
:
qgc
P
al
}
Component.onCompleted
:
{
Component.onCompleted
:
{
QGroundControl
.
mapEngineManager
.
loadTileSets
()
QGroundControl
.
mapEngineManager
.
loadTileSets
()
...
@@ -76,21 +76,21 @@ Rectangle {
...
@@ -76,21 +76,21 @@ Rectangle {
function
handleChanges
()
{
function
handleChanges
()
{
if
(
isMapInteractive
)
{
if
(
isMapInteractive
)
{
var
xl
=
mapMargin
var
xl
=
0
var
yl
=
mapMargin
var
yl
=
0
var
xr
=
_map
.
width
.
toFixed
(
0
)
-
mapMargin
var
xr
=
_map
.
width
.
toFixed
(
0
)
var
yr
=
_map
.
height
.
toFixed
(
0
)
-
mapMargin
var
yr
=
_map
.
height
.
toFixed
(
0
)
var
c0
=
_map
.
toCoordinate
(
Qt
.
point
(
xl
,
yl
))
var
c0
=
_map
.
toCoordinate
(
Qt
.
point
(
xl
,
yl
))
var
c1
=
_map
.
toCoordinate
(
Qt
.
point
(
xr
,
yr
))
var
c1
=
_map
.
toCoordinate
(
Qt
.
point
(
xr
,
yr
))
if
(
oldlon0
!==
c0
.
longitude
||
oldlat0
!==
c0
.
latitude
||
oldlon1
!==
c1
.
longitude
||
oldlat1
!==
c1
.
latitude
||
oldz0
!==
_slider0
.
value
||
oldz1
!==
_slider1
.
value
)
{
if
(
oldlon0
!==
c0
.
longitude
||
oldlat0
!==
c0
.
latitude
||
oldlon1
!==
c1
.
longitude
||
oldlat1
!==
c1
.
latitude
||
oldz0
!==
sliderMinZoom
.
value
||
oldz1
!==
sliderMaxZoom
.
value
)
{
QGroundControl
.
mapEngineManager
.
updateForCurrentView
(
c0
.
longitude
,
c0
.
latitude
,
c1
.
longitude
,
c1
.
latitude
,
_slider0
.
value
,
_slider1
.
value
,
mapType
)
QGroundControl
.
mapEngineManager
.
updateForCurrentView
(
c0
.
longitude
,
c0
.
latitude
,
c1
.
longitude
,
c1
.
latitude
,
sliderMinZoom
.
value
,
sliderMaxZoom
.
value
,
mapType
)
}
}
}
}
}
}
function
checkSanity
()
{
function
checkSanity
()
{
if
(
isMapInteractive
&&
QGroundControl
.
mapEngineManager
.
crazySize
)
{
if
(
isMapInteractive
&&
QGroundControl
.
mapEngineManager
.
crazySize
)
{
_slider1
.
value
=
_slider1
.
value
-
1
sliderMaxZoom
.
value
=
sliderMaxZoom
.
value
-
1
handleChanges
()
handleChanges
()
}
}
}
}
...
@@ -105,35 +105,24 @@ Rectangle {
...
@@ -105,35 +105,24 @@ Rectangle {
}
}
}
}
function
showOptions
()
{
function
addNewSet
()
{
_map
.
visible
=
false
_tileSetList
.
visible
=
false
_infoView
.
visible
=
false
_defaultInfoView
.
visible
=
false
_mapView
.
visible
=
false
_optionsView
.
visible
=
true
}
function
showMap
()
{
_map
.
visible
=
true
_map
.
visible
=
true
_tileSetList
.
visible
=
false
_tileSetList
.
visible
=
false
_infoView
.
visible
=
false
infoView
.
visible
=
false
_defaultInfoView
.
visible
=
false
defaultInfoView
.
visible
=
false
_mapView
.
visible
=
true
addNewSetView
.
visible
=
true
_optionsView
.
visible
=
false
}
}
function
showList
()
{
function
showList
()
{
_map
.
visible
=
false
_map
.
visible
=
false
_tileSetList
.
visible
=
true
_tileSetList
.
visible
=
true
_infoView
.
visible
=
false
infoView
.
visible
=
false
_defaultInfoView
.
visible
=
false
defaultInfoView
.
visible
=
false
_mapView
.
visible
=
false
addNewSetView
.
visible
=
false
_optionsView
.
visible
=
false
}
}
function
showInfo
()
{
function
showInfo
()
{
if
(
_currentSelection
&&
!
_offlineMapRoot
.
_currentSelection
.
deleting
)
{
if
(
_currentSelection
&&
!
offlineMapView
.
_currentSelection
.
deleting
)
{
enterInfoView
()
enterInfoView
()
}
else
}
else
showList
()
showList
()
...
@@ -160,31 +149,31 @@ Rectangle {
...
@@ -160,31 +149,31 @@ Rectangle {
}
}
function
enterInfoView
()
{
function
enterInfoView
()
{
var
isDefaultSet
=
offlineMapView
.
_currentSelection
.
defaultSet
_map
.
visible
=
true
isMapInteractive
=
false
savedCenter
=
_map
.
toCoordinate
(
Qt
.
point
(
_map
.
width
/
2
,
_map
.
height
/
2
))
savedZoom
=
_map
.
zoomLevel
savedMapType
=
mapType
if
(
!
isDefaultSet
)
{
if
(
!
isDefaultSet
)
{
isMapInteractive
=
false
mapType
=
offlineMapView
.
_currentSelection
.
mapTypeStr
savedCenter
=
_map
.
toCoordinate
(
Qt
.
point
(
_map
.
width
/
2
,
_map
.
height
/
2
))
_map
.
center
=
midPoint
(
offlineMapView
.
_currentSelection
.
topleftLat
,
offlineMapView
.
_currentSelection
.
bottomRightLat
,
offlineMapView
.
_currentSelection
.
topleftLon
,
offlineMapView
.
_currentSelection
.
bottomRightLon
)
savedZoom
=
_map
.
zoomLevel
savedMapType
=
mapType
_map
.
visible
=
true
mapType
=
_offlineMapRoot
.
_currentSelection
.
mapTypeStr
_map
.
center
=
midPoint
(
_offlineMapRoot
.
_currentSelection
.
topleftLat
,
_offlineMapRoot
.
_currentSelection
.
bottomRightLat
,
_offlineMapRoot
.
_currentSelection
.
topleftLon
,
_offlineMapRoot
.
_currentSelection
.
bottomRightLon
)
//-- Delineate Set Region
//-- Delineate Set Region
var
x0
=
_offlineMapRoot
.
_currentSelection
.
topleftLon
var
x0
=
offlineMapView
.
_currentSelection
.
topleftLon
var
x1
=
_offlineMapRoot
.
_currentSelection
.
bottomRightLon
var
x1
=
offlineMapView
.
_currentSelection
.
bottomRightLon
var
y0
=
_offlineMapRoot
.
_currentSelection
.
topleftLat
var
y0
=
offlineMapView
.
_currentSelection
.
topleftLat
var
y1
=
_offlineMapRoot
.
_currentSelection
.
bottomRightLat
var
y1
=
offlineMapView
.
_currentSelection
.
bottomRightLat
mapBoundary
.
topLeft
=
QtPositioning
.
coordinate
(
y0
,
x0
)
mapBoundary
.
topLeft
=
QtPositioning
.
coordinate
(
y0
,
x0
)
mapBoundary
.
bottomRight
=
QtPositioning
.
coordinate
(
y1
,
x1
)
mapBoundary
.
bottomRight
=
QtPositioning
.
coordinate
(
y1
,
x1
)
mapBoundary
.
visible
=
true
mapBoundary
.
visible
=
true
_map
.
fitViewportToMapItems
()
_map
.
fitViewportToMapItems
()
}
}
_tileSetList
.
visible
=
false
_tileSetList
.
visible
=
false
_mapView
.
visible
=
false
addNewSetView
.
visible
=
false
_optionsView
.
visible
=
false
if
(
isDefaultSet
)
{
if
(
isDefaultSet
)
{
_
defaultInfoView
.
visible
=
true
defaultInfoView
.
visible
=
true
}
else
{
}
else
{
_
infoView
.
visible
=
true
infoView
.
visible
=
true
}
}
}
}
...
@@ -213,923 +202,719 @@ Rectangle {
...
@@ -213,923 +202,719 @@ Rectangle {
text
:
QGroundControl
.
mapEngineManager
.
errorMessage
text
:
QGroundControl
.
mapEngineManager
.
errorMessage
icon
:
StandardIcon
.
Critical
icon
:
StandardIcon
.
Critical
standardButtons
:
StandardButton
.
Ok
standardButtons
:
StandardButton
.
Ok
title
:
qsTr
(
"
Err
r
or Message
"
)
title
:
qsTr
(
"
Error Message
"
)
onYes
:
{
onYes
:
{
errorDialog
.
visible
=
false
errorDialog
.
visible
=
false
}
}
}
}
Rectangle
{
Component
{
id
:
_offlineMapTopRect
id
:
optionsDialogComponent
width
:
parent
.
width
height
:
labelTitle
.
height
+
ScreenTools
.
defaultFontPixelHeight
QGCViewDialog
{
color
:
qgcPal
.
window
id
:
optionDialog
anchors.top
:
parent
.
top
Row
{
function
accept
()
{
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
2
QGroundControl
.
mapEngineManager
.
mapboxToken
=
mapBoxToken
.
text
anchors.verticalCenter
:
parent
.
verticalCenter
QGroundControl
.
mapEngineManager
.
maxDiskCache
=
parseInt
(
maxCacheSize
.
text
)
QGCLabel
{
QGroundControl
.
mapEngineManager
.
maxMemCache
=
parseInt
(
maxCacheMemSize
.
text
)
id
:
labelTitle
optionDialog
.
hideDialog
()
text
:
qsTr
(
"
Offline Maps
"
)
font.pointSize
:
ScreenTools
.
mediumFontPointSize
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCCheckBox
{
id
:
showTilePreview
text
:
qsTr
(
"
Show tile min/max zoom level preview
"
)
checked
:
false
visible
:
_mapView
.
visible
&&
!
ScreenTools
.
isTinyScreen
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
}
}
Map
{
QGCFlickable
{
id
:
_map
anchors.fill
:
parent
anchors.top
:
_offlineMapTopRect
.
bottom
contentHeight
:
optionsColumn
.
height
anchors.left
:
parent
.
left
anchors.bottom
:
parent
.
bottom
anchors.margins
:
mapMargin
width
:
parent
.
width
-
ScreenTools
.
defaultFontPixelWidth
center
:
QGroundControl
.
defaultMapPosition
visible
:
false
gesture.flickDeceleration
:
3000
plugin
:
Plugin
{
name
:
"
QGroundControl
"
}
Rectangle
{
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0
)
border.color
:
"
black
"
border.width
:
1
anchors.fill
:
parent
}
MapRectangle
{
Column
{
id
:
mapBoundary
id
:
optionsColumn
border.width
:
2
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
border.color
:
"
red
"
anchors.left
:
parent
.
left
color
:
Qt
.
rgba
(
1
,
0
,
0
,
0.05
)
anchors.right
:
parent
.
right
smooth
:
true
anchors.top
:
parent
.
top
antialiasing
:
true
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
}
Component.onCompleted
:
{
QGCLabel
{
text
:
qsTr
(
"
Max Cache Disk Size (MB):
"
)
}
center
=
QGroundControl
.
flightMapPosition
zoomLevel
=
QGroundControl
.
flightMapZoom
}
onCenterChanged
:
{
QGCTextField
{
handleChanges
()
id
:
maxCacheSize
checkSanity
()
maximumLength
:
6
}
inputMethodHints
:
Qt
.
ImhDigitsOnly
onZoomLevelChanged
:
{
validator
:
IntValidator
{
bottom
:
1
;
top
:
262144
;}
handleChanges
()
text
:
QGroundControl
.
mapEngineManager
.
maxDiskCache
checkSanity
()
}
}
onWidthChanged
:
{
handleChanges
()
checkSanity
()
}
onHeightChanged
:
{
handleChanges
()
checkSanity
()
}
// Used to make pinch zoom work
MouseArea
{
anchors.fill
:
parent
}
}
QGCFlickable
{
Item
{
width
:
1
;
height
:
1
}
id
:
_tileSetList
clip
:
true
QGCLabel
{
text
:
qsTr
(
"
Max Cache Memory Size (MB):
"
)
}
anchors.top
:
_offlineMapTopRect
.
bottom
anchors.left
:
parent
.
left
QGCTextField
{
anchors.right
:
parent
.
right
id
:
maxCacheMemSize
anchors.bottom
:
_optionsButton
.
top
maximumLength
:
4
contentHeight
:
_cacheList
.
height
inputMethodHints
:
Qt
.
ImhDigitsOnly
flickableDirection
:
Flickable
.
VerticalFlick
validator
:
IntValidator
{
bottom
:
1
;
top
:
4096
;}
text
:
QGroundControl
.
mapEngineManager
.
maxMemCache
Column
{
id
:
_cacheList
width
:
Math
.
min
(
parent
.
width
,
(
ScreenTools
.
defaultFontPixelWidth
*
50
).
toFixed
(
0
))
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
anchors.horizontalCenter
:
parent
.
horizontalCenter
OfflineMapButton
{
text
:
qsTr
(
"
Add new set
"
)
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
height
:
ScreenTools
.
defaultFontPixelHeight
*
2
onClicked
:
{
_offlineMapRoot
.
_currentSelection
=
null
showMap
()
}
}
Repeater
{
model
:
QGroundControl
.
mapEngineManager
.
tileSets
delegate
:
OfflineMapButton
{
text
:
object
.
name
size
:
object
.
downloadStatus
complete
:
object
.
complete
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
height
:
ScreenTools
.
defaultFontPixelHeight
*
2
onClicked
:
{
_offlineMapRoot
.
_currentSelection
=
object
showInfo
()
}
}
}
QGCLabel
{
font.pointSize
:
_adjustableFontPointSize
text
:
qsTr
(
"
Memory cache changes require a restart to take effect.
"
)
}
Item
{
width
:
1
;
height
:
1
}
QGCLabel
{
text
:
qsTr
(
"
MapBox Access Token
"
)
}
QGCTextField
{
id
:
mapBoxToken
maximumLength
:
256
width
:
ScreenTools
.
defaultFontPixelWidth
*
30
text
:
QGroundControl
.
mapEngineManager
.
mapboxToken
}
QGCLabel
{
text
:
qsTr
(
"
With an access token, you can use MapBox Maps.
"
)
font.pointSize
:
_adjustableFontPointSize
}
}
// GridLayout
}
// QGCFlickable
}
// QGCViewDialog - optionsDialog
}
// Component - optionsDialogComponent
Component
{
id
:
deleteConfirmationDialogComponent
QGCViewMessage
{
id
:
deleteConfirmationDialog
message
:
qsTr
(
"
Delete %1 and all its tiles.
\n\n
Is this really what you want?
"
).
arg
(
offlineMapView
.
_currentSelection
.
name
)
function
accept
()
{
QGroundControl
.
mapEngineManager
.
deleteTileSet
(
offlineMapView
.
_currentSelection
)
deleteConfirmationDialog
.
hideDialog
()
leaveInfoView
()
showList
()
}
}
}
}
}
}
QGCButton
{
Component
{
id
:
_optionsButton
id
:
deleteSystemSetConfirmationDialogComponent
text
:
qsTr
(
"
Options
"
)
visible
:
_tileSetList
.
visible
anchors.bottom
:
parent
.
bottom
anchors.right
:
parent
.
right
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
onClicked
:
showOptions
()
}
//-- Offline Map Definition
QGCViewMessage
{
Item
{
id
:
deleteSystemSetConfirmationDialog
id
:
_mapView
message
:
qsTr
(
"
This will delete all tiles INCLUDING the tile sets you have created yourself.
\n\n
Is this really what you want?
"
)
width
:
parent
.
width
anchors.top
:
_offlineMapTopRect
.
bottom
function
accept
()
{
anchors.bottom
:
parent
.
bottom
QGroundControl
.
mapEngineManager
.
deleteTileSet
(
offlineMapView
.
_currentSelection
)
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
deleteSystemSetConfirmationDialog
.
hideDialog
()
visible
:
false
leaveInfoView
()
showList
()
//-- Zoom Preview Maps
Item
{
width
:
parent
.
width
anchors.top
:
parent
.
top
visible
:
showTilePreview
.
checked
Rectangle
{
width
:
ScreenTools
.
defaultFontPixelHeight
*
16
height
:
ScreenTools
.
defaultFontPixelHeight
*
9
anchors.top
:
parent
.
top
anchors.left
:
parent
.
left
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
color
:
"
black
"
Map
{
id
:
_mapMin
anchors.fill
:
parent
anchors.margins
:
2
zoomLevel
:
_slider0
.
value
center
:
_map
.
center
gesture.enabled
:
false
activeMapType
:
_map
.
activeMapType
plugin
:
Plugin
{
name
:
"
QGroundControl
"
}
}
}
Rectangle
{
width
:
ScreenTools
.
defaultFontPixelHeight
*
16
height
:
ScreenTools
.
defaultFontPixelHeight
*
9
anchors.top
:
parent
.
top
anchors.right
:
parent
.
right
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
color
:
"
black
"
Map
{
id
:
_mapMax
anchors.fill
:
parent
anchors.margins
:
2
zoomLevel
:
_slider1
.
value
center
:
_map
.
center
gesture.enabled
:
false
activeMapType
:
_map
.
activeMapType
plugin
:
Plugin
{
name
:
"
QGroundControl
"
}
}
}
}
}
}
//-- Tile set settings
}
Rectangle
{
id
:
bottomRect
QGCViewPanel
{
width
:
_controlRow
.
width
+
(
ScreenTools
.
defaultFontPixelWidth
*
2
)
id
:
panel
height
:
_controlRow
.
height
+
(
ScreenTools
.
defaultFontPixelHeight
*
2
)
anchors.fill
:
parent
color
:
qgcPal
.
window
radius
:
ScreenTools
.
defaultFontPixelWidth
*
0.5
Map
{
anchors.horizontalCenter
:
parent
.
horizontalCenter
id
:
_map
anchors.fill
:
parent
center
:
QGroundControl
.
defaultMapPosition
visible
:
false
gesture.flickDeceleration
:
3000
plugin
:
Plugin
{
name
:
"
QGroundControl
"
}
MapRectangle
{
id
:
mapBoundary
border.width
:
2
border.color
:
"
red
"
color
:
Qt
.
rgba
(
1
,
0
,
0
,
0.05
)
smooth
:
true
antialiasing
:
true
}
Component.onCompleted
:
{
Component.onCompleted
:
{
color
=
Qt
.
rgba
(
color
.
r
,
color
.
g
,
color
.
b
,
0.85
)
center
=
QGroundControl
.
flightMapPosition
zoomLevel
=
QGroundControl
.
flightMapZoom
}
}
anchors.bottom
:
parent
.
bottom
Row
{
onCenterChanged
:
{
id
:
_controlRow
handleChanges
()
anchors.centerIn
:
parent
checkSanity
()
spacing
:
ScreenTools
.
defaultFontPixelWidth
*
0.5
}
Rectangle
{
onZoomLevelChanged
:
{
height
:
_zoomRow
.
height
+
ScreenTools
.
defaultFontPixelHeight
*
1.5
handleChanges
()
width
:
_zoomRow
.
width
+
ScreenTools
.
defaultFontPixelWidth
checkSanity
()
color
:
"
#98aca4
"
}
border.color
:
"
black
"
onWidthChanged
:
{
border.width
:
2
handleChanges
()
radius
:
ScreenTools
.
defaultFontPixelWidth
*
0.5
checkSanity
()
anchors.verticalCenter
:
parent
.
verticalCenter
}
Row
{
onHeightChanged
:
{
id
:
_zoomRow
handleChanges
()
anchors.centerIn
:
parent
checkSanity
()
Column
{
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
anchors.verticalCenter
:
parent
.
verticalCenter
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
*
0.5
Column
{
anchors.verticalCenter
:
parent
.
verticalCenter
Label
{
text
:
qsTr
(
"
Min
"
)
color
:
"
black
"
width
:
ScreenTools
.
defaultFontPixelWidth
*
4
font.pointSize
:
ScreenTools
.
smallFontPointSize
horizontalAlignment
:
Text
.
AlignHCenter
font.family
:
ScreenTools
.
normalFontFamily
}
Label
{
text
:
qsTr
(
"
Zoom
"
)
color
:
"
black
"
width
:
ScreenTools
.
defaultFontPixelWidth
*
4
font.family
:
ScreenTools
.
normalFontFamily
font.pointSize
:
ScreenTools
.
smallFontPointSize
horizontalAlignment
:
Text
.
AlignHCenter
}
}
Slider
{
id
:
_slider0
minimumValue
:
minZoomLevel
maximumValue
:
maxZoomLevel
stepSize
:
1
tickmarksEnabled
:
false
orientation
:
Qt
.
Horizontal
updateValueWhileDragging
:
true
anchors.verticalCenter
:
parent
.
verticalCenter
style
:
SliderStyle
{
groove
:
Rectangle
{
implicitWidth
:
_netSetSliderWidth
implicitHeight
:
4
color
:
"
gray
"
radius
:
4
}
handle
:
Rectangle
{
anchors.centerIn
:
parent
color
:
control
.
pressed
?
"
white
"
:
"
lightgray
"
border.color
:
"
gray
"
border.width
:
2
implicitWidth
:
ScreenTools
.
defaultFontPixelWidth
*
3
implicitHeight
:
ScreenTools
.
defaultFontPixelWidth
*
3
radius
:
10
Label
{
text
:
_slider0
.
value
anchors.centerIn
:
parent
font.family
:
ScreenTools
.
normalFontFamily
font.pointSize
:
ScreenTools
.
smallFontPointSize
}
}
}
Component.onCompleted
:
{
_slider0
.
value
=
_map
.
zoomLevel
-
2
}
onValueChanged
:
{
if
(
_slider1
)
{
if
(
_slider0
.
value
>
_slider1
.
value
)
_slider1
.
value
=
_slider0
.
value
else
{
handleChanges
()
checkSanity
()
}
}
}
}
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
*
0.5
Column
{
anchors.verticalCenter
:
parent
.
verticalCenter
Label
{
text
:
qsTr
(
"
Max
"
)
color
:
"
black
"
width
:
ScreenTools
.
defaultFontPixelWidth
*
4
font.pointSize
:
ScreenTools
.
smallFontPointSize
font.family
:
ScreenTools
.
normalFontFamily
horizontalAlignment
:
Text
.
AlignHCenter
}
Label
{
text
:
qsTr
(
"
Zoom
"
)
color
:
"
black
"
width
:
ScreenTools
.
defaultFontPixelWidth
*
4
font.pointSize
:
ScreenTools
.
smallFontPointSize
font.family
:
ScreenTools
.
normalFontFamily
horizontalAlignment
:
Text
.
AlignHCenter
}
}
Slider
{
id
:
_slider1
minimumValue
:
minZoomLevel
maximumValue
:
maxZoomLevel
stepSize
:
1
tickmarksEnabled
:
false
orientation
:
Qt
.
Horizontal
updateValueWhileDragging
:
true
anchors.verticalCenter
:
parent
.
verticalCenter
style
:
SliderStyle
{
groove
:
Rectangle
{
implicitWidth
:
_netSetSliderWidth
implicitHeight
:
4
color
:
"
gray
"
radius
:
4
}
handle
:
Rectangle
{
anchors.centerIn
:
parent
color
:
control
.
pressed
?
"
white
"
:
"
lightgray
"
border.color
:
"
gray
"
border.width
:
2
implicitWidth
:
ScreenTools
.
defaultFontPixelWidth
*
3
implicitHeight
:
ScreenTools
.
defaultFontPixelWidth
*
3
radius
:
10
Label
{
text
:
_slider1
.
value
anchors.centerIn
:
parent
font.family
:
ScreenTools
.
normalFontFamily
font.pointSize
:
ScreenTools
.
smallFontPointSize
}
}
}
Component.onCompleted
:
{
_slider1
.
value
=
_map
.
zoomLevel
+
2
}
onValueChanged
:
{
if
(
_slider1
.
value
<
_slider0
.
value
)
_slider0
.
value
=
_slider1
.
value
else
{
handleChanges
()
checkSanity
()
}
}
}
}
}
Column
{
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
anchors.verticalCenter
:
parent
.
verticalCenter
Label
{
text
:
qsTr
(
"
Tile Count
"
)
color
:
"
black
"
width
:
ScreenTools
.
defaultFontPixelWidth
*
12
font.pointSize
:
ScreenTools
.
smallFontPointSize
font.family
:
ScreenTools
.
normalFontFamily
horizontalAlignment
:
Text
.
AlignHCenter
}
Label
{
text
:
QGroundControl
.
mapEngineManager
.
tileCountStr
color
:
"
black
"
width
:
ScreenTools
.
defaultFontPixelWidth
*
12
font.family
:
ScreenTools
.
normalFontFamily
font.pointSize
:
ScreenTools
.
defaultFontPointSize
horizontalAlignment
:
Text
.
AlignHCenter
}
Label
{
text
:
qsTr
(
"
Set Size (Est)
"
)
color
:
"
black
"
width
:
ScreenTools
.
defaultFontPixelWidth
*
12
font.pointSize
:
ScreenTools
.
smallFontPointSize
font.family
:
ScreenTools
.
normalFontFamily
horizontalAlignment
:
Text
.
AlignHCenter
}
Label
{
text
:
QGroundControl
.
mapEngineManager
.
tileSizeStr
color
:
"
black
"
width
:
ScreenTools
.
defaultFontPixelWidth
*
12
font.family
:
ScreenTools
.
normalFontFamily
font.pointSize
:
ScreenTools
.
defaultFontPointSize
horizontalAlignment
:
Text
.
AlignHCenter
}
}
}
}
Column
{
anchors.verticalCenter
:
parent
.
verticalCenter
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
text
:
qsTr
(
"
Name:
"
)
width
:
_newSetMiddleLabel
anchors.verticalCenter
:
parent
.
verticalCenter
horizontalAlignment
:
Text
.
AlignRight
}
QGCTextField
{
id
:
setName
width
:
_newSetMiddleField
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
text
:
qsTr
(
"
Description:
"
)
width
:
_newSetMiddleLabel
anchors.verticalCenter
:
parent
.
verticalCenter
horizontalAlignment
:
Text
.
AlignRight
}
QGCTextField
{
id
:
setDescription
text
:
qsTr
(
"
Description
"
)
width
:
_newSetMiddleField
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
text
:
qsTr
(
"
Map Type:
"
)
width
:
_newSetMiddleLabel
anchors.verticalCenter
:
parent
.
verticalCenter
horizontalAlignment
:
Text
.
AlignRight
}
QGCComboBox
{
id
:
mapCombo
width
:
_newSetMiddleField
model
:
QGroundControl
.
mapEngineManager
.
mapList
onActivated
:
{
mapType
=
textAt
(
index
)
if
(
_dropButtonsExclusiveGroup
.
current
)
_dropButtonsExclusiveGroup
.
current
.
checked
=
false
_dropButtonsExclusiveGroup
.
current
=
null
}
Component.onCompleted
:
{
var
index
=
mapCombo
.
find
(
mapType
)
if
(
index
===
-
1
)
{
console
.
warn
(
qsTr
(
"
Active map name not in combo
"
),
mapType
)
}
else
{
mapCombo
.
currentIndex
=
index
}
}
}
}
}
Item
{
height
:
1
width
:
ScreenTools
.
defaultFontPixelWidth
}
Column
{
anchors.verticalCenter
:
parent
.
verticalCenter
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
QGCButton
{
text
:
qsTr
(
"
Download
"
)
enabled
:
setName
.
text
.
length
>
0
width
:
ScreenTools
.
defaultFontPixelWidth
*
10
onClicked
:
{
if
(
QGroundControl
.
mapEngineManager
.
findName
(
setName
.
text
))
{
duplicateName
.
visible
=
true
}
else
{
/* This does not work if hosted by QQuickWidget. Waiting until we're 100% QtQuick
var mapImage
_map.grabToImage(function(result) { mapImage = result; })
QGroundControl.mapEngineManager.startDownload(setName.text, setDescription.text, mapType, mapImage);
*/
QGroundControl
.
mapEngineManager
.
startDownload
(
setName
.
text
,
setDescription
.
text
,
mapType
);
showList
()
}
}
}
QGCButton
{
text
:
qsTr
(
"
Cancel
"
)
width
:
ScreenTools
.
defaultFontPixelWidth
*
10
onClicked
:
{
showList
()
}
}
MessageDialog
{
id
:
duplicateName
visible
:
false
icon
:
StandardIcon
.
Warning
standardButtons
:
StandardButton
.
Ok
title
:
qsTr
(
"
Tile Set Already Exists
"
)
text
:
qsTr
(
"
Tile Set
\"
%1
\"
already exists.
\n
Please select a different name.
"
).
arg
(
setName
.
text
)
onYes
:
{
duplicateName
.
visible
=
false
}
}
}
}
}
}
}
//-- Show Set Info
MapScale
{
Item
{
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
/
2
id
:
_infoView
anchors.bottomMargin
:
anchors
.
leftMargin
width
:
parent
.
width
anchors.left
:
parent
.
left
anchors.bottom
:
parent
.
bottom
anchors.bottom
:
parent
.
bottom
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
mapControl
:
_map
visible
:
false
//-- Tile set settings
Rectangle
{
id
:
bottomInfoRect
width
:
_controlInfoRow
.
width
+
(
ScreenTools
.
defaultFontPixelWidth
*
2
)
height
:
_controlInfoRow
.
height
+
(
ScreenTools
.
defaultFontPixelHeight
*
2
)
color
:
qgcPal
.
window
radius
:
ScreenTools
.
defaultFontPixelWidth
*
0.5
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
anchors.horizontalCenter
:
parent
.
horizontalCenter
Component.onCompleted
:
{
color
=
Qt
.
rgba
(
color
.
r
,
color
.
g
,
color
.
b
,
0.85
)
}
}
anchors.bottom
:
parent
.
bottom
Row
{
//-- Show Set Info
id
:
_controlInfoRow
Rectangle
{
anchors.centerIn
:
parent
id
:
infoView
spacing
:
ScreenTools
.
defaultFontPixelWidth
*
4
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
y
:
Math
.
max
(
anchors
.
margins
,
(
parent
.
height
-
(
anchors
.
margins
*
2
)
-
height
)
/
2
)
anchors.right
:
parent
.
right
width
:
Math
.
max
(
ScreenTools
.
defaultFontPixelWidth
*
20
,
controlInfoFlickable
.
width
+
(
infoView
.
_margins
*
2
))
height
:
Math
.
min
(
parent
.
height
-
(
anchors
.
margins
*
2
),
controlInfoFlickable
.
y
+
controlInfoColumn
.
height
+
ScreenTools
.
defaultFontPixelHeight
)
color
:
qgcPal
.
window
opacity
:
0.85
radius
:
ScreenTools
.
defaultFontPixelWidth
*
0.5
visible
:
false
readonly
property
real
_margins
:
ScreenTools
.
defaultFontPixelHeight
/
2
QGCLabel
{
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
/
4
anchors.top
:
parent
.
top
anchors.right
:
parent
.
right
text
:
"
X
"
}
Column
{
Column
{
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
id
:
titleColumn
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
anchors.margins
:
infoView
.
_margins
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.top
:
parent
.
top
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
QGCLabel
{
QGCLabel
{
text
:
_offlineMapRoot
.
_currentSelection
?
_offlineMapRoot
.
_currentSelection
.
name
:
""
anchors.left
:
parent
.
left
font.pointSize
:
ScreenTools
.
isAndroid
?
ScreenTools
.
mediumFontPointSize
:
ScreenTools
.
largeFontPointSize
anchors.right
:
parent
.
right
anchors.horizontalCenter
:
parent
.
horizontalCenter
wrapMode
:
Text
.
WordWrap
text
:
offlineMapView
.
_currentSelection
?
offlineMapView
.
_currentSelection
.
name
:
""
font.pointSize
:
_saveRealEstate
?
ScreenTools
.
defaultFontPointSize
:
ScreenTools
.
mediumFontPointSize
horizontalAlignment
:
Text
.
AlignHCenter
}
}
QGCLabel
{
QGCLabel
{
text
:
_offlineMapRoot
.
_currentSelection
?
_offlineMapRoot
.
_currentSelection
.
description
:
""
anchors.left
:
parent
.
left
visible
:
text
!==
qsTr
(
"
Description
"
)
anchors.right
:
parent
.
right
anchors.horizontalCenter
:
parent
.
horizontalCenter
wrapMode
:
Text
.
WordWrap
text
:
offlineMapView
.
_currentSelection
?
offlineMapView
.
_currentSelection
.
description
:
""
visible
:
text
!==
qsTr
(
"
Description
"
)
horizontalAlignment
:
Text
.
AlignHCenter
}
}
QGCLabel
{
QGCLabel
{
text
:
_offlineMapRoot
.
_currentSelection
?
"
(
"
+
_offlineMapRoot
.
_currentSelection
.
mapTypeStr
+
"
)
"
:
""
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
wrapMode
:
Text
.
WordWrap
text
:
offlineMapView
.
_currentSelection
?
"
(
"
+
offlineMapView
.
_currentSelection
.
mapTypeStr
+
"
)
"
:
""
horizontalAlignment
:
Text
.
AlignHCenter
}
}
}
}
GridLayout
{
columns
:
2
MouseArea
{
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
anchors.fill
:
titleColumn
rowSpacing
:
ScreenTools
.
defaultFontPixelWidth
preventStealing
:
true
columnSpacing
:
ScreenTools
.
defaultFontPixelHeight
QGCLabel
{
onClicked
:
{
text
:
qsTr
(
"
Min Zoom:
"
)
leaveInfoView
()
}
showList
()
QGCLabel
{
text
:
_offlineMapRoot
.
_currentSelection
?
_offlineMapRoot
.
_currentSelection
.
minZoom
:
""
}
QGCLabel
{
text
:
qsTr
(
"
Max Zoom:
"
)
}
QGCLabel
{
text
:
_offlineMapRoot
.
_currentSelection
?
_offlineMapRoot
.
_currentSelection
.
maxZoom
:
""
}
QGCLabel
{
text
:
qsTr
(
"
Total:
"
)
}
QGCLabel
{
text
:
(
_offlineMapRoot
.
_currentSelection
?
_offlineMapRoot
.
_currentSelection
.
numTilesStr
:
""
)
+
"
(
"
+
(
_offlineMapRoot
.
_currentSelection
?
_offlineMapRoot
.
_currentSelection
.
tilesSizeStr
:
""
)
+
"
)
"
}
QGCLabel
{
text
:
qsTr
(
"
Downloaded:
"
)
visible
:
_offlineMapRoot
.
_currentSelection
&&
!
_offlineMapRoot
.
_currentSelection
.
complete
}
QGCLabel
{
text
:
(
_offlineMapRoot
.
_currentSelection
?
_offlineMapRoot
.
_currentSelection
.
savedTilesStr
:
""
)
+
"
(
"
+
(
_offlineMapRoot
.
_currentSelection
?
_offlineMapRoot
.
_currentSelection
.
savedSizeStr
:
""
)
+
"
)
"
visible
:
_offlineMapRoot
.
_currentSelection
&&
!
_offlineMapRoot
.
_currentSelection
.
complete
}
QGCLabel
{
text
:
qsTr
(
"
Error Count:
"
)
visible
:
_offlineMapRoot
.
_currentSelection
&&
!
_offlineMapRoot
.
_currentSelection
.
complete
}
QGCLabel
{
text
:
_offlineMapRoot
.
_currentSelection
?
_offlineMapRoot
.
_currentSelection
.
errorCountStr
:
""
visible
:
_offlineMapRoot
.
_currentSelection
&&
!
_offlineMapRoot
.
_currentSelection
.
complete
}
}
}
}
Column
{
anchors.verticalCenter
:
parent
.
verticalCenter
QGCFlickable
{
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
id
:
controlInfoFlickable
QGCButton
{
anchors.margins
:
infoView
.
_margins
width
:
ScreenTools
.
defaultFontPixelWidth
*
18
anchors.top
:
titleColumn
.
bottom
text
:
qsTr
(
"
Delete
"
)
anchors.bottom
:
parent
.
bottom
enabled
:
_offlineMapRoot
.
_currentSelection
&&
(
!
_offlineMapRoot
.
_currentSelection
.
deleting
)
anchors.left
:
parent
.
left
onClicked
:
{
width
:
controlInfoColumn
.
width
if
(
_offlineMapRoot
.
_currentSelection
)
clip
:
true
deleteDialog
.
visible
=
true
contentHeight
:
controlInfoColumn
.
height
}
MessageDialog
{
Column
{
id
:
deleteDialog
id
:
controlInfoColumn
visible
:
false
spacing
:
ScreenTools
.
defaultFontPixelHeight
icon
:
StandardIcon
.
Warning
standardButtons
:
StandardButton
.
Yes
|
StandardButton
.
No
GridLayout
{
title
:
qsTr
(
"
Delete Tile Set
"
)
columns
:
2
text
:
{
rowSpacing
:
0
if
(
_offlineMapRoot
.
_currentSelection
)
{
var
blurb
=
qsTr
(
"
Delete %1 and all its tiles.
\n
Is this really what you want?
"
).
arg
(
_offlineMapRoot
.
_currentSelection
.
name
)
QGCLabel
{
text
:
qsTr
(
"
Min Zoom:
"
)
}
return
blurb
QGCLabel
{
text
:
offlineMapView
.
_currentSelection
?
offlineMapView
.
_currentSelection
.
minZoom
:
""
}
}
return
""
QGCLabel
{
text
:
qsTr
(
"
Max Zoom:
"
)
}
QGCLabel
{
text
:
offlineMapView
.
_currentSelection
?
offlineMapView
.
_currentSelection
.
maxZoom
:
""
}
QGCLabel
{
text
:
qsTr
(
"
Total:
"
)
}
QGCLabel
{
text
:
(
offlineMapView
.
_currentSelection
?
offlineMapView
.
_currentSelection
.
numTilesStr
:
""
)
+
"
(
"
+
(
offlineMapView
.
_currentSelection
?
offlineMapView
.
_currentSelection
.
tilesSizeStr
:
""
)
+
"
)
"
}
QGCLabel
{
text
:
qsTr
(
"
Downloaded:
"
)
visible
:
offlineMapView
.
_currentSelection
&&
!
offlineMapView
.
_currentSelection
.
complete
}
}
onYes
:
{
QGCLabel
{
leaveInfoView
()
text
:
(
offlineMapView
.
_currentSelection
?
offlineMapView
.
_currentSelection
.
savedTilesStr
:
""
)
+
"
(
"
+
(
offlineMapView
.
_currentSelection
?
offlineMapView
.
_currentSelection
.
savedSizeStr
:
""
)
+
"
)
"
if
(
_offlineMapRoot
.
_currentSelection
)
visible
:
offlineMapView
.
_currentSelection
&&
!
offlineMapView
.
_currentSelection
.
complete
QGroundControl
.
mapEngineManager
.
deleteTileSet
(
_offlineMapRoot
.
_currentSelection
)
deleteDialog
.
visible
=
false
showList
()
}
}
onNo
:
{
deleteDialog
.
visible
=
false
QGCLabel
{
text
:
qsTr
(
"
Error Count:
"
)
visible
:
offlineMapView
.
_currentSelection
&&
!
offlineMapView
.
_currentSelection
.
complete
}
QGCLabel
{
text
:
offlineMapView
.
_currentSelection
?
offlineMapView
.
_currentSelection
.
errorCountStr
:
""
visible
:
offlineMapView
.
_currentSelection
&&
!
offlineMapView
.
_currentSelection
.
complete
}
}
}
}
}
QGCButton
{
QGCButton
{
text
:
qsTr
(
"
Resume Download
"
)
text
:
qsTr
(
"
Resume Download
"
)
width
:
ScreenTools
.
defaultFontPixelWidth
*
18
visible
:
offlineMapView
.
_currentSelection
&&
(
!
offlineMapView
.
_currentSelection
.
complete
&&
!
offlineMapView
.
_currentSelection
.
downloading
)
enabled
:
_offlineMapRoot
.
_currentSelection
&&
(
!
_offlineMapRoot
.
_currentSelection
.
deleting
&&
!
_offlineMapRoot
.
_currentSelection
.
downloading
)
visible
:
_offlineMapRoot
.
_currentSelection
&&
(
!
_offlineMapRoot
.
_currentSelection
.
complete
&&
!
_offlineMapRoot
.
_currentSelection
.
downloading
)
onClicked
:
{
onClicked
:
{
if
(
offlineMapView
.
_currentSelection
)
if
(
_offlineMapRoot
.
_currentSelection
)
offlineMapView
.
_currentSelection
.
resumeDownloadTask
(
)
_offlineMapRoot
.
_currentSelection
.
resumeDownloadTask
()
}
}
}
}
QGCButton
{
QGCButton
{
text
:
qsTr
(
"
Cancel Download
"
)
text
:
qsTr
(
"
Cancel Download
"
)
width
:
ScreenTools
.
defaultFontPixelWidth
*
18
visible
:
offlineMapView
.
_currentSelection
&&
(
!
offlineMapView
.
_currentSelection
.
complete
&&
offlineMapView
.
_currentSelection
.
downloading
)
enabled
:
_offlineMapRoot
.
_currentSelection
&&
(
!
_offlineMapRoot
.
_currentSelection
.
deleting
&&
_offlineMapRoot
.
_currentSelection
.
downloading
)
visible
:
_offlineMapRoot
.
_currentSelection
&&
(
!
_offlineMapRoot
.
_currentSelection
.
complete
&&
_offlineMapRoot
.
_currentSelection
.
downloading
)
onClicked
:
{
onClicked
:
{
if
(
offlineMapView
.
_currentSelection
)
if
(
_offlineMapRoot
.
_currentSelection
)
offlineMapView
.
_currentSelection
.
cancelDownloadTask
(
)
_offlineMapRoot
.
_currentSelection
.
cancelDownloadTask
()
}
}
}
}
QGCButton
{
QGCButton
{
text
:
qsTr
(
"
Back
"
)
text
:
qsTr
(
"
Delete
"
)
width
:
ScreenTools
.
defaultFontPixelWidth
*
18
onClicked
:
showDialog
(
deleteConfirmationDialogComponent
,
qsTr
(
"
Confirm Delete
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Yes
|
StandardButton
.
No
)
onClicked
:
{
leaveInfoView
()
showList
()
}
}
}
}
// Column
}
}
// QGCFlickable
}
}
// Rectangle - infoView
}
}
//-- Show info on default tile set
//-- Show Default Set Info
Rectangle
{
Rectangle
{
id
:
_defaultInfoView
id
:
defaultInfoView
color
:
qgcPal
.
windowShade
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
width
:
parent
.
width
y
:
Math
.
max
(
anchors
.
margins
,
(
parent
.
height
-
(
anchors
.
margins
*
2
)
-
height
)
/
2
)
anchors.top
:
_offlineMapTopRect
.
bottom
anchors.right
:
parent
.
right
anchors.bottom
:
parent
.
bottom
width
:
ScreenTools
.
defaultFontPixelWidth
*
20
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
height
:
Math
.
min
(
parent
.
height
-
(
anchors
.
margins
*
2
),
defaultControlInfoFlickable
.
y
+
defaultControlInfoColumn
.
height
+
ScreenTools
.
defaultFontPixelHeight
)
visible
:
false
color
:
qgcPal
.
window
QGCFlickable
{
opacity
:
0.85
id
:
infoScroll
radius
:
ScreenTools
.
defaultFontPixelWidth
*
0.5
anchors.fill
:
parent
visible
:
false
contentHeight
:
infoColumn
.
height
flickableDirection
:
Flickable
.
VerticalFlick
QGCLabel
{
clip
:
true
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
/
4
Column
{
anchors.top
:
parent
.
top
id
:
infoColumn
anchors.right
:
parent
.
right
width
:
parent
.
width
text
:
"
X
"
spacing
:
ScreenTools
.
defaultFontPixelHeight
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
width
:
1
}
}
Rectangle
{
id
:
_infoNameRect
Column
{
width
:
infoWidth
id
:
defaultTitleColumn
height
:
infoCol
.
height
+
(
ScreenTools
.
defaultFontPixelHeight
*
2
)
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
/
2
color
:
qgcPal
.
window
anchors.top
:
parent
.
top
radius
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
anchors.left
:
parent
.
left
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.right
:
parent
.
right
Column
{
id
:
infoCol
QGCLabel
{
spacing
:
ScreenTools
.
defaultFontPixelHeight
anchors.left
:
parent
.
left
anchors.centerIn
:
parent
anchors.right
:
parent
.
right
QGCLabel
{
wrapMode
:
Text
.
WordWrap
id
:
nameLabel
text
:
offlineMapView
.
_currentSelection
?
offlineMapView
.
_currentSelection
.
name
:
""
text
:
_offlineMapRoot
.
_currentSelection
?
_offlineMapRoot
.
_currentSelection
.
name
:
""
font.pointSize
:
_saveRealEstate
?
ScreenTools
.
defaultFontPointSize
:
ScreenTools
.
mediumFontPointSize
font.pointSize
:
ScreenTools
.
isAndroid
?
ScreenTools
.
mediumFontPointSize
:
ScreenTools
.
largeFontPointSize
horizontalAlignment
:
Text
.
AlignHCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
}
QGCLabel
{
QGCLabel
{
id
:
descLabel
anchors.left
:
parent
.
left
text
:
_offlineMapRoot
.
_currentSelection
?
_offlineMapRoot
.
_currentSelection
.
description
:
""
anchors.right
:
parent
.
right
anchors.horizontalCenter
:
parent
.
horizontalCenter
wrapMode
:
Text
.
WordWrap
}
text
:
qsTr
(
"
System Wide Tile Cache
"
)
horizontalAlignment
:
Text
.
AlignHCenter
}
}
}
}
Rectangle
{
id
:
_infoRect
MouseArea
{
width
:
infoWidth
anchors.fill
:
defaultTitleColumn
height
:
infoGrid
.
height
+
(
ScreenTools
.
defaultFontPixelHeight
*
4
)
preventStealing
:
true
color
:
qgcPal
.
window
radius
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
onClicked
:
{
anchors.horizontalCenter
:
parent
.
horizontalCenter
leaveInfoView
()
GridLayout
{
showList
()
id
:
infoGrid
columns
:
2
anchors.centerIn
:
parent
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
*
2
rowSpacing
:
ScreenTools
.
defaultFontPixelWidth
columnSpacing
:
ScreenTools
.
defaultFontPixelHeight
*
2
QGCLabel
{
text
:
qsTr
(
"
Default Set Size:
"
)
}
QGCLabel
{
text
:
_offlineMapRoot
.
_currentSelection
?
_offlineMapRoot
.
_currentSelection
.
tilesSizeStr
:
""
}
QGCLabel
{
text
:
qsTr
(
"
Default Set Tile Count:
"
)
}
QGCLabel
{
text
:
_offlineMapRoot
.
_currentSelection
?
_offlineMapRoot
.
_currentSelection
.
numTilesStr
:
""
}
QGCLabel
{
text
:
qsTr
(
"
Total Size (All Sets):
"
)
}
QGCLabel
{
text
:
_offlineMapRoot
.
_currentSelection
?
_offlineMapRoot
.
_currentSelection
.
savedSizeStr
:
""
}
QGCLabel
{
text
:
qsTr
(
"
Total Count (All Sets):
"
)
}
QGCLabel
{
text
:
_offlineMapRoot
.
_currentSelection
?
_offlineMapRoot
.
_currentSelection
.
savedTilesStr
:
""
}
}
}
}
}
Row
{
anchors.horizontalCenter
:
parent
.
horizontalCenter
QGCFlickable
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
id
:
defaultControlInfoFlickable
QGCButton
{
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
width
:
ScreenTools
.
defaultFontPixelWidth
*
18
anchors.top
:
defaultTitleColumn
.
bottom
text
:
qsTr
(
"
Delete
"
)
anchors.left
:
parent
.
left
enabled
:
_offlineMapRoot
.
_currentSelection
&&
(
!
_offlineMapRoot
.
_currentSelection
.
deleting
)
anchors.right
:
parent
.
right
onClicked
:
{
anchors.bottom
:
parent
.
bottom
if
(
_offlineMapRoot
.
_currentSelection
)
clip
:
true
deleteDefaultDialog
.
visible
=
true
contentHeight
:
defaultControlInfoColumn
.
height
}
MessageDialog
{
Column
{
id
:
deleteDefaultDialog
id
:
defaultControlInfoColumn
visible
:
false
anchors.left
:
parent
.
left
icon
:
StandardIcon
.
Warning
anchors.right
:
parent
.
right
standardButtons
:
StandardButton
.
Yes
|
StandardButton
.
No
spacing
:
ScreenTools
.
defaultFontPixelHeight
title
:
qsTr
(
"
Delete All Tiles
"
)
text
:
qsTr
(
"
Delete all cached tiles.
\n
Is this really what you want?
"
)
GridLayout
{
onYes
:
{
columns
:
2
if
(
_offlineMapRoot
.
_currentSelection
)
rowSpacing
:
0
QGroundControl
.
mapEngineManager
.
deleteTileSet
(
_offlineMapRoot
.
_currentSelection
)
deleteDefaultDialog
.
visible
=
false
QGCLabel
{
showList
()
Layout.columnSpan
:
2
text
:
qsTr
(
"
System Cache
"
)
}
}
onNo
:
{
deleteDefaultDialog
.
visible
=
false
QGCLabel
{
text
:
qsTr
(
"
Size:
"
)
}
QGCLabel
{
text
:
offlineMapView
.
_currentSelection
?
offlineMapView
.
_currentSelection
.
tilesSizeStr
:
""
}
QGCLabel
{
text
:
qsTr
(
"
Tile Count:
"
)
}
QGCLabel
{
text
:
offlineMapView
.
_currentSelection
?
offlineMapView
.
_currentSelection
.
numTilesStr
:
""
}
Item
{
width
:
1
height
:
ScreenTools
.
defaultFontPixelHeight
Layout.columnSpan
:
2
}
}
QGCLabel
{
Layout.columnSpan
:
2
text
:
qsTr
(
"
All Sets
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Size:
"
)
}
QGCLabel
{
text
:
offlineMapView
.
_currentSelection
?
offlineMapView
.
_currentSelection
.
savedSizeStr
:
""
}
QGCLabel
{
text
:
qsTr
(
"
Tile Count:
"
)
}
QGCLabel
{
text
:
offlineMapView
.
_currentSelection
?
offlineMapView
.
_currentSelection
.
savedTilesStr
:
""
}
}
}
}
QGCButton
{
QGCButton
{
text
:
qsTr
(
"
Back
"
)
text
:
qsTr
(
"
Delete All
"
)
width
:
ScreenTools
.
defaultFontPixelWidth
*
18
onClicked
:
showDialog
(
deleteSystemSetConfirmationDialogComponent
,
qsTr
(
"
Confirm Delete All
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Yes
|
StandardButton
.
No
)
onClicked
:
{
showList
()
}
}
}
}
// Column
}
// QGCFlickable
}
// Rectangle - defaultInfoView
//-- Add New Set View
Rectangle
{
id
:
addNewSetView
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
y
:
Math
.
max
(
anchors
.
margins
,
(
parent
.
height
-
(
anchors
.
margins
*
2
)
-
height
)
/
2
)
anchors.right
:
parent
.
right
width
:
ScreenTools
.
defaultFontPixelWidth
*
20
height
:
Math
.
min
(
parent
.
height
-
(
anchors
.
margins
*
2
),
addNewSetFlickable
.
y
+
addNewSetColumn
.
height
+
ScreenTools
.
defaultFontPixelHeight
)
color
:
qgcPal
.
window
opacity
:
0.85
radius
:
ScreenTools
.
defaultFontPixelWidth
*
0.5
visible
:
false
QGCLabel
{
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
/
4
anchors.top
:
parent
.
top
anchors.right
:
parent
.
right
text
:
"
X
"
}
}
}
}
}
Rectangle
{
QGCLabel
{
id
:
_optionsView
id
:
addNewSetLabel
color
:
qgcPal
.
windowShade
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
parent
.
width
anchors.top
:
parent
.
top
anchors.top
:
_offlineMapTopRect
.
bottom
anchors.left
:
parent
.
left
anchors.bottom
:
parent
.
bottom
anchors.right
:
parent
.
right
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
wrapMode
:
Text
.
WordWrap
visible
:
false
text
:
qsTr
(
"
Add New Set
"
)
onVisibleChanged
:
{
font.pointSize
:
_saveRealEstate
?
ScreenTools
.
defaultFontPointSize
:
ScreenTools
.
mediumFontPointSize
if
(
_optionsView
.
visible
)
{
horizontalAlignment
:
Text
.
AlignHCenter
mapBoxToken
.
text
=
QGroundControl
.
mapEngineManager
.
mapboxToken
maxCacheSize
.
text
=
QGroundControl
.
mapEngineManager
.
maxDiskCache
maxCacheMemSize
.
text
=
QGroundControl
.
mapEngineManager
.
maxMemCache
}
}
QGCFlickable
{
id
:
optionsScroll
anchors.fill
:
parent
contentHeight
:
optionsColumn
.
height
flickableDirection
:
Flickable
.
VerticalFlick
clip
:
true
Column
{
id
:
optionsColumn
width
:
parent
.
width
spacing
:
ScreenTools
.
defaultFontPixelHeight
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
width
:
1
}
}
Rectangle
{
width
:
infoWidth
MouseArea
{
height
:
optionsLabel
.
height
+
(
ScreenTools
.
defaultFontPixelHeight
*
2
)
anchors.fill
:
addNewSetLabel
color
:
qgcPal
.
window
preventStealing
:
true
radius
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
onClicked
:
showList
()
anchors.horizontalCenter
:
parent
.
horizontalCenter
QGCLabel
{
id
:
optionsLabel
text
:
qsTr
(
"
Offline Map Options
"
)
font.pointSize
:
ScreenTools
.
largeFontPointSize
anchors.centerIn
:
parent
}
}
}
Rectangle
{
id
:
optionsRect
QGCFlickable
{
width
:
optionsGrid
.
width
+
(
ScreenTools
.
defaultFontPixelWidth
*
4
)
id
:
addNewSetFlickable
height
:
optionsGrid
.
height
+
(
ScreenTools
.
defaultFontPixelHeight
*
4
)
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
color
:
qgcPal
.
window
anchors.rightMargin
:
anchors
.
leftMargin
radius
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
anchors.topMargin
:
ScreenTools
.
defaultFontPixelWidth
/
3
anchors.
horizontalCenter
:
parent
.
horizontalCenter
anchors.
bottomMargin
:
anchors
.
topMargin
GridLayout
{
anchors.top
:
addNewSetLabel
.
bottom
id
:
optionsGrid
anchors.left
:
parent
.
left
columns
:
2
anchors.right
:
parent
.
right
anchors.centerIn
:
parent
anchors.bottom
:
parent
.
bottom
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
*
2
clip
:
true
rowSpacing
:
ScreenTools
.
defaultFontPixelWidth
*
1.5
contentHeight
:
addNewSetColumn
.
height
columnSpacing
:
ScreenTools
.
defaultFontPixelHeight
*
2
QGCLabel
{
Column
{
text
:
qsTr
(
"
Max Cache Disk Size (MB):
"
)
id
:
addNewSetColumn
}
anchors.left
:
parent
.
left
QGCTextField
{
anchors.right
:
parent
.
right
id
:
maxCacheSize
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
(
ScreenTools
.
isTinyScreen
?
4
:
2
)
maximumLength
:
6
inputMethodHints
:
Qt
.
ImhDigitsOnly
Column
{
validator
:
IntValidator
{
bottom
:
1
;
top
:
262144
;}
anchors.left
:
parent
.
left
}
anchors.right
:
parent
.
right
QGCLabel
{
text
:
qsTr
(
"
Max Cache Memory Size (MB):
"
)
QGCLabel
{
text
:
qsTr
(
"
Name:
"
)
}
}
QGCTextField
{
QGCTextField
{
id
:
maxCacheMemSiz
e
id
:
setNam
e
maximumLength
:
4
anchors.left
:
parent
.
left
inputMethodHints
:
Qt
.
ImhDigitsOnly
anchors.right
:
parent
.
right
validator
:
IntValidator
{
bottom
:
1
;
top
:
4096
;
}
}
}
}
Item
{
Layout.columnSpan
:
2
Column
{
Layout.fillWidth
:
true
anchors.left
:
parent
.
left
height
:
ScreenTools
.
defaultFontPixelHeight
*
1.5
anchors.right
:
parent
.
right
QGCLabel
{
QGCLabel
{
anchors.centerIn
:
parent
text
:
qsTr
(
"
Map type:
"
)
text
:
qsTr
(
"
Memory cache changes require a restart to take effect.
"
)
visible
:
!
_saveRealEstate
font.pointSize
:
ScreenTools
.
smallFontPointSize
}
QGCComboBox
{
id
:
mapCombo
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
model
:
QGroundControl
.
mapEngineManager
.
mapList
onActivated
:
{
mapType
=
textAt
(
index
)
if
(
_dropButtonsExclusiveGroup
.
current
)
_dropButtonsExclusiveGroup
.
current
.
checked
=
false
_dropButtonsExclusiveGroup
.
current
=
null
}
Component.onCompleted
:
{
var
index
=
mapCombo
.
find
(
mapType
)
if
(
index
===
-
1
)
{
console
.
warn
(
qsTr
(
"
Active map name not in combo
"
),
mapType
)
}
else
{
mapCombo
.
currentIndex
=
index
}
}
}
}
}
}
Rectangle
{
Rectangle
{
Layout.columnSpan
:
2
anchors.left
:
parent
.
left
Layout.fillWidth
:
true
anchors.right
:
parent
.
right
height
:
1
height
:
zoomColumn
.
height
+
ScreenTools
.
defaultFontPixelHeight
/
2
color
:
qgcPal
.
text
color
:
qgcPal
.
window
}
border.color
:
qgcPal
.
text
QGCLabel
{
radius
:
ScreenTools
.
defaultFontPixelWidth
*
0.5
text
:
qsTr
(
"
MapBox Access Token
"
)
}
Column
{
QGCTextField
{
id
:
zoomColumn
id
:
mapBoxToken
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
/
4
maximumLength
:
256
anchors.top
:
parent
.
top
width
:
ScreenTools
.
defaultFontPixelWidth
*
30
anchors.left
:
parent
.
left
}
anchors.right
:
parent
.
right
Item
{
Layout.columnSpan
:
2
QGCLabel
{
Layout.fillWidth
:
true
text
:
qsTr
(
"
Min Zoom:
"
)
height
:
ScreenTools
.
defaultFontPixelHeight
*
1.5
font.pointSize
:
_adjustableFontPointSize
QGCLabel
{
}
anchors.centerIn
:
parent
text
:
qsTr
(
"
With an access token, you can use MapBox Maps.
"
)
Slider
{
font.pointSize
:
ScreenTools
.
smallFontPointSize
id
:
sliderMinZoom
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
height
:
setName
.
height
minimumValue
:
minZoomLevel
maximumValue
:
maxZoomLevel
stepSize
:
1
updateValueWhileDragging
:
true
property
real
_savedZoom
Component.onCompleted
:
sliderMinZoom
.
value
=
_map
.
zoomLevel
-
2
onValueChanged
:
{
if
(
sliderMinZoom
.
value
>
sliderMaxZoom
.
value
)
{
sliderMaxZoom
.
value
=
sliderMinZoom
.
value
}
handleChanges
()
checkSanity
()
_map
.
zoomLevel
=
sliderMinZoom
.
value
}
onPressedChanged
:
{
if
(
pressed
)
{
_savedZoom
=
_map
.
zoomLevel
_map
.
zoomLevel
=
sliderMinZoom
.
value
}
else
{
_map
.
zoomLevel
=
_savedZoom
}
}
}
// Slider - min zoom
QGCLabel
{
text
:
qsTr
(
"
Max Zoom:
"
)
font.pointSize
:
_adjustableFontPointSize
}
Slider
{
id
:
sliderMaxZoom
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
height
:
setName
.
height
minimumValue
:
minZoomLevel
maximumValue
:
maxZoomLevel
stepSize
:
1
updateValueWhileDragging
:
true
property
real
_savedZoom
Component.onCompleted
:
{
sliderMaxZoom
.
value
=
_map
.
zoomLevel
+
2
}
onValueChanged
:
{
if
(
sliderMaxZoom
.
value
<
sliderMinZoom
.
value
)
{
sliderMinZoom
.
value
=
sliderMaxZoom
.
value
}
handleChanges
()
checkSanity
()
if
(
pressed
)
{
_map
.
zoomLevel
=
sliderMaxZoom
.
value
}
}
onPressedChanged
:
{
if
(
pressed
)
{
_savedZoom
=
_map
.
zoomLevel
_map
.
zoomLevel
=
sliderMaxZoom
.
value
}
else
{
_map
.
zoomLevel
=
_savedZoom
}
}
}
// Slider - max zoom
GridLayout
{
columns
:
2
rowSpacing
:
0
QGCLabel
{
text
:
qsTr
(
"
Tile Count
"
)
font.pointSize
:
_adjustableFontPointSize
}
QGCLabel
{
text
:
QGroundControl
.
mapEngineManager
.
tileCountStr
font.pointSize
:
_adjustableFontPointSize
}
QGCLabel
{
text
:
qsTr
(
"
Set Size (Est)
"
)
font.pointSize
:
_adjustableFontPointSize
}
QGCLabel
{
text
:
QGroundControl
.
mapEngineManager
.
tileSizeStr
font.pointSize
:
_adjustableFontPointSize
}
}
}
// Column - Zoom info
}
// Rectangle - Zoom info
QGCButton
{
text
:
qsTr
(
"
Download
"
)
enabled
:
setName
.
text
.
length
>
0
anchors.horizontalCenter
:
parent
.
horizontalCenter
onClicked
:
{
if
(
QGroundControl
.
mapEngineManager
.
findName
(
setName
.
text
))
{
duplicateName
.
visible
=
true
}
else
{
/* This does not work if hosted by QQuickWidget. Waiting until we're 100% QtQuick
var mapImage
_map.grabToImage(function(result) { mapImage = result; })
QGroundControl.mapEngineManager.startDownload(setName.text, "Description", mapType, mapImage);
*/
QGroundControl
.
mapEngineManager
.
startDownload
(
setName
.
text
,
"
Description
"
/* Description */
,
mapType
);
showList
()
}
}
}
}
}
}
// Column
}
// QGCFlickable
}
// Rectangle - addNewSetView
}
// Map
QGCFlickable
{
id
:
_tileSetList
clip
:
true
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
anchors.top
:
parent
.
top
anchors.bottom
:
_optionsButton
.
top
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
contentHeight
:
_cacheList
.
height
Column
{
id
:
_cacheList
width
:
Math
.
min
(
_tileSetList
.
width
,
(
ScreenTools
.
defaultFontPixelWidth
*
50
).
toFixed
(
0
))
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
anchors.horizontalCenter
:
parent
.
horizontalCenter
OfflineMapButton
{
id
:
firstButton
text
:
qsTr
(
"
Add new set
"
)
width
:
_cacheList
.
width
height
:
ScreenTools
.
defaultFontPixelHeight
*
2
onClicked
:
{
offlineMapView
.
_currentSelection
=
null
addNewSet
()
}
}
}
}
Row
{
Repeater
{
anchors.horizontalCenter
:
parent
.
horizontalCenter
model
:
QGroundControl
.
mapEngineManager
.
tileSets
spacing
:
ScreenTools
.
defaultFontPixelWidth
delegate
:
OfflineMapButton
{
QGCButton
{
text
:
object
.
name
text
:
qsTr
(
"
Save
"
)
size
:
object
.
downloadStatus
width
:
ScreenTools
.
defaultFontPixelWidth
*
18
complete
:
object
.
complete
onClicked
:
{
width
:
firstButton
.
width
QGroundControl
.
mapEngineManager
.
mapboxToken
=
mapBoxToken
.
text
height
:
ScreenTools
.
defaultFontPixelHeight
*
2
QGroundControl
.
mapEngineManager
.
maxDiskCache
=
parseInt
(
maxCacheSize
.
text
)
onClicked
:
{
QGroundControl
.
mapEngineManager
.
maxMemCache
=
parseInt
(
maxCacheMemSize
.
text
)
offlineMapView
.
_currentSelection
=
object
showList
()
showInfo
()
}
}
QGCButton
{
text
:
qsTr
(
"
Cancel
"
)
width
:
ScreenTools
.
defaultFontPixelWidth
*
18
onClicked
:
{
showList
()
}
}
}
}
}
}
}
}
}
}
}
}
QGCButton
{
id
:
_optionsButton
text
:
qsTr
(
"
Options
"
)
visible
:
_tileSetList
.
visible
anchors.bottom
:
parent
.
bottom
anchors.right
:
parent
.
right
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
onClicked
:
showDialog
(
optionsDialogComponent
,
qsTr
(
"
Offline Maps Options
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Save
|
StandardButton
.
Cancel
)
}
}
// QGCViewPanel
}
// QGCView
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