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
b4835b28
Commit
b4835b28
authored
Jun 13, 2016
by
Don Gagne
Committed by
GitHub
Jun 13, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3556 from DonLakeFlyer/OfflineMapFixes
Offline map fixes
parents
6c9cd5af
7951f7d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
94 deletions
+41
-94
OfflineMap.qml
src/QtLocationPlugin/QMLControl/OfflineMap.qml
+33
-76
QGCMapEngineManager.cc
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc
+8
-14
QGCMapEngineManager.h
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.h
+0
-4
No files found.
src/QtLocationPlugin/QMLControl/OfflineMap.qml
View file @
b4835b28
...
...
@@ -32,28 +32,19 @@ QGCView {
property
string
mapKey
:
"
lastMapType
"
property
string
mapType
:
QGroundControl
.
flightMapSettings
.
mapProvider
+
"
"
+
QGroundControl
.
flightMapSettings
.
mapType
property
bool
isMapInteractive
:
tru
e
property
bool
isMapInteractive
:
fals
e
property
var
savedCenter
:
undefined
property
real
savedZoom
:
3
property
string
savedMapType
:
""
property
real
_newSetMiddleLabel
:
ScreenTools
.
isTinyScreen
?
ScreenTools
.
defaultFontPixelWidth
*
10
:
ScreenTools
.
defaultFontPixelWidth
*
12
property
real
_newSetMiddleField
:
ScreenTools
.
isTinyScreen
?
ScreenTools
.
defaultFontPixelWidth
*
16
:
ScreenTools
.
defaultFontPixelWidth
*
20
property
real
_netSetSliderWidth
:
ScreenTools
.
isTinyScreen
?
ScreenTools
.
defaultFontPixelWidth
*
8
:
ScreenTools
.
defaultFontPixelWidth
*
16
property
real
oldlon0
:
0
property
real
oldlon1
:
0
property
real
oldlat0
:
0
property
real
oldlat1
:
0
property
int
oldz0
:
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
maxZoomLevel
:
20
readonly
property
int
_maxTilesForDownload
:
60000
QGCPalette
{
id
:
qgcPal
}
Component.onCompleted
:
{
...
...
@@ -78,20 +69,11 @@ QGCView {
if
(
isMapInteractive
)
{
var
xl
=
0
var
yl
=
0
var
xr
=
_map
.
width
.
toFixed
(
0
)
var
yr
=
_map
.
height
.
toFixed
(
0
)
var
xr
=
_map
.
width
.
toFixed
(
0
)
-
1
// Must be within boundaries of visible map
var
yr
=
_map
.
height
.
toFixed
(
0
)
-
1
// Must be within boundaries of visible map
var
c0
=
_map
.
toCoordinate
(
Qt
.
point
(
xl
,
yl
))
var
c1
=
_map
.
toCoordinate
(
Qt
.
point
(
xr
,
yr
))
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
,
sliderMinZoom
.
value
,
sliderMaxZoom
.
value
,
mapType
)
}
}
}
function
checkSanity
()
{
if
(
isMapInteractive
&&
QGroundControl
.
mapEngineManager
.
crazySize
)
{
sliderMaxZoom
.
value
=
sliderMaxZoom
.
value
-
1
handleChanges
()
QGroundControl
.
mapEngineManager
.
updateForCurrentView
(
c0
.
longitude
,
c0
.
latitude
,
c1
.
longitude
,
c1
.
latitude
,
sliderMinZoom
.
value
,
sliderMaxZoom
.
value
,
mapType
)
}
}
...
...
@@ -106,7 +88,10 @@ QGCView {
}
function
addNewSet
()
{
isMapInteractive
=
true
mapType
=
QGroundControl
.
flightMapSettings
.
mapProvider
+
"
"
+
QGroundControl
.
flightMapSettings
.
mapType
resetMapToDefaults
()
handleChanges
()
_map
.
visible
=
true
_tileSetList
.
visible
=
false
infoView
.
visible
=
false
...
...
@@ -115,6 +100,7 @@ QGCView {
}
function
showList
()
{
isMapInteractive
=
false
_map
.
visible
=
false
_tileSetList
.
visible
=
true
infoView
.
visible
=
false
...
...
@@ -123,6 +109,7 @@ QGCView {
}
function
showInfo
()
{
isMapInteractive
=
false
if
(
_currentSelection
&&
!
offlineMapView
.
_currentSelection
.
deleting
)
{
enterInfoView
()
}
else
...
...
@@ -170,11 +157,11 @@ QGCView {
_map
.
fitViewportToMapItems
()
}
_tileSetList
.
visible
=
false
addNewSetView
.
visible
=
false
addNewSetView
.
visible
=
false
if
(
isDefaultSet
)
{
defaultInfoView
.
visible
=
true
}
else
{
infoView
.
visible
=
true
infoView
.
visible
=
true
}
}
...
...
@@ -183,7 +170,11 @@ QGCView {
_map
.
center
=
savedCenter
_map
.
zoomLevel
=
savedZoom
mapType
=
savedMapType
isMapInteractive
=
true
}
function
resetMapToDefaults
()
{
_map
.
center
=
QGroundControl
.
flightMapPosition
_map
.
zoomLevel
=
QGroundControl
.
flightMapZoom
}
ExclusiveGroup
{
...
...
@@ -320,7 +311,7 @@ QGCView {
Map
{
id
:
_map
anchors.fill
:
parent
center
:
QGroundControl
.
defaultMap
Position
center
:
QGroundControl
.
lastKnownHome
Position
visible
:
false
gesture.flickDeceleration
:
3000
...
...
@@ -335,26 +326,16 @@ QGCView {
antialiasing
:
true
}
Component.onCompleted
:
{
center
=
QGroundControl
.
flightMapPosition
zoomLevel
=
QGroundControl
.
flightMapZoom
}
Component.onCompleted
:
resetMapToDefaults
()
onCenterChanged
:
{
handleChanges
()
checkSanity
()
}
onZoomLevelChanged
:
{
handleChanges
()
checkSanity
()
}
onWidthChanged
:
{
handleChanges
()
checkSanity
()
}
onHeightChanged
:
{
handleChanges
()
checkSanity
()
onCenterChanged
:
handleChanges
()
onZoomLevelChanged
:
handleChanges
()
onWidthChanged
:
handleChanges
()
onHeightChanged
:
handleChanges
()
// Used to make pinch zoom work
MouseArea
{
anchors.fill
:
parent
}
MapScale
{
...
...
@@ -760,17 +741,6 @@ QGCView {
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
...
...
@@ -791,28 +761,13 @@ QGCView {
property
real
_savedZoom
Component.onCompleted
:
{
sliderMaxZoom
.
value
=
_map
.
zoomLevel
+
2
}
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
...
...
@@ -842,10 +797,12 @@ QGCView {
}
// Rectangle - Zoom info
QGCButton
{
text
:
qsTr
(
"
Download
"
)
enabled
:
setName
.
text
.
length
>
0
text
:
_tooManyTiles
?
qsTr
(
"
Too many tiles
"
)
:
qsTr
(
"
Download
"
)
enabled
:
!
_tooManyTiles
&&
setName
.
text
.
length
>
0
anchors.horizontalCenter
:
parent
.
horizontalCenter
property
bool
_tooManyTiles
:
QGroundControl
.
mapEngineManager
.
tileCount
>
_maxTilesForDownload
onClicked
:
{
if
(
QGroundControl
.
mapEngineManager
.
findName
(
setName
.
text
))
{
duplicateName
.
visible
=
true
...
...
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc
View file @
b4835b28
...
...
@@ -74,20 +74,14 @@ QGCMapEngineManager::updateForCurrentView(double lon0, double lat0, double lon1,
QGCTileSet
set
=
QGCMapEngine
::
getTileCount
(
z
,
lon0
,
lat0
,
lon1
,
lat1
,
mapType
);
_totalSet
+=
set
;
}
//-- Beyond 100,000,000 tiles is just nuts
if
(
_totalSet
.
tileCount
>
100
*
1000
*
1000
)
{
_crazySize
=
true
;
emit
crazySizeChanged
();
}
else
{
_crazySize
=
false
;
emit
crazySizeChanged
();
emit
tileX0Changed
();
emit
tileX1Changed
();
emit
tileY0Changed
();
emit
tileY1Changed
();
emit
tileCountChanged
();
emit
tileSizeChanged
();
}
emit
tileX0Changed
();
emit
tileX1Changed
();
emit
tileY0Changed
();
emit
tileY1Changed
();
emit
tileCountChanged
();
emit
tileSizeChanged
();
qCDebug
(
QGCMapEngineManagerLog
)
<<
"updateForCurrentView"
<<
lat0
<<
lon0
<<
lat1
<<
lon1
<<
minZoom
<<
maxZoom
;
}
//-----------------------------------------------------------------------------
...
...
src/QtLocationPlugin/QMLControl/QGCMapEngineManager.h
View file @
b4835b28
...
...
@@ -37,7 +37,6 @@ public:
Q_PROPERTY
(
QString
tileCountStr
READ
tileCountStr
NOTIFY
tileCountChanged
)
Q_PROPERTY
(
quint64
tileSize
READ
tileSize
NOTIFY
tileSizeChanged
)
Q_PROPERTY
(
QString
tileSizeStr
READ
tileSizeStr
NOTIFY
tileSizeChanged
)
Q_PROPERTY
(
bool
crazySize
READ
crazySize
NOTIFY
crazySizeChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
tileSets
READ
tileSets
NOTIFY
tileSetsChanged
)
Q_PROPERTY
(
QStringList
mapList
READ
mapList
CONSTANT
)
Q_PROPERTY
(
QString
mapboxToken
READ
mapboxToken
WRITE
setMapboxToken
NOTIFY
mapboxTokenChanged
)
...
...
@@ -65,7 +64,6 @@ public:
QString
tileCountStr
();
quint64
tileSize
()
{
return
_totalSet
.
tileSize
;
}
QString
tileSizeStr
();
bool
crazySize
()
{
return
_crazySize
;
}
QStringList
mapList
();
QString
mapboxToken
();
QmlObjectListModel
*
tileSets
()
{
return
&
_tileSets
;
}
...
...
@@ -91,7 +89,6 @@ signals:
void
tileY1Changed
();
void
tileCountChanged
();
void
tileSizeChanged
();
void
crazySizeChanged
();
void
mapboxTokenChanged
();
void
tileSetsChanged
();
void
maxMemCacheChanged
();
...
...
@@ -114,7 +111,6 @@ private:
private:
QGCTileSet
_totalSet
;
bool
_crazySize
;
double
_topleftLat
;
double
_topleftLon
;
double
_bottomRightLat
;
...
...
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