Commit 0f3a3ee2 authored by Don Gagne's avatar Don Gagne

Add Mission Items to Fly View

parent 81621c14
...@@ -70,6 +70,9 @@ ...@@ -70,6 +70,9 @@
<file alias="QGroundControl/FactControls/FactCheckBox.qml">src/FactSystem/FactControls/FactCheckBox.qml</file> <file alias="QGroundControl/FactControls/FactCheckBox.qml">src/FactSystem/FactControls/FactCheckBox.qml</file>
<file alias="QGroundControl/FactControls/FactComboBox.qml">src/FactSystem/FactControls/FactComboBox.qml</file> <file alias="QGroundControl/FactControls/FactComboBox.qml">src/FactSystem/FactControls/FactComboBox.qml</file>
<file alias="QGroundControl/Controls/qmldir">src/QmlControls/QGroundControl.Controls.qmldir</file> <file alias="QGroundControl/Controls/qmldir">src/QmlControls/QGroundControl.Controls.qmldir</file>
<!-- Controls module -->
<file alias="QGroundControl/Controls/QGCButton.qml">src/QmlControls/QGCButton.qml</file> <file alias="QGroundControl/Controls/QGCButton.qml">src/QmlControls/QGCButton.qml</file>
<file alias="QGroundControl/Controls/QGCRadioButton.qml">src/QmlControls/QGCRadioButton.qml</file> <file alias="QGroundControl/Controls/QGCRadioButton.qml">src/QmlControls/QGCRadioButton.qml</file>
<file alias="QGroundControl/Controls/QGCCheckBox.qml">src/QmlControls/QGCCheckBox.qml</file> <file alias="QGroundControl/Controls/QGCCheckBox.qml">src/QmlControls/QGCCheckBox.qml</file>
...@@ -81,7 +84,6 @@ ...@@ -81,7 +84,6 @@
<file alias="QGroundControl/Controls/QGCMovableItem.qml">src/QmlControls/QGCMovableItem.qml</file> <file alias="QGroundControl/Controls/QGCMovableItem.qml">src/QmlControls/QGCMovableItem.qml</file>
<file alias="QGroundControl/ScreenTools/qmldir">src/QmlControls/QGroundControl.ScreenTools.qmldir</file> <file alias="QGroundControl/ScreenTools/qmldir">src/QmlControls/QGroundControl.ScreenTools.qmldir</file>
<file alias="QGroundControl/ScreenTools/ScreenTools.qml">src/QmlControls/ScreenTools.qml</file> <file alias="QGroundControl/ScreenTools/ScreenTools.qml">src/QmlControls/ScreenTools.qml</file>
<file alias="ScreenToolsFontQuery.qml">src/QmlControls/ScreenToolsFontQuery.qml</file>
<file alias="QGroundControl/Controls/SubMenuButton.qml">src/QmlControls/SubMenuButton.qml</file> <file alias="QGroundControl/Controls/SubMenuButton.qml">src/QmlControls/SubMenuButton.qml</file>
<file alias="QGroundControl/Controls/IndicatorButton.qml">src/QmlControls/IndicatorButton.qml</file> <file alias="QGroundControl/Controls/IndicatorButton.qml">src/QmlControls/IndicatorButton.qml</file>
<file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file> <file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file>
...@@ -94,6 +96,10 @@ ...@@ -94,6 +96,10 @@
<file alias="QGroundControl/Controls/ParameterEditor.qml">src/QmlControls/ParameterEditor.qml</file> <file alias="QGroundControl/Controls/ParameterEditor.qml">src/QmlControls/ParameterEditor.qml</file>
<file alias="QGroundControl/Controls/ParameterEditorDialog.qml">src/QmlControls/ParameterEditorDialog.qml</file> <file alias="QGroundControl/Controls/ParameterEditorDialog.qml">src/QmlControls/ParameterEditorDialog.qml</file>
<file alias="QGroundControl/Controls/ModeSwitchDisplay.qml">src/QmlControls/ModeSwitchDisplay.qml</file> <file alias="QGroundControl/Controls/ModeSwitchDisplay.qml">src/QmlControls/ModeSwitchDisplay.qml</file>
<file alias="QGroundControl/Controls/MissionItemIndexLabel.qml">src/QmlControls/MissionItemIndexLabel.qml</file>
<file alias="QGroundControl/Controls/MissionItemSummary.qml">src/QmlControls/MissionItemSummary.qml</file>
<file alias="ScreenToolsFontQuery.qml">src/QmlControls/ScreenToolsFontQuery.qml</file>
<file alias="ParameterEditorWidget.qml">src/ViewWidgets/ParameterEditorWidget.qml</file> <file alias="ParameterEditorWidget.qml">src/ViewWidgets/ParameterEditorWidget.qml</file>
<file alias="CustomCommandWidget.qml">src/ViewWidgets/CustomCommandWidget.qml</file> <file alias="CustomCommandWidget.qml">src/ViewWidgets/CustomCommandWidget.qml</file>
<file alias="SetupView.qml">src/VehicleSetup/SetupView.qml</file> <file alias="SetupView.qml">src/VehicleSetup/SetupView.qml</file>
...@@ -125,6 +131,7 @@ ...@@ -125,6 +131,7 @@
<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/QGCVideoBackground.qml">src/FlightMap/QGCVideoBackground.qml</file> <file alias="QGroundControl/FlightMap/QGCVideoBackground.qml">src/FlightMap/QGCVideoBackground.qml</file>
<!-- FlightMap Widgets -->
<file alias="QGroundControl/FlightMap/QGCAltitudeWidget.qml">src/FlightMap/Widgets/QGCAltitudeWidget.qml</file> <file alias="QGroundControl/FlightMap/QGCAltitudeWidget.qml">src/FlightMap/Widgets/QGCAltitudeWidget.qml</file>
<file alias="QGroundControl/FlightMap/QGCArtificialHorizon.qml">src/FlightMap/Widgets/QGCArtificialHorizon.qml</file> <file alias="QGroundControl/FlightMap/QGCArtificialHorizon.qml">src/FlightMap/Widgets/QGCArtificialHorizon.qml</file>
<file alias="QGroundControl/FlightMap/QGCAttitudeWidget.qml">src/FlightMap/Widgets/QGCAttitudeWidget.qml</file> <file alias="QGroundControl/FlightMap/QGCAttitudeWidget.qml">src/FlightMap/Widgets/QGCAttitudeWidget.qml</file>
...@@ -138,8 +145,11 @@ ...@@ -138,8 +145,11 @@
<file alias="QGroundControl/FlightMap/QGCSlider.qml">src/FlightMap/Widgets/QGCSlider.qml</file> <file alias="QGroundControl/FlightMap/QGCSlider.qml">src/FlightMap/Widgets/QGCSlider.qml</file>
<file alias="QGroundControl/FlightMap/QGCSpeedWidget.qml">src/FlightMap/Widgets/QGCSpeedWidget.qml</file> <file alias="QGroundControl/FlightMap/QGCSpeedWidget.qml">src/FlightMap/Widgets/QGCSpeedWidget.qml</file>
<file alias="QGroundControl/FlightMap/QGCWaypointEditor.qml">src/FlightMap/Widgets/QGCWaypointEditor.qml</file> <file alias="QGroundControl/FlightMap/QGCWaypointEditor.qml">src/FlightMap/Widgets/QGCWaypointEditor.qml</file>
<file alias="QGroundControl/FlightMap/QGCWaypoint.qml">src/FlightMap/MapItems/QGCWaypoint.qml</file>
<!-- FlightMap MapQuickItems -->
<file alias="QGroundControl/FlightMap/MissionMapItem.qml">src/FlightMap/MapItems/MissionMapItem.qml</file>
<file alias="QGroundControl/FlightMap/VehicleMapItem.qml">src/FlightMap/MapItems/VehicleMapItem.qml</file> <file alias="QGroundControl/FlightMap/VehicleMapItem.qml">src/FlightMap/MapItems/VehicleMapItem.qml</file>
</qresource> </qresource>
<qresource prefix="/res"> <qresource prefix="/res">
<file alias="LeftArrow">resources/LeftArrow.svg</file> <file alias="LeftArrow">resources/LeftArrow.svg</file>
......
...@@ -52,9 +52,11 @@ Item { ...@@ -52,9 +52,11 @@ Item {
property real _roll: _activeVehicle ? (isNaN(_activeVehicle.roll) ? _defaultRoll : _activeVehicle.roll) : _defaultRoll property real _roll: _activeVehicle ? (isNaN(_activeVehicle.roll) ? _defaultRoll : _activeVehicle.roll) : _defaultRoll
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 _latitude: _activeVehicle ? ((_activeVehicle.latitude === 0) ? _defaultLatitude : _activeVehicle.latitude) : _defaultLatitude property real _latitude: _activeVehicle ? ((_activeVehicle.latitude === 0) ? _defaultLatitude : _activeVehicle.latitude) : _defaultLatitude
property real _longitude: _activeVehicle ? ((_activeVehicle.longitude === 0) ? _defaultLongitude : _activeVehicle.longitude) : _defaultLongitude property real _longitude: _activeVehicle ? ((_activeVehicle.longitude === 0) ? _defaultLongitude : _activeVehicle.longitude) : _defaultLongitude
property real _heading: _activeVehicle ? (isNaN(_activeVehicle.heading) ? _defaultHeading : _activeVehicle.heading) : _defaultHeading
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
...@@ -69,20 +71,21 @@ Item { ...@@ -69,20 +71,21 @@ Item {
} }
FlightMap { FlightMap {
id: flightMap id: flightMap
anchors.fill: parent anchors.fill: parent
mapName: "FlightDisplayView" mapName: "FlightDisplayView"
latitude: _latitude latitude: parent._latitude
longitude: _longitude longitude: parent._longitude
z: 10 z: 10
showVehicles: true showVehicles: true
showMissionItems: true
} }
QGCCompassWidget { QGCCompassWidget {
x: ScreenTools.defaultFontPixelSize * (7.1) x: ScreenTools.defaultFontPixelSize * (7.1)
y: ScreenTools.defaultFontPixelSize * (0.42) y: ScreenTools.defaultFontPixelSize * (0.42)
size: ScreenTools.defaultFontPixelSize * (13.3) size: ScreenTools.defaultFontPixelSize * (13.3)
heading: _heading heading: parent._heading
active: multiVehicleManager.activeVehicleAvailable active: multiVehicleManager.activeVehicleAvailable
z: flightMap.z + 2 z: flightMap.z + 2
} }
...@@ -92,8 +95,8 @@ Item { ...@@ -92,8 +95,8 @@ Item {
anchors.right: parent.right anchors.right: parent.right
y: ScreenTools.defaultFontPixelSize * (0.42) y: ScreenTools.defaultFontPixelSize * (0.42)
size: ScreenTools.defaultFontPixelSize * (13.3) size: ScreenTools.defaultFontPixelSize * (13.3)
rollAngle: _roll rollAngle: parent._roll
pitchAngle: _pitch pitchAngle: parent._pitch
active: multiVehicleManager.activeVehicleAvailable active: multiVehicleManager.activeVehicleAvailable
z: flightMap.z + 2 z: flightMap.z + 2
} }
...@@ -102,7 +105,7 @@ Item { ...@@ -102,7 +105,7 @@ Item {
anchors.right: parent.right anchors.right: parent.right
height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65 height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65
width: ScreenTools.defaultFontPixelSize * (5) width: ScreenTools.defaultFontPixelSize * (5)
altitude: _altitudeWGS84 altitude: parent._altitudeWGS84
z: 30 z: 30
} }
...@@ -110,15 +113,15 @@ Item { ...@@ -110,15 +113,15 @@ Item {
anchors.left: parent.left anchors.left: parent.left
width: ScreenTools.defaultFontPixelSize * (5) width: ScreenTools.defaultFontPixelSize * (5)
height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65 height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65
speed: _groundSpeed speed: parent._groundSpeed
z: 40 z: 40
} }
QGCCurrentSpeed { QGCCurrentSpeed {
anchors.left: parent.left anchors.left: parent.left
width: ScreenTools.defaultFontPixelSize * (6.25) width: ScreenTools.defaultFontPixelSize * (6.25)
airspeed: _airSpeed airspeed: parent._airSpeed
groundspeed: _groundSpeed groundspeed: parent._groundSpeed
active: multiVehicleManager.activeVehicleAvailable active: multiVehicleManager.activeVehicleAvailable
z: 50 z: 50
} }
...@@ -126,8 +129,8 @@ Item { ...@@ -126,8 +129,8 @@ Item {
QGCCurrentAltitude { QGCCurrentAltitude {
anchors.right: parent.right anchors.right: parent.right
width: ScreenTools.defaultFontPixelSize * (6.25) width: ScreenTools.defaultFontPixelSize * (6.25)
altitude: _altitudeWGS84 altitude: parent._altitudeWGS84
vertZ: _climbRate vertZ: parent._climbRate
active: multiVehicleManager.activeVehicleAvailable active: multiVehicleManager.activeVehicleAvailable
z: 60 z: 60
} }
......
...@@ -50,12 +50,15 @@ Item { ...@@ -50,12 +50,15 @@ Item {
property string mapName: 'defaultMap' property string mapName: 'defaultMap'
property alias mapItem: map property alias mapItem: map
property alias mapMenu: mapTypeMenu property alias mapMenu: mapTypeMenu
property bool showVehicles: false property bool showVehicles: false
property bool showMissionItems: false
Component.onCompleted: { Component.onCompleted: {
map.zoomLevel = 18 map.zoomLevel = 18
mapTypeMenu.update(); mapTypeMenu.update();
addExistingVehicles() addExistingVehicles()
updateMissionItemsConnections()
updateMissionItems()
} }
//-- Menu to select supported map types //-- Menu to select supported map types
...@@ -143,7 +146,6 @@ Item { ...@@ -143,7 +146,6 @@ Item {
// we need to keep a separate array of Vehicles which must be at the top level of the object // we need to keep a separate array of Vehicles which must be at the top level of the object
// hierarchy in order for the dynamically added object to see it. // hierarchy in order for the dynamically added object to see it.
property var _vehicles: [] ///< List of known vehicles property var _vehicles: [] ///< List of known vehicles
property var _vehicleMapItems: [] ///< List of known vehicle map items property var _vehicleMapItems: [] ///< List of known vehicle map items
...@@ -155,6 +157,10 @@ Item { ...@@ -155,6 +157,10 @@ Item {
} }
function addVehicle(vehicle) { function addVehicle(vehicle) {
if (!showVehicles) {
return
}
var qmlItemTemplate = "VehicleMapItem { " + var qmlItemTemplate = "VehicleMapItem { " +
"coordinate: _vehicles[%1].coordinate; " + "coordinate: _vehicles[%1].coordinate; " +
"heading: _vehicles[%1].heading " + "heading: _vehicles[%1].heading " +
...@@ -173,6 +179,10 @@ Item { ...@@ -173,6 +179,10 @@ Item {
} }
function removeVehicle(vehicle) { function removeVehicle(vehicle) {
if (!showVehicles) {
return
}
for (var i=0; i<_vehicles.length; i++) { for (var i=0; i<_vehicles.length; i++) {
if (_vehicles[i] == vehicle) { if (_vehicles[i] == vehicle) {
_vehicles[i] = undefined _vehicles[i] = undefined
...@@ -184,12 +194,103 @@ Item { ...@@ -184,12 +194,103 @@ Item {
} }
function addExistingVehicles() { function addExistingVehicles() {
if (!showVehicles) {
return
}
for (var i=0; i<multiVehicleManager.vehicles.length; i++) { for (var i=0; i<multiVehicleManager.vehicles.length; i++) {
addVehicle(multiVehicleManager.vehicles[i]) addVehicle(multiVehicleManager.vehicles[i])
} }
} }
// The following code is used to show mission items on the FlightMap
property var _missionItems: [] ///< List of known vehicles
property var _missionMapItems: [] ///< List of known vehicle map items
Connections {
target: multiVehicleManager
onActiveVehicleAvailableChanged: updateMissionItemsConnections()
}
function updateMissionItemsConnections() {
if (multiVehicleManager.activeVehicleAvailable) {
multiVehicleManager.activeVehicle.missionItemsChanged.connect(updateMissionItems)
} else {
// Previously active vehicle is about to go away, disconnect signals
if (multiVehicleManager.activeVehicle) {
multiVehicleManager.activeVehicle.missionItemsChanged.disconnect(updateMissionItems)
}
}
}
function addMissionItem(missionItem, index) {
if (!showMissionItems) {
console.warning("Shouldn't be called with showMissionItems=false")
return
}
var qmlItemTemplate = "MissionMapItem { " +
"coordinate: _missionItems[%1].coordinate; " +
"index: %2" +
"}"
var i = _missionItems.length
qmlItemTemplate = qmlItemTemplate.replace("%1", i)
qmlItemTemplate = qmlItemTemplate.replace("%2", index + 1)
_missionItems.push(missionItem)
var mapItem = Qt.createQmlObject (qmlItemTemplate, map)
_missionMapItems.push(mapItem)
mapItem.z = map.z + 1
map.addMapItem(mapItem)
}
function removeMissionItem(missionItem) {
if (!showMissionItems) {
console.warning("Shouldn't be called with showMissionItems=false")
return
}
for (var i=0; i<_missionItems.length; i++) {
if (_missionItems[i] == missionItem) {
// Qml has an annoying habit of not destroying remove Qml item until it hits the main loop.
// Because of that we need to leave the the mission item references even though we have
// removed the items, otherwise we'll get references to undefined errors until we hit the main
// loop again.
//_missionItems[i] = undefined
map.removeMapItem(_missionMapItems[i])
_missionMapItems[i] = undefined
break
}
}
}
function updateMissionItems() {
if (!showMissionItems) {
return
}
var vehicle = multiVehicleManager.activeVehicle
if (!vehicle) {
console.warning("Why no active vehicle?")
return
}
// Remove previous items
for (var i=0; i<_missionItems.length; i++) {
removeMissionItem(_missionItems[i])
}
_missionMapItems = []
// Add new items
for (var i=0; i<vehicle.missionItems.length; i++) {
addMissionItem(vehicle.missionItems[i], i)
}
}
Plugin { Plugin {
id: mapPlugin id: mapPlugin
name: "QGroundControl" name: "QGroundControl"
...@@ -267,8 +368,28 @@ Item { ...@@ -267,8 +368,28 @@ Item {
} }
*/ */
} }
/// Mission item list
Row {
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left
anchors.right: controlWidgets.left
anchors.bottom: parent.bottom
spacing: ScreenTools.defaultFontPixelWidth
Repeater {
model: multiVehicleManager.activeVehicle ? multiVehicleManager.activeVehicle.missionItems : 0
MissionItemSummary {
missionItem: modelData
missionItemIndex: index + 1
}
}
}
/// Map control widgets
Column { Column {
id: controlWidgets
anchors.margins: ScreenTools.defaultFontPixelWidth anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
...@@ -279,23 +400,60 @@ Item { ...@@ -279,23 +400,60 @@ Item {
text: "Options" text: "Options"
menu: mapTypeMenu menu: mapTypeMenu
} }
Row { Row {
layoutDirection: Qt.RightToLeft layoutDirection: Qt.RightToLeft
spacing: ScreenTools.defaultFontPixelWidth / 2 spacing: ScreenTools.defaultFontPixelWidth / 2
property real zoomIncrement: 1.0 readonly property real _zoomIncrement: 1.0
property real buttonWidth: (optionsButton.width - spacing) / 2 property real _buttonWidth: (optionsButton.width - spacing) / 2
NumberAnimation {
id: animateZoom
property real startZoom
property real endZoom
target: map
properties: "zoomLevel"
from: startZoom
to: endZoom
duration: 500
easing {
type: Easing.OutExpo
}
}
QGCButton { QGCButton {
width: parent.buttonWidth width: parent._buttonWidth
text: "+" text: "+"
onClicked: map.zoomLevel = map.zoomLevel + parent.zoomIncrement
onClicked: {
var endZoomLevel = map.zoomLevel + parent._zoomIncrement
if (endZoomLevel > map.maximumZoomLevel) {
endZoomLevel = map.maximumZoomLevel
}
animateZoom.startZoom = map.zoomLevel
animateZoom.endZoom = endZoomLevel
animateZoom.start()
}
} }
QGCButton { QGCButton {
width: parent.buttonWidth width: parent._buttonWidth
text: "-" text: "-"
onClicked: map.zoomLevel = map.zoomLevel - parent.zoomIncrement
onClicked: {
var endZoomLevel = map.zoomLevel - parent._zoomIncrement
if (endZoomLevel < map.minimumZoomLevel) {
endZoomLevel = map.minimumZoomLevel
}
animateZoom.startZoom = map.zoomLevel
animateZoom.endZoom = endZoomLevel
animateZoom.start()
}
} }
} }
} }
......
...@@ -21,61 +21,21 @@ This file is part of the QGROUNDCONTROL project ...@@ -21,61 +21,21 @@ This file is part of the QGROUNDCONTROL project
======================================================================*/ ======================================================================*/
/** import QtQuick 2.4
* @file import QtLocation 5.3
* @brief QGC Waypoint Marker
* @author Gus Grubba <mavlink@grubba.com>
*/
import QtQuick 2.4 import QGroundControl.ScreenTools 1.0
import QtLocation 5.3 import QGroundControl.Controls 1.0
/// Marker for displaying a mission item on the map
MapQuickItem { MapQuickItem {
id: marker property int index
property int waypointID: 0
anchorPoint.x: markerIcon.width / 2 anchorPoint.x: sourceItem.width / 2
anchorPoint.y: markerIcon.height / 2 anchorPoint.y: sourceItem.height / 2
sourceItem: Rectangle {
id: markerIcon sourceItem:
width: 30 MissionItemIndexLabel {
height: 30 missionItemIndex: index
color: markerMouseArea.containsMouse ? (markerMouseArea.pressed ? Qt.rgba(0.69,0.2,0.68,0.25) : Qt.rgba(0.69,0.2,0.68,0.75)) : Qt.rgba(0,0,0,0.5)
radius: 8
border.color: Qt.rgba(0,0,0,0.75)
Text {
id: number
anchors.centerIn: parent
font.pixelSize: 11
font.weight: Font.DemiBold
color: "white"
text: marker.waypointID
}
MouseArea {
id: markerMouseArea
enabled: !map.readOnly
anchors.fill: parent
hoverEnabled: true
drag.target: marker
preventStealing: true
property int pressX : -1
property int pressY : -1
property int jitterThreshold : 4
onPressed : {
pressX = mouse.x;
pressY = mouse.y;
map.currentMarker = -1;
for (var i = 0; i < map.markers.length; i++) {
if (marker === map.markers[i]) {
map.currentMarker = i;
break;
}
}
}
onPositionChanged: {
if (Math.abs(pressX - mouse.x ) < jitterThreshold && Math.abs(pressY - mouse.y) < jitterThreshold) {
map.updateMarker(marker.coordinate, marker.waypointID)
}
}
} }
}
} }
Module QGroundControl.FlightMap Module QGroundControl.FlightMap
# Main view controls # Main view controls
FlightMap 1.0 FlightMap.qml FlightMap 1.0 FlightMap.qml
QGCVideoBackground 1.0 QGCVideoBackground.qml QGCVideoBackground 1.0 QGCVideoBackground.qml
# Widgets # Widgets
...@@ -21,4 +21,4 @@ QGCWaypointEditor 1.0 QGCWaypointEditor.qml ...@@ -21,4 +21,4 @@ QGCWaypointEditor 1.0 QGCWaypointEditor.qml
# MapQuickItems # MapQuickItems
VehicleMapItem 1.0 VehicleMapItem.qml VehicleMapItem 1.0 VehicleMapItem.qml
QGCWaypoint 1.0 QGCWaypoint.qml MissioMapItem 1.0 MissionMapItem.qml
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QGroundControl.ScreenTools 1.0
Rectangle {
property int missionItemIndex ///< Index to show in label
width: ScreenTools.defaultFontPixelHeight * 1.5
height: width
radius: width / 2
border.width: 2
border.color: "white"
color: "orange"
QGCLabel {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: "white"
text: missionItemIndex
}
}
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QGroundControl.ScreenTools 1.0
/// Mission item summary display control
Rectangle {
property var missionItem ///< Mission Item object
property int missionItemIndex ///< Index for this item
width: ScreenTools.defaultFontPixelWidth * 15
height: ScreenTools.defaultFontPixelWidth * 3
border.width: 2
border.color: "white"
color: "white"
opacity: 0.75
radius: ScreenTools.defaultFontPixelWidth
QGCLabel {
anchors.margins: parent.radius / 2
anchors.left: parent.left
anchors.top: parent.top
color: "black"
horizontalAlignment: Text.AlignTop
text: missionItem.type
}
MissionItemIndexLabel {
anchors.top: parent.top
anchors.right: parent.right
missionItemIndex: parent.missionItemIndex + 1
}
}
Module QGroundControl.Controls Module QGroundControl.Controls
QGCLabel 1.0 QGCLabel.qml QGCLabel 1.0 QGCLabel.qml
QGCButton 1.0 QGCButton.qml QGCButton 1.0 QGCButton.qml
QGCRadioButton 1.0 QGCRadioButton.qml QGCRadioButton 1.0 QGCRadioButton.qml
QGCCheckBox 1.0 QGCCheckBox.qml QGCCheckBox 1.0 QGCCheckBox.qml
QGCTextField 1.0 QGCTextField.qml QGCTextField 1.0 QGCTextField.qml
QGCComboBox 1.0 QGCComboBox.qml QGCComboBox 1.0 QGCComboBox.qml
QGCColoredImage 1.0 QGCColoredImage.qml QGCColoredImage 1.0 QGCColoredImage.qml
QGCToolBarButton 1.0 QGCToolBarButton.qml QGCToolBarButton 1.0 QGCToolBarButton.qml
QGCMovableItem 1.0 QGCMovableItem.qml QGCMovableItem 1.0 QGCMovableItem.qml
SubMenuButton 1.0 SubMenuButton.qml SubMenuButton 1.0 SubMenuButton.qml
IndicatorButton 1.0 IndicatorButton.qml IndicatorButton 1.0 IndicatorButton.qml
VehicleRotationCal 1.0 VehicleRotationCal.qml VehicleRotationCal 1.0 VehicleRotationCal.qml
VehicleSummaryRow 1.0 VehicleSummaryRow.qml VehicleSummaryRow 1.0 VehicleSummaryRow.qml
ViewWidget 1.0 ViewWidget.qml ViewWidget 1.0 ViewWidget.qml
ParameterEditor 1.0 ParameterEditor.qml ParameterEditor 1.0 ParameterEditor.qml
ParameterEditorDialog 1.0 ParameterEditorDialog.qml ParameterEditorDialog 1.0 ParameterEditorDialog.qml
ModeSwitchDisplay 1.0 ModeSwitchDisplay.qml ModeSwitchDisplay 1.0 ModeSwitchDisplay.qml
QGCView 1.0 QGCView.qml QGCView 1.0 QGCView.qml
QGCViewPanel 1.0 QGCViewPanel.qml QGCViewPanel 1.0 QGCViewPanel.qml
QGCViewDialog 1.0 QGCViewDialog.qml QGCViewDialog 1.0 QGCViewDialog.qml
QGCViewMessage 1.0 QGCViewMessage.qml QGCViewMessage 1.0 QGCViewMessage.qml
MissionItemIndexLabel 1.0 MissionItemIndexLabel.qml
MissionItemSummary 1.0 MissionItemSummary.qml
...@@ -714,7 +714,7 @@ void Vehicle::_waypointViewOnlyListChanged() ...@@ -714,7 +714,7 @@ void Vehicle::_waypointViewOnlyListChanged()
Waypoint* wp = waypoints[i]; Waypoint* wp = waypoints[i];
_waypoints.append(new Waypoint(*wp)); _waypoints.append(new Waypoint(*wp));
} }
emit waypointsChanged(); emit missionItemsChanged();
/* /*
if(_longitude == DEFAULT_LON && _latitude == DEFAULT_LAT && _waypoints.length()) { if(_longitude == DEFAULT_LON && _latitude == DEFAULT_LAT && _waypoints.length()) {
_longitude = _waypoints[0]->getLongitude(); _longitude = _waypoints[0]->getLongitude();
......
...@@ -87,8 +87,9 @@ public: ...@@ -87,8 +87,9 @@ public:
Q_PROPERTY(double waypointDistance READ waypointDistance NOTIFY waypointDistanceChanged) Q_PROPERTY(double waypointDistance READ waypointDistance NOTIFY waypointDistanceChanged)
Q_PROPERTY(uint16_t currentWaypoint READ currentWaypoint NOTIFY currentWaypointChanged) Q_PROPERTY(uint16_t currentWaypoint READ currentWaypoint NOTIFY currentWaypointChanged)
Q_PROPERTY(unsigned int heartbeatTimeout READ heartbeatTimeout NOTIFY heartbeatTimeoutChanged) Q_PROPERTY(unsigned int heartbeatTimeout READ heartbeatTimeout NOTIFY heartbeatTimeoutChanged)
//-- Waypoint management //-- Waypoint management
Q_PROPERTY(QQmlListProperty<Waypoint> waypoints READ waypoints NOTIFY waypointsChanged) Q_PROPERTY(QQmlListProperty<Waypoint> missionItems READ missionItems NOTIFY missionItemsChanged)
// Property accesors // Property accesors
int id(void) { return _id; } int id(void) { return _id; }
...@@ -161,7 +162,7 @@ public: ...@@ -161,7 +162,7 @@ public:
uint16_t currentWaypoint () { return _currentWaypoint; } uint16_t currentWaypoint () { return _currentWaypoint; }
unsigned int heartbeatTimeout () { return _currentHeartbeatTimeout; } unsigned int heartbeatTimeout () { return _currentHeartbeatTimeout; }
QQmlListProperty<Waypoint> waypoints() {return QQmlListProperty<Waypoint>(this, _waypoints); } QQmlListProperty<Waypoint> missionItems() {return QQmlListProperty<Waypoint>(this, _waypoints); }
public slots: public slots:
void setLatitude(double latitude); void setLatitude(double latitude);
...@@ -203,7 +204,7 @@ signals: ...@@ -203,7 +204,7 @@ signals:
void satelliteLockChanged (); void satelliteLockChanged ();
void waypointDistanceChanged(); void waypointDistanceChanged();
void currentWaypointChanged (); void currentWaypointChanged ();
void waypointsChanged (); void missionItemsChanged ();
private slots: private slots:
void _mavlinkMessageReceived(LinkInterface* link, mavlink_message_t message); void _mavlinkMessageReceived(LinkInterface* link, mavlink_message_t message);
......
This diff is collapsed.
...@@ -37,6 +37,8 @@ This file is part of the PIXHAWK project ...@@ -37,6 +37,8 @@ This file is part of the PIXHAWK project
#include <QString> #include <QString>
#include <QtQml> #include <QtQml>
#include <QTextStream> #include <QTextStream>
#include <QGeoCoordinate>
#include "QGCMAVLink.h" #include "QGCMAVLink.h"
#include "QGC.h" #include "QGC.h"
...@@ -65,6 +67,9 @@ public: ...@@ -65,6 +67,9 @@ public:
const Waypoint& operator=(const Waypoint& other); const Waypoint& operator=(const Waypoint& other);
Q_PROPERTY(QGeoCoordinate coordinate READ coordinate NOTIFY coordinateChanged)
Q_PROPERTY(QString type READ type NOTIFY typeChanged)
Q_PROPERTY(double longitude READ longitude NOTIFY longitudeChanged) Q_PROPERTY(double longitude READ longitude NOTIFY longitudeChanged)
Q_PROPERTY(double latitude READ latitude NOTIFY latitudeChanged) Q_PROPERTY(double latitude READ latitude NOTIFY latitudeChanged)
Q_PROPERTY(double altitude READ altitude NOTIFY altitudeChanged) Q_PROPERTY(double altitude READ altitude NOTIFY altitudeChanged)
...@@ -161,7 +166,9 @@ public: ...@@ -161,7 +166,9 @@ public:
void save(QTextStream &saveStream); void save(QTextStream &saveStream);
bool load(QTextStream &loadStream); bool load(QTextStream &loadStream);
QGeoCoordinate coordinate(void);
QString type(void);
protected: protected:
quint16 _id; quint16 _id;
...@@ -227,7 +234,8 @@ signals: ...@@ -227,7 +234,8 @@ signals:
void latitudeChanged (); void latitudeChanged ();
void longitudeChanged (); void longitudeChanged ();
void altitudeChanged (); void altitudeChanged ();
void coordinateChanged(void);
void typeChanged(QString type);
}; };
QML_DECLARE_TYPE(Waypoint) QML_DECLARE_TYPE(Waypoint)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment