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
5824ffe7
Commit
5824ffe7
authored
Jan 13, 2016
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New initial map position handling
Also show QGC position on map
parent
afc21e9e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
64 deletions
+53
-64
FlightDisplayView.qml
src/FlightDisplay/FlightDisplayView.qml
+0
-4
FlightDisplayViewMap.qml
src/FlightDisplay/FlightDisplayViewMap.qml
+7
-10
FlightMap.qml
src/FlightMap/FlightMap.qml
+25
-8
MissionEditor.qml
src/MissionEditor/MissionEditor.qml
+15
-30
MainWindowInner.qml
src/ui/MainWindowInner.qml
+6
-12
No files found.
src/FlightDisplay/FlightDisplayView.qml
View file @
5824ffe7
...
@@ -50,7 +50,6 @@ Item {
...
@@ -50,7 +50,6 @@ Item {
property
var
_activeVehicle
:
multiVehicleManager
.
activeVehicle
property
var
_activeVehicle
:
multiVehicleManager
.
activeVehicle
readonly
property
var
_defaultVehicleCoordinate
:
mainWindow
.
tabletPosition
readonly
property
real
_defaultRoll
:
0
readonly
property
real
_defaultRoll
:
0
readonly
property
real
_defaultPitch
:
0
readonly
property
real
_defaultPitch
:
0
readonly
property
real
_defaultHeading
:
0
readonly
property
real
_defaultHeading
:
0
...
@@ -71,8 +70,6 @@ Item {
...
@@ -71,8 +70,6 @@ Item {
property
real
_pitch
:
_activeVehicle
?
(
isNaN
(
_activeVehicle
.
pitch
)
?
_defaultPitch
:
_activeVehicle
.
pitch
)
:
_defaultPitch
property
real
_pitch
:
_activeVehicle
?
(
isNaN
(
_activeVehicle
.
pitch
)
?
_defaultPitch
:
_activeVehicle
.
pitch
)
:
_defaultPitch
property
real
_heading
:
_activeVehicle
?
(
isNaN
(
_activeVehicle
.
heading
)
?
_defaultHeading
:
_activeVehicle
.
heading
)
:
_defaultHeading
property
real
_heading
:
_activeVehicle
?
(
isNaN
(
_activeVehicle
.
heading
)
?
_defaultHeading
:
_activeVehicle
.
heading
)
:
_defaultHeading
property
var
_vehicleCoordinate
:
_activeVehicle
?
(
_activeVehicle
.
coordinateValid
?
_activeVehicle
.
coordinate
:
_defaultVehicleCoordinate
)
:
_defaultVehicleCoordinate
property
real
_altitudeWGS84
:
_activeVehicle
?
_activeVehicle
.
altitudeWGS84
:
_defaultAltitudeWGS84
property
real
_altitudeWGS84
:
_activeVehicle
?
_activeVehicle
.
altitudeWGS84
:
_defaultAltitudeWGS84
property
real
_groundSpeed
:
_activeVehicle
?
_activeVehicle
.
groundSpeed
:
_defaultGroundSpeed
property
real
_groundSpeed
:
_activeVehicle
?
_activeVehicle
.
groundSpeed
:
_defaultGroundSpeed
property
real
_airSpeed
:
_activeVehicle
?
_activeVehicle
.
airSpeed
:
_defaultAirSpeed
property
real
_airSpeed
:
_activeVehicle
?
_activeVehicle
.
airSpeed
:
_defaultAirSpeed
...
@@ -120,7 +117,6 @@ Item {
...
@@ -120,7 +117,6 @@ Item {
_flightMap
.
zoomLevel
=
_savedZoomLevel
_flightMap
.
zoomLevel
=
_savedZoomLevel
else
else
_savedZoomLevel
=
_flightMap
.
zoomLevel
_savedZoomLevel
=
_flightMap
.
zoomLevel
_flightMap
.
updateMapPosition
(
true
/* force */
)
}
else
{
}
else
{
_flightVideo
=
item
_flightVideo
=
item
}
}
...
...
src/FlightDisplay/FlightDisplayViewMap.qml
View file @
5824ffe7
...
@@ -39,18 +39,15 @@ FlightMap {
...
@@ -39,18 +39,15 @@ FlightMap {
id
:
flightMap
id
:
flightMap
anchors.fill
:
parent
anchors.fill
:
parent
mapName
:
_mapName
mapName
:
_mapName
latitude
:
mainWindow
.
tabletPosition
.
latitude
longitude
:
mainWindow
.
tabletPosition
.
longitude
property
var
rootVehicleCoordinate
:
_vehicleCoordinate
property
bool
_followVehicle
:
true
property
bool
_followVehicle
:
true
property
bool
_activeVehicleCoordinateValid
:
multiVehicleManager
.
activeVehicle
?
multiVehicleManager
.
activeVehicle
.
coordinateValid
:
false
property
var
activeVehicleCoordinate
:
multiVehicleManager
.
activeVehicle
?
multiVehicleManager
.
activeVehicle
.
coordinate
:
QtPositioning
.
coordinate
()
onRootVehicleCoordinateChanged
:
updateMapPosition
(
false
/* force */
)
onActiveVehicleCoordinateChanged
:
{
if
(
_followVehicle
&&
activeVehicleCoordinate
.
isValid
)
{
function
updateMapPosition
(
force
)
{
_initialMapPositionSet
=
true
if
(
_followVehicle
||
force
)
{
flightMap
.
center
=
activeVehicleCoordinate
flightMap
.
latitude
=
root
.
_vehicleCoordinate
.
latitude
flightMap
.
longitude
=
root
.
_vehicleCoordinate
.
longitude
}
}
}
}
...
...
src/FlightMap/FlightMap.qml
View file @
5824ffe7
...
@@ -43,22 +43,16 @@ import QGroundControl.Mavlink 1.0
...
@@ -43,22 +43,16 @@ import QGroundControl.Mavlink 1.0
Map
{
Map
{
id
:
_map
id
:
_map
property
real
latitude
:
64.154549
//-- If you find yourself here on startup, something went wrong :)
property
real
longitude
:
-
22.023540
property
real
heading
:
0
property
bool
interactive
:
true
property
bool
interactive
:
true
property
string
mapName
:
'
defaultMap
'
property
string
mapName
:
'
defaultMap
'
property
string
mapType
:
QGroundControl
.
flightMapSettings
.
mapTypeForMapName
(
mapName
)
property
string
mapType
:
QGroundControl
.
flightMapSettings
.
mapTypeForMapName
(
mapName
)
// property alias mapWidgets: controlWidgets
// property alias mapWidgets: controlWidgets
property
bool
isSatelliteMap
:
mapType
==
"
Satellite Map
"
||
mapType
==
"
Hybrid Map
"
property
bool
isSatelliteMap
:
mapType
==
"
Satellite Map
"
||
mapType
==
"
Hybrid Map
"
property
real
lon
:
(
longitude
>=
-
180
&&
longitude
<=
180
)
?
longitude
:
0
property
real
lat
:
(
latitude
>=
-
90
&&
latitude
<=
90
)
?
latitude
:
0
readonly
property
real
maxZoomLevel
:
20
readonly
property
real
maxZoomLevel
:
20
zoomLevel
:
18
zoomLevel
:
18
center
:
Q
tPositioning
.
coordinate
(
lat
,
lon
)
center
:
Q
GroundControl
.
defaultMapPosition
gesture.flickDeceleration
:
3000
gesture.flickDeceleration
:
3000
gesture.enabled
:
interactive
gesture.enabled
:
interactive
gesture.activeGestures
:
MapGestureArea
.
ZoomGesture
|
MapGestureArea
.
PanGesture
|
MapGestureArea
.
FlickGesture
gesture.activeGestures
:
MapGestureArea
.
ZoomGesture
|
MapGestureArea
.
PanGesture
|
MapGestureArea
.
FlickGesture
...
@@ -69,6 +63,18 @@ Map {
...
@@ -69,6 +63,18 @@ Map {
Component.onCompleted
:
onMapTypeChanged
Component.onCompleted
:
onMapTypeChanged
property
bool
_initialMapPositionSet
:
false
Connections
{
target
:
mainWindow
onGcsPositionChanged
:
{
if
(
!
_initialMapPositionSet
)
{
_initialMapPositionSet
=
true
flightMap
.
center
=
mainWindow
.
gcsPosition
}
}
}
onMapTypeChanged
:
{
onMapTypeChanged
:
{
QGroundControl
.
flightMapSettings
.
setMapTypeForMapName
(
mapName
,
mapType
)
QGroundControl
.
flightMapSettings
.
setMapTypeForMapName
(
mapName
,
mapType
)
var
fullMapName
=
QGroundControl
.
flightMapSettings
.
mapProvider
+
"
"
+
mapType
var
fullMapName
=
QGroundControl
.
flightMapSettings
.
mapProvider
+
"
"
+
mapType
...
@@ -80,7 +86,18 @@ Map {
...
@@ -80,7 +86,18 @@ Map {
}
}
}
}
/*********************************************
MapQuickItem
{
anchorPoint.x
:
sourceItem
.
width
/
2
anchorPoint.y
:
sourceItem
.
height
/
2
visible
:
mainWindow
.
gcsPosition
.
isValid
coordinate
:
mainWindow
.
gcsPosition
sourceItem
:
MissionItemIndexLabel
{
label
:
"
Q
"
}
}
/*********************************************
/// Map control widgets
/// Map control widgets
Column {
Column {
id: controlWidgets
id: controlWidgets
...
...
src/MissionEditor/MissionEditor.qml
View file @
5824ffe7
...
@@ -62,13 +62,8 @@ QGCView {
...
@@ -62,13 +62,8 @@ QGCView {
property
var
_missionItems
:
controller
.
missionItems
property
var
_missionItems
:
controller
.
missionItems
property
var
_currentMissionItem
property
var
_currentMissionItem
property
bool
_firstVehiclePosition
:
true
property
bool
gpsLock
:
_activeVehicle
?
_activeVehicle
.
coordinateValid
:
false
property
var
activeVehiclePosition
:
_activeVehicle
?
_activeVehicle
.
coordinate
:
QtPositioning
.
coordinate
()
property
bool
_firstGpsLock
:
true
//property var _homePositionManager: QGroundControl.homePositionManager
//property string _homePositionName: _homePositionManager.homePositions.get(0).name
//property var offlineHomePosition: _homePositionManager.homePositions.get(0).coordinate
property
var
liveHomePosition
:
controller
.
liveHomePosition
property
var
liveHomePosition
:
controller
.
liveHomePosition
property
var
liveHomePositionAvailable
:
controller
.
liveHomePositionAvailable
property
var
liveHomePositionAvailable
:
controller
.
liveHomePositionAvailable
...
@@ -76,17 +71,23 @@ QGCView {
...
@@ -76,17 +71,23 @@ QGCView {
property
bool
_syncInProgress
:
_activeVehicle
?
_activeVehicle
.
missionManager
.
inProgress
:
false
property
bool
_syncInProgress
:
_activeVehicle
?
_activeVehicle
.
missionManager
.
inProgress
:
false
onGpsLockChanged
:
updateMapToVehiclePosition
()
Component.onCompleted
:
updateMapToVehiclePosition
()
onActiveVehiclePositionChanged
:
updateMapToVehiclePosition
()
Component.onCompleted
:
{
Connections
{
updateMapToVehiclePosition
()
target
:
multiVehicleManager
onActiveVehicleChanged
:
{
// When the active vehicle changes we need to allow the first vehicle position to move the map again
_firstVehiclePosition
=
true
updateMapToVehiclePosition
()
}
}
}
function
updateMapToVehiclePosition
()
{
function
updateMapToVehiclePosition
()
{
if
(
gpsLock
&&
_firstGpsLock
)
{
if
(
_activeVehicle
&&
_activeVehicle
.
coordinateValid
&&
_firstVehiclePosition
)
{
_firstGpsLock
=
false
_firstVehiclePosition
=
false
editorMap
.
latitude
=
_activeVehicle
.
latitude
editorMap
.
center
=
_activeVehicle
.
coordinate
editorMap
.
longitude
=
_activeVehicle
.
longitude
}
}
}
}
...
@@ -178,8 +179,6 @@ QGCView {
...
@@ -178,8 +179,6 @@ QGCView {
id
:
editorMap
id
:
editorMap
anchors.fill
:
parent
anchors.fill
:
parent
mapName
:
"
MissionEditor
"
mapName
:
"
MissionEditor
"
latitude
:
mainWindow
.
tabletPosition
.
latitude
longitude
:
mainWindow
.
tabletPosition
.
longitude
readonly
property
real
animationDuration
:
500
readonly
property
real
animationDuration
:
500
...
@@ -190,20 +189,6 @@ QGCView {
...
@@ -190,20 +189,6 @@ QGCView {
}
}
}
}
Behavior
on
latitude
{
NumberAnimation
{
duration
:
editorMap
.
animationDuration
easing.type
:
Easing
.
InOutQuad
}
}
Behavior
on
longitude
{
NumberAnimation
{
duration
:
editorMap
.
animationDuration
easing.type
:
Easing
.
InOutQuad
}
}
MouseArea
{
MouseArea
{
anchors.fill
:
parent
anchors.fill
:
parent
...
...
src/ui/MainWindowInner.qml
View file @
5824ffe7
...
@@ -33,9 +33,9 @@ import QGroundControl.FlightDisplay 1.0
...
@@ -33,9 +33,9 @@ import QGroundControl.FlightDisplay 1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
MultiVehicleManager
1.0
import
QGroundControl
.
MultiVehicleManager
1.0
/// Inner common QML for
M
ainWindow
/// Inner common QML for
m
ainWindow
Item
{
Item
{
id
:
mainWindow
id
:
mainWindow
signal
reallyClose
signal
reallyClose
...
@@ -50,10 +50,7 @@ Item {
...
@@ -50,10 +50,7 @@ Item {
property
real
tbButtonWidth
:
tbCellHeight
*
1.35
property
real
tbButtonWidth
:
tbCellHeight
*
1.35
property
real
availableHeight
:
height
-
tbHeight
property
real
availableHeight
:
height
-
tbHeight
property
real
menuButtonWidth
:
(
tbButtonWidth
*
2
)
+
(
tbSpacing
*
4
)
+
1
property
real
menuButtonWidth
:
(
tbButtonWidth
*
2
)
+
(
tbSpacing
*
4
)
+
1
property
var
gcsPosition
:
QtPositioning
.
coordinate
()
// Starts as invalid coordinate
property
var
defaultPosition
:
QtPositioning
.
coordinate
(
37.803784
,
-
122.462276
)
property
var
tabletPosition
:
defaultPosition
property
var
currentPopUp
:
null
property
var
currentPopUp
:
null
property
real
currentCenterX
:
0
property
real
currentCenterX
:
0
property
var
activeVehicle
:
multiVehicleManager
.
activeVehicle
property
var
activeVehicle
:
multiVehicleManager
.
activeVehicle
...
@@ -179,20 +176,20 @@ Item {
...
@@ -179,20 +176,20 @@ Item {
PositionSource
{
PositionSource
{
id
:
positionSource
id
:
positionSource
updateInterval
:
1000
updateInterval
:
1000
active
:
false
active
:
true
onPositionChanged
:
{
onPositionChanged
:
{
if
(
positionSource
.
valid
)
{
if
(
positionSource
.
valid
)
{
if
(
positionSource
.
position
.
coordinate
.
latitude
)
{
if
(
positionSource
.
position
.
coordinate
.
latitude
)
{
if
(
Math
.
abs
(
positionSource
.
position
.
coordinate
.
latitude
)
>
0.001
)
{
if
(
Math
.
abs
(
positionSource
.
position
.
coordinate
.
latitude
)
>
0.001
)
{
if
(
positionSource
.
position
.
coordinate
.
longitude
)
{
if
(
positionSource
.
position
.
coordinate
.
longitude
)
{
if
(
Math
.
abs
(
positionSource
.
position
.
coordinate
.
longitude
)
>
0.001
)
{
if
(
Math
.
abs
(
positionSource
.
position
.
coordinate
.
longitude
)
>
0.001
)
{
tablet
Position
=
positionSource
.
position
.
coordinate
gcs
Position
=
positionSource
.
position
.
coordinate
}
}
}
}
}
}
}
}
}
}
positionSource
.
stop
()
}
}
}
}
...
@@ -299,9 +296,6 @@ Item {
...
@@ -299,9 +296,6 @@ Item {
anchors.fill
:
parent
anchors.fill
:
parent
availableHeight
:
mainWindow
.
availableHeight
availableHeight
:
mainWindow
.
availableHeight
visible
:
true
visible
:
true
Component.onCompleted
:
{
positionSource
.
start
()
}
}
}
Loader
{
Loader
{
...
...
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