Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
531a6362
Commit
531a6362
authored
Mar 21, 2017
by
DonLakeFlyer
Browse files
Changed follow vehicle user model
parent
a25626fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/FlightDisplay/FlightDisplayViewMap.qml
View file @
531a6362
...
...
@@ -27,35 +27,64 @@ FlightMap {
anchors.fill
:
parent
mapName
:
_mapName
gesture.acceptedGestures
:
_followVehicle
?
MapGestureArea
.
PinchGesture
:
MapGestureArea
.
PinchGesture
|
MapGestureArea
.
PanGesture
|
MapGestureArea
.
FlickGesture
property
alias
missionController
:
missionController
property
var
flightWidgets
property
var
rightPanelWidth
property
bool
_followVehicle
:
true
property
bool
_followVehicleSetting
:
true
///< User facing setting for follow vehicle
property
bool
_followVehicle
:
_followVehicleSetting
&&
_activeVehicleCoordinateValid
///< Control map follow vehicle functionality
property
var
_activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
property
bool
_activeVehicleCoordinateValid
:
_activeVehicle
?
_activeVehicle
.
coordinateValid
:
false
property
var
activeVehicleCoordinate
:
_activeVehicle
?
_activeVehicle
.
coordinate
:
QtPositioning
.
coordinate
()
property
var
_gotoHereCoordinate
:
QtPositioning
.
coordinate
()
property
int
_retaskSequence
:
0
property
real
_toolButtonTopMargin
:
parent
.
height
-
ScreenTools
.
availableHeight
+
(
ScreenTools
.
defaultFontPixelHeight
/
2
)
property
bool
followVehicleConnection
:
_followVehicle
///< Only use to create connection on
property
bool
_firstVehicleCoordinate
:
false
property
bool
_centerUpdateFromTimer
:
true
Component.onCompleted
:
{
QGroundControl
.
flightMapPosition
=
center
QGroundControl
.
flightMapZoom
=
zoomLevel
}
onCenterChanged
:
QGroundControl
.
flightMapPosition
=
center
onZoomLevelChanged
:
QGroundControl
.
flightMapZoom
=
zoomLevel
onCenterChanged
:
{
if
(
_centerUpdateFromTimer
)
{
_centerUpdateFromTimer
=
false
}
else
{
vehicleCenterTimer
.
restart
()
}
QGroundControl
.
flightMapPosition
=
center
}
onActiveVehicleCoordinateChanged
:
{
if
(
_followVehicle
&&
_activeVehicleCoordinateValid
&&
activeVehicleCoordinate
.
isValid
)
{
if
(
!
_firstVehicleCoordinate
&&
_activeVehicleCoordinateValid
)
{
_firstVehicleCoordinate
=
true
updateMapToVehiclePosition
()
}
}
function
updateMapToVehiclePosition
()
{
if
(
_followVehicle
)
{
_initialMapPositionSet
=
true
flightMap
.
center
=
activeVehicleCoordinate
_firstVehicleCoordinate
=
true
_centerUpdateFromTimer
=
true
flightMap
.
center
=
activeVehicleCoordinate
}
}
Timer
{
id
:
vehicleCenterTimer
interval
:
5000
running
:
true
triggeredOnStart
:
true
repeat
:
true
onTriggered
:
{
triggeredOnStart
=
false
updateMapToVehiclePosition
()
}
}
...
...
@@ -149,9 +178,9 @@ FlightMap {
map
:
_flightMap
fitFunctions
:
mapFitFunctions
showFollowVehicle
:
true
followVehicle
:
_followVehicle
followVehicle
:
_followVehicle
Setting
onFollowVehicleChanged
:
_followVehicle
=
followVehicle
onFollowVehicleChanged
:
_followVehicle
Setting
=
followVehicle
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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