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
c2ccfda0
Commit
c2ccfda0
authored
Apr 28, 2019
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow plugin control of map scale visibility
parent
b413f7f9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
45 deletions
+47
-45
FlightDisplayViewMap.qml
src/FlightDisplay/FlightDisplayViewMap.qml
+1
-1
MapScale.qml
src/FlightMap/MapScale.qml
+42
-43
QGCOptions.h
src/api/QGCOptions.h
+3
-1
main.cc
src/main.cc
+1
-0
No files found.
src/FlightDisplay/FlightDisplayViewMap.qml
View file @
c2ccfda0
...
...
@@ -476,7 +476,7 @@ FlightMap {
anchors.topMargin
:
ScreenTools
.
defaultFontPixelHeight
*
(
0.33
)
+
state
===
"
bottomMode
"
?
0
:
ScreenTools
.
toolbarHeight
anchors.bottomMargin
:
ScreenTools
.
defaultFontPixelHeight
*
(
0.33
)
mapControl
:
flightMap
visible
:
!
ScreenTools
.
isTinyScreen
visible
:
!
ScreenTools
.
isTinyScreen
&&
QGroundControl
.
corePlugin
.
options
.
enableMapScale
state
:
"
bottomMode
"
states
:
[
State
{
...
...
src/FlightMap/MapScale.qml
View file @
c2ccfda0
...
...
@@ -110,70 +110,69 @@ Item {
}
function
calculateScale
()
{
var
scaleLinePixelLength
=
100
var
leftCoord
=
mapControl
.
toCoordinate
(
Qt
.
point
(
0
,
scale
.
y
),
false
/* clipToViewPort */
)
var
rightCoord
=
mapControl
.
toCoordinate
(
Qt
.
point
(
scaleLinePixelLength
,
scale
.
y
),
false
/* clipToViewPort */
)
var
scaleLineMeters
=
Math
.
round
(
leftCoord
.
distanceTo
(
rightCoord
))
if
(
QGroundControl
.
settingsManager
.
unitsSettings
.
distanceUnits
.
value
===
UnitsSettings
.
DistanceUnitsFeet
)
{
calculateFeetRatio
(
scaleLineMeters
,
scaleLinePixelLength
)
}
else
{
calculateMetersRatio
(
scaleLineMeters
,
scaleLinePixelLength
)
if
(
mapControl
)
{
var
scaleLinePixelLength
=
100
var
leftCoord
=
mapControl
.
toCoordinate
(
Qt
.
point
(
0
,
scale
.
y
),
false
/* clipToViewPort */
)
var
rightCoord
=
mapControl
.
toCoordinate
(
Qt
.
point
(
scaleLinePixelLength
,
scale
.
y
),
false
/* clipToViewPort */
)
var
scaleLineMeters
=
Math
.
round
(
leftCoord
.
distanceTo
(
rightCoord
))
if
(
QGroundControl
.
settingsManager
.
unitsSettings
.
distanceUnits
.
value
===
UnitsSettings
.
DistanceUnitsFeet
)
{
calculateFeetRatio
(
scaleLineMeters
,
scaleLinePixelLength
)
}
else
{
calculateMetersRatio
(
scaleLineMeters
,
scaleLinePixelLength
)
}
}
}
Connections
{
target
:
mapControl
onWidthChanged
:
scaleTimer
.
restart
()
onHeightChanged
:
scaleTimer
.
restart
()
target
:
mapControl
onWidthChanged
:
scaleTimer
.
restart
()
onHeightChanged
:
scaleTimer
.
restart
()
onZoomLevelChanged
:
scaleTimer
.
restart
()
}
Timer
{
id
:
scaleTimer
interval
:
100
running
:
false
repeat
:
false
onTriggered
:
calculateScale
()
id
:
scaleTimer
interval
:
100
running
:
false
repeat
:
false
onTriggered
:
calculateScale
()
}
QGCMapLabel
{
id
:
scaleText
map
:
mapControl
font.family
:
ScreenTools
.
demiboldFontFamily
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
horizontalAlignment
:
Text
.
AlignRight
text
:
"
0 m
"
id
:
scaleText
map
:
mapControl
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
id
:
leftEnd
anchors.top
:
scaleText
.
bottom
anchors.left
:
parent
.
left
width
:
2
height
:
ScreenTools
.
defaultFontPixelHeight
color
:
_color
}
Rectangle
{
id
:
centerLine
id
:
centerLine
anchors.bottomMargin
:
2
anchors.bottom
:
leftEnd
.
bottom
anchors.left
:
leftEnd
.
right
height
:
2
color
:
_color
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
id
:
rightEnd
anchors.top
:
leftEnd
.
top
anchors.left
:
centerLine
.
right
width
:
2
height
:
ScreenTools
.
defaultFontPixelHeight
color
:
_color
}
Component.onCompleted
:
{
...
...
src/api/QGCOptions.h
View file @
c2ccfda0
...
...
@@ -63,6 +63,7 @@ public:
Q_PROPERTY
(
bool
checkFirmwareVersion
READ
checkFirmwareVersion
CONSTANT
)
Q_PROPERTY
(
bool
showMavlinkLogOptions
READ
showMavlinkLogOptions
CONSTANT
)
Q_PROPERTY
(
bool
enableMultiVehicleList
READ
enableMultiVehicleList
CONSTANT
)
Q_PROPERTY
(
bool
enableMapScale
READ
enableMapScale
CONSTANT
)
/// Should QGC hide its settings menu and colapse it into one single menu (Settings and Vehicle Setup)?
/// @return true if QGC should consolidate both menus into one.
...
...
@@ -114,7 +115,8 @@ public:
virtual
bool
disableVehicleConnection
()
const
{
return
false
;
}
///< true: vehicle connection is disabled
virtual
bool
checkFirmwareVersion
()
const
{
return
true
;
}
virtual
bool
showMavlinkLogOptions
()
const
{
return
true
;
}
virtual
bool
enableMultiVehicleList
()
const
{
return
true
;
}
virtual
bool
enableMultiVehicleList
()
const
{
return
true
;
}
virtual
bool
enableMapScale
()
const
{
return
true
;
}
#if defined(__mobile__)
virtual
bool
useMobileFileDialog
()
const
{
return
true
;}
...
...
src/main.cc
View file @
c2ccfda0
...
...
@@ -228,6 +228,7 @@ int main(int argc, char *argv[])
#endif
#endif // QT_DEBUG
QCoreApplication
::
setAttribute
(
Qt
::
AA_UseHighDpiPixmaps
);
QGCApplication
*
app
=
new
QGCApplication
(
argc
,
argv
,
runUnitTests
);
Q_CHECK_PTR
(
app
);
...
...
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