Unverified Commit 673b9be7 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #7832 from DonLakeFlyer/CameraUI

Plan: Use TabBar in Complex Item UI
parents 399663c2 12dc8848
...@@ -66,6 +66,8 @@ ...@@ -66,6 +66,8 @@
<file alias="QGroundControl/Controls/AppMessages.qml">src/QmlControls/AppMessages.qml</file> <file alias="QGroundControl/Controls/AppMessages.qml">src/QmlControls/AppMessages.qml</file>
<file alias="QGroundControl/Controls/AxisMonitor.qml">src/QmlControls/AxisMonitor.qml</file> <file alias="QGroundControl/Controls/AxisMonitor.qml">src/QmlControls/AxisMonitor.qml</file>
<file alias="QGroundControl/Controls/CameraCalc.qml">src/PlanView/CameraCalc.qml</file> <file alias="QGroundControl/Controls/CameraCalc.qml">src/PlanView/CameraCalc.qml</file>
<file alias="QGroundControl/Controls/CameraCalcCamera.qml">src/PlanView/CameraCalcCamera.qml</file>
<file alias="QGroundControl/Controls/CameraCalcGrid.qml">src/PlanView/CameraCalcGrid.qml</file>
<file alias="QGroundControl/Controls/CameraSection.qml">src/PlanView/CameraSection.qml</file> <file alias="QGroundControl/Controls/CameraSection.qml">src/PlanView/CameraSection.qml</file>
<file alias="QGroundControl/Controls/ClickableColor.qml">src/QmlControls/ClickableColor.qml</file> <file alias="QGroundControl/Controls/ClickableColor.qml">src/QmlControls/ClickableColor.qml</file>
<file alias="QGroundControl/Controls/CorridorScanMapVisual.qml">src/PlanView/CorridorScanMapVisual.qml</file> <file alias="QGroundControl/Controls/CorridorScanMapVisual.qml">src/PlanView/CorridorScanMapVisual.qml</file>
......
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.2
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0
// Camera calculator "Camera" section for mission item editors
Column {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: !usingPreset || !cameraSpecifiedInPreset
property var cameraCalc
property bool vehicleFlightIsFrontal: true
property string distanceToSurfaceLabel
property int distanceToSurfaceAltitudeMode: QGroundControl.AltitudeModeNone
property string frontalDistanceLabel
property string sideDistanceLabel
property bool usingPreset: false
property bool cameraSpecifiedInPreset: false
property real _margin: ScreenTools.defaultFontPixelWidth / 2
property string _cameraName: cameraCalc.cameraName.value
property real _fieldWidth: ScreenTools.defaultFontPixelWidth * 10.5
property var _cameraList: [ ]
property var _vehicle: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle
property var _vehicleCameraList: _vehicle ? _vehicle.staticCameraList : []
property bool _cameraComboFilled: false
readonly property int _gridTypeManual: 0
readonly property int _gridTypeCustomCamera: 1
readonly property int _gridTypeCamera: 2
Component.onCompleted: _fillCameraCombo()
on_CameraNameChanged: _updateSelectedCamera()
function _fillCameraCombo() {
_cameraComboFilled = true
_cameraList.push(cameraCalc.manualCameraName)
_cameraList.push(cameraCalc.customCameraName)
for (var i=0; i<_vehicle.staticCameraList.length; i++) {
_cameraList.push(_vehicle.staticCameraList[i].name)
}
gridTypeCombo.model = _cameraList
_updateSelectedCamera()
}
function _updateSelectedCamera() {
if (_cameraComboFilled) {
var knownCameraIndex = gridTypeCombo.find(_cameraName)
if (knownCameraIndex !== -1) {
gridTypeCombo.currentIndex = knownCameraIndex
} else {
console.log("Internal error: Known camera not found", _cameraName)
gridTypeCombo.currentIndex = _gridTypeCustomCamera
}
}
}
QGCPalette { id: qgcPal; colorGroupEnabled: true }
ExclusiveGroup {
id: cameraOrientationGroup
}
Column {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
QGCComboBox {
id: gridTypeCombo
anchors.left: parent.left
anchors.right: parent.right
model: _cameraList
currentIndex: -1
onActivated: cameraCalc.cameraName.value = gridTypeCombo.textAt(index)
} // QGCComboxBox
// Camera based grid ui
Column {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: !cameraCalc.isManualCamera
Row {
spacing: _margin
anchors.horizontalCenter: parent.horizontalCenter
visible: !cameraCalc.fixedOrientation.value
QGCRadioButton {
width: _editFieldWidth
text: "Landscape"
checked: !!cameraCalc.landscape.value
onClicked: cameraCalc.landscape.value = 1
}
QGCRadioButton {
id: cameraOrientationPortrait
text: "Portrait"
checked: !cameraCalc.landscape.value
onClicked: cameraCalc.landscape.value = 0
}
}
// Custom camera specs
Column {
id: custCameraCol
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: cameraCalc.isCustomCamera
RowLayout {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
Item { Layout.fillWidth: true }
QGCLabel {
Layout.preferredWidth: _root._fieldWidth
text: qsTr("Width")
}
QGCLabel {
Layout.preferredWidth: _root._fieldWidth
text: qsTr("Height")
}
}
RowLayout {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
QGCLabel { text: qsTr("Sensor"); Layout.fillWidth: true }
FactTextField {
Layout.preferredWidth: _root._fieldWidth
fact: cameraCalc.sensorWidth
}
FactTextField {
Layout.preferredWidth: _root._fieldWidth
fact: cameraCalc.sensorHeight
}
}
RowLayout {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
QGCLabel { text: qsTr("Image"); Layout.fillWidth: true }
FactTextField {
Layout.preferredWidth: _root._fieldWidth
fact: cameraCalc.imageWidth
}
FactTextField {
Layout.preferredWidth: _root._fieldWidth
fact: cameraCalc.imageHeight
}
}
RowLayout {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
QGCLabel {
text: qsTr("Focal length")
Layout.fillWidth: true
}
FactTextField {
Layout.preferredWidth: _root._fieldWidth
fact: cameraCalc.focalLength
}
}
} // Column - custom camera specs
} // Column - Camera spec based ui
} // Column - Camera Section
} // Column
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Layouts 1.2
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0
// Camera calculator "Grid" section for mission item editors
Column {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: !usingPreset || !cameraSpecifiedInPreset
property var cameraCalc
property bool vehicleFlightIsFrontal: true
property string distanceToSurfaceLabel
property int distanceToSurfaceAltitudeMode: QGroundControl.AltitudeModeNone
property string frontalDistanceLabel
property string sideDistanceLabel
property bool usingPreset: false
property bool cameraSpecifiedInPreset: false
property real _margin: ScreenTools.defaultFontPixelWidth / 2
property string _cameraName: cameraCalc.cameraName.value
property real _fieldWidth: ScreenTools.defaultFontPixelWidth * 10.5
property var _cameraList: [ ]
property var _vehicle: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle
property var _vehicleCameraList: _vehicle ? _vehicle.staticCameraList : []
property bool _cameraComboFilled: false
readonly property int _gridTypeManual: 0
readonly property int _gridTypeCustomCamera: 1
readonly property int _gridTypeCamera: 2
QGCPalette { id: qgcPal; colorGroupEnabled: true }
Column {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: !cameraCalc.isManualCamera
RowLayout {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: !usingPreset
Item { Layout.fillWidth: true }
QGCLabel {
Layout.preferredWidth: _root._fieldWidth
text: qsTr("Front Lap")
}
QGCLabel {
Layout.preferredWidth: _root._fieldWidth
text: qsTr("Side Lap")
}
}
RowLayout {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: !usingPreset
QGCLabel { text: qsTr("Overlap"); Layout.fillWidth: true }
FactTextField {
Layout.preferredWidth: _root._fieldWidth
fact: cameraCalc.frontalOverlap
}
FactTextField {
Layout.preferredWidth: _root._fieldWidth
fact: cameraCalc.sideOverlap
}
}
QGCLabel {
wrapMode: Text.WordWrap
text: qsTr("Select one:")
Layout.preferredWidth: parent.width
Layout.columnSpan: 2
visible: !usingPreset
}
GridLayout {
anchors.left: parent.left
anchors.right: parent.right
columnSpacing: _margin
rowSpacing: _margin
columns: 2
visible: !usingPreset
QGCRadioButton {
id: fixedDistanceRadio
text: distanceToSurfaceLabel
checked: !!cameraCalc.valueSetIsDistance.value
onClicked: cameraCalc.valueSetIsDistance.value = 1
}
AltitudeFactTextField {
fact: cameraCalc.distanceToSurface
altitudeMode: distanceToSurfaceAltitudeMode
enabled: fixedDistanceRadio.checked
Layout.fillWidth: true
}
QGCRadioButton {
id: fixedImageDensityRadio
text: qsTr("Ground Res")
checked: !cameraCalc.valueSetIsDistance.value
onClicked: cameraCalc.valueSetIsDistance.value = 0
}
FactTextField {
fact: cameraCalc.imageDensity
enabled: fixedImageDensityRadio.checked
Layout.fillWidth: true
}
}
} // Column - Camera spec based ui
// No camera spec ui
GridLayout {
anchors.left: parent.left
anchors.right: parent.right
columnSpacing: _margin
rowSpacing: _margin
columns: 2
visible: cameraCalc.isManualCamera
QGCLabel { text: distanceToSurfaceLabel }
AltitudeFactTextField {
fact: cameraCalc.distanceToSurface
altitudeMode: distanceToSurfaceAltitudeMode
Layout.fillWidth: true
}
QGCLabel { text: frontalDistanceLabel }
FactTextField {
Layout.fillWidth: true
fact: cameraCalc.adjustedFootprintFrontal
}
QGCLabel { text: sideDistanceLabel }
FactTextField {
Layout.fillWidth: true
fact: cameraCalc.adjustedFootprintSide
}
} // GridLayout
} // Column
...@@ -56,136 +56,172 @@ Rectangle { ...@@ -56,136 +56,172 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
spacing: _margin spacing: _margin
QGCLabel { QGCTabBar {
id: tabBar
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
text: qsTr("WARNING: Photo interval is below minimum interval (%1 secs) supported by camera.").arg(_cameraMinTriggerInterval.toFixed(1))
wrapMode: Text.WordWrap
color: qgcPal.warningText
visible: missionItem.cameraShots > 0 && _cameraMinTriggerInterval !== 0 && _cameraMinTriggerInterval > missionItem.timeBetweenShots
}
Component.onCompleted: currentIndex = 0
CameraCalc { QGCTabButton { text: qsTr("Grid") }
cameraCalc: missionItem.cameraCalc QGCTabButton { text: qsTr("Camera") }
vehicleFlightIsFrontal: true
distanceToSurfaceLabel: qsTr("Altitude")
distanceToSurfaceAltitudeMode: missionItem.followTerrain ?
QGroundControl.AltitudeModeAboveTerrain :
missionItem.cameraCalc.distanceToSurfaceRelative
frontalDistanceLabel: qsTr("Trigger Dist")
sideDistanceLabel: qsTr("Spacing")
} }
SectionHeader { Column {
id: corridorHeader anchors.left: parent.left
text: qsTr("Corridor") anchors.right: parent.right
} spacing: _margin
visible: tabBar.currentIndex == 0
QGCLabel {
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("WARNING: Photo interval is below minimum interval (%1 secs) supported by camera.").arg(_cameraMinTriggerInterval.toFixed(1))
wrapMode: Text.WordWrap
color: qgcPal.warningText
visible: missionItem.cameraShots > 0 && _cameraMinTriggerInterval !== 0 && _cameraMinTriggerInterval > missionItem.timeBetweenShots
}
GridLayout {
anchors.left: parent.left CameraCalcGrid {
anchors.right: parent.right cameraCalc: missionItem.cameraCalc
columnSpacing: _margin vehicleFlightIsFrontal: true
rowSpacing: _margin distanceToSurfaceLabel: qsTr("Altitude")
columns: 2 distanceToSurfaceAltitudeMode: missionItem.followTerrain ?
visible: corridorHeader.checked QGroundControl.AltitudeModeAboveTerrain :
missionItem.cameraCalc.distanceToSurfaceRelative
QGCLabel { text: qsTr("Width") } frontalDistanceLabel: qsTr("Trigger Dist")
FactTextField { sideDistanceLabel: qsTr("Spacing")
fact: missionItem.corridorWidth
Layout.fillWidth: true
} }
QGCLabel { text: qsTr("Turnaround dist") } SectionHeader {
FactTextField { id: corridorHeader
fact: missionItem.turnAroundDistance text: qsTr("Corridor")
Layout.fillWidth: true
} }
QGCOptionsComboBox { GridLayout {
Layout.columnSpan: 2 anchors.left: parent.left
Layout.fillWidth: true anchors.right: parent.right
columnSpacing: _margin
model: [ rowSpacing: _margin
{ columns: 2
text: qsTr("Images in turnarounds"), visible: corridorHeader.checked
fact: missionItem.cameraTriggerInTurnAround,
enabled: missionItem.hoverAndCaptureAllowed ? !missionItem.hoverAndCapture.rawValue : true, QGCLabel { text: qsTr("Width") }
visible: true FactTextField {
}, fact: missionItem.corridorWidth
{ Layout.fillWidth: true
text: qsTr("Relative altitude"), }
enabled: missionItem.cameraCalc.isManualCamera && !missionItem.followTerrain,
visible: QGroundControl.corePlugin.options.showMissionAbsoluteAltitude || (!missionItem.cameraCalc.distanceToSurfaceRelative && !missionItem.followTerrain),
checked: missionItem.cameraCalc.distanceToSurfaceRelative
}
]
onItemClicked: { QGCLabel { text: qsTr("Turnaround dist") }
if (index == 1) { FactTextField {
missionItem.cameraCalc.distanceToSurfaceRelative = !missionItem.cameraCalc.distanceToSurfaceRelative fact: missionItem.turnAroundDistance
console.log(missionItem.cameraCalc.distanceToSurfaceRelative) Layout.fillWidth: true
}
} }
}
}
QGCButton { QGCOptionsComboBox {
text: qsTr("Rotate Entry Point") Layout.columnSpan: 2
onClicked: missionItem.rotateEntryPoint() Layout.fillWidth: true
}
SectionHeader { model: [
id: terrainHeader {
text: qsTr("Terrain") text: qsTr("Images in turnarounds"),
checked: missionItem.followTerrain fact: missionItem.cameraTriggerInTurnAround,
} enabled: missionItem.hoverAndCaptureAllowed ? !missionItem.hoverAndCapture.rawValue : true,
visible: true
},
{
text: qsTr("Relative altitude"),
enabled: missionItem.cameraCalc.isManualCamera && !missionItem.followTerrain,
visible: QGroundControl.corePlugin.options.showMissionAbsoluteAltitude || (!missionItem.cameraCalc.distanceToSurfaceRelative && !missionItem.followTerrain),
checked: missionItem.cameraCalc.distanceToSurfaceRelative
}
]
onItemClicked: {
if (index == 1) {
missionItem.cameraCalc.distanceToSurfaceRelative = !missionItem.cameraCalc.distanceToSurfaceRelative
console.log(missionItem.cameraCalc.distanceToSurfaceRelative)
}
}
}
}
ColumnLayout { QGCButton {
anchors.left: parent.left text: qsTr("Rotate Entry Point")
anchors.right: parent.right onClicked: missionItem.rotateEntryPoint()
spacing: _margin }
visible: terrainHeader.checked
QGCCheckBox { SectionHeader {
id: followsTerrainCheckBox id: terrainHeader
text: qsTr("Vehicle follows terrain") text: qsTr("Terrain")
checked: missionItem.followTerrain checked: missionItem.followTerrain
onClicked: missionItem.followTerrain = checked
} }
GridLayout { ColumnLayout {
Layout.fillWidth: true anchors.left: parent.left
columnSpacing: _margin anchors.right: parent.right
rowSpacing: _margin spacing: _margin
columns: 2 visible: terrainHeader.checked
visible: followsTerrainCheckBox.checked
QGCCheckBox {
QGCLabel { text: qsTr("Tolerance") } id: followsTerrainCheckBox
FactTextField { text: qsTr("Vehicle follows terrain")
fact: missionItem.terrainAdjustTolerance checked: missionItem.followTerrain
Layout.fillWidth: true onClicked: missionItem.followTerrain = checked
} }
QGCLabel { text: qsTr("Max Climb Rate") } GridLayout {
FactTextField {
fact: missionItem.terrainAdjustMaxClimbRate
Layout.fillWidth: true Layout.fillWidth: true
} columnSpacing: _margin
rowSpacing: _margin
columns: 2
visible: followsTerrainCheckBox.checked
QGCLabel { text: qsTr("Tolerance") }
FactTextField {
fact: missionItem.terrainAdjustTolerance
Layout.fillWidth: true
}
QGCLabel { text: qsTr("Max Descent Rate") } QGCLabel { text: qsTr("Max Climb Rate") }
FactTextField { FactTextField {
fact: missionItem.terrainAdjustMaxDescentRate fact: missionItem.terrainAdjustMaxClimbRate
Layout.fillWidth: true Layout.fillWidth: true
}
QGCLabel { text: qsTr("Max Descent Rate") }
FactTextField {
fact: missionItem.terrainAdjustMaxDescentRate
Layout.fillWidth: true
}
} }
} }
}
SectionHeader { SectionHeader {
id: statsHeader id: statsHeader
text: qsTr("Statistics") text: qsTr("Statistics")
} }
TransectStyleComplexItemStats { } TransectStyleComplexItemStats { }
} // Column } // Grid Column
Column {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: tabBar.currentIndex == 1
CameraCalcCamera {
cameraCalc: missionItem.cameraCalc
vehicleFlightIsFrontal: true
distanceToSurfaceLabel: qsTr("Altitude")
distanceToSurfaceAltitudeMode: missionItem.followTerrain ?
QGroundControl.AltitudeModeAboveTerrain :
missionItem.cameraCalc.distanceToSurfaceRelative
frontalDistanceLabel: qsTr("Trigger Dist")
sideDistanceLabel: qsTr("Spacing")
}
} // Camera Column
}
} // Rectangle } // Rectangle
...@@ -57,132 +57,166 @@ Rectangle { ...@@ -57,132 +57,166 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
spacing: _margin spacing: _margin
QGCLabel { QGCTabBar {
id: tabBar
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
text: qsTr("Note: Polygon respresents structure surface not vehicle flight path.")
wrapMode: Text.WordWrap
font.pointSize: ScreenTools.smallFontPointSize
}
QGCLabel {
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("WARNING: Photo interval is below minimum interval (%1 secs) supported by camera.").arg(_cameraMinTriggerInterval.toFixed(1))
wrapMode: Text.WordWrap
color: qgcPal.warningText
visible: missionItem.cameraShots > 0 && _cameraMinTriggerInterval !== 0 && _cameraMinTriggerInterval > missionItem.timeBetweenShots
}
CameraCalc { Component.onCompleted: currentIndex = 0
cameraCalc: missionItem.cameraCalc
vehicleFlightIsFrontal: false
distanceToSurfaceLabel: qsTr("Scan Distance")
distanceToSurfaceAltitudeMode: QGroundControl.AltitudeModeNone
frontalDistanceLabel: qsTr("Layer Height")
sideDistanceLabel: qsTr("Trigger Distance")
}
SectionHeader { QGCTabButton { text: qsTr("Grid") }
id: scanHeader QGCTabButton { text: qsTr("Camera") }
text: qsTr("Scan")
} }
Column { Column {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
spacing: _margin spacing: _margin
visible: scanHeader.checked visible: tabBar.currentIndex == 0
GridLayout { QGCLabel {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
columnSpacing: _margin text: qsTr("Note: Polygon respresents structure surface not vehicle flight path.")
rowSpacing: _margin wrapMode: Text.WordWrap
columns: 2 font.pointSize: ScreenTools.smallFontPointSize
}
FactComboBox { QGCLabel {
fact: missionItem.startFromTop anchors.left: parent.left
indexModel: true anchors.right: parent.right
model: [ qsTr("Start Scan From Bottom"), qsTr("Start Scan From Top") ] text: qsTr("WARNING: Photo interval is below minimum interval (%1 secs) supported by camera.").arg(_cameraMinTriggerInterval.toFixed(1))
Layout.columnSpan: 2 wrapMode: Text.WordWrap
Layout.fillWidth: true color: qgcPal.warningText
} visible: missionItem.cameraShots > 0 && _cameraMinTriggerInterval !== 0 && _cameraMinTriggerInterval > missionItem.timeBetweenShots
}
QGCLabel { CameraCalcGrid {
text: qsTr("Structure Height") cameraCalc: missionItem.cameraCalc
} vehicleFlightIsFrontal: false
FactTextField { distanceToSurfaceLabel: qsTr("Scan Distance")
fact: missionItem.structureHeight distanceToSurfaceAltitudeMode: QGroundControl.AltitudeModeNone
Layout.fillWidth: true frontalDistanceLabel: qsTr("Layer Height")
} sideDistanceLabel: qsTr("Trigger Distance")
}
QGCLabel { text: qsTr("Scan Bottom Alt") } SectionHeader {
AltitudeFactTextField { id: scanHeader
fact: missionItem.scanBottomAlt text: qsTr("Scan")
altitudeMode: QGroundControl.AltitudeModeRelative }
Layout.fillWidth: true
}
QGCLabel { text: qsTr("Entrance/Exit Alt") } Column {
AltitudeFactTextField { anchors.left: parent.left
fact: missionItem.entranceAlt anchors.right: parent.right
altitudeMode: QGroundControl.AltitudeModeRelative spacing: _margin
Layout.fillWidth: true visible: scanHeader.checked
GridLayout {
anchors.left: parent.left
anchors.right: parent.right
columnSpacing: _margin
rowSpacing: _margin
columns: 2
FactComboBox {
fact: missionItem.startFromTop
indexModel: true
model: [ qsTr("Start Scan From Bottom"), qsTr("Start Scan From Top") ]
Layout.columnSpan: 2
Layout.fillWidth: true
}
QGCLabel {
text: qsTr("Structure Height")
}
FactTextField {
fact: missionItem.structureHeight
Layout.fillWidth: true
}
QGCLabel { text: qsTr("Scan Bottom Alt") }
AltitudeFactTextField {
fact: missionItem.scanBottomAlt
altitudeMode: QGroundControl.AltitudeModeRelative
Layout.fillWidth: true
}
QGCLabel { text: qsTr("Entrance/Exit Alt") }
AltitudeFactTextField {
fact: missionItem.entranceAlt
altitudeMode: QGroundControl.AltitudeModeRelative
Layout.fillWidth: true
}
QGCLabel {
text: qsTr("Gimbal Pitch")
visible: missionItem.cameraCalc.isManualCamera
}
FactTextField {
fact: missionItem.gimbalPitch
Layout.fillWidth: true
visible: missionItem.cameraCalc.isManualCamera
}
} }
QGCLabel { Item {
text: qsTr("Gimbal Pitch") height: ScreenTools.defaultFontPixelHeight / 2
visible: missionItem.cameraCalc.isManualCamera width: 1
}
FactTextField {
fact: missionItem.gimbalPitch
Layout.fillWidth: true
visible: missionItem.cameraCalc.isManualCamera
} }
}
Item { QGCButton {
height: ScreenTools.defaultFontPixelHeight / 2 text: qsTr("Rotate entry point")
width: 1 onClicked: missionItem.rotateEntryPoint()
} }
} // Column - Scan
QGCButton { SectionHeader {
text: qsTr("Rotate entry point") id: statsHeader
onClicked: missionItem.rotateEntryPoint() text: qsTr("Statistics")
} }
} // Column - Scan
SectionHeader { Grid {
id: statsHeader columns: 2
text: qsTr("Statistics") columnSpacing: ScreenTools.defaultFontPixelWidth
} visible: statsHeader.checked
Grid { QGCLabel { text: qsTr("Layers") }
columns: 2 QGCLabel { text: missionItem.layers.valueString }
columnSpacing: ScreenTools.defaultFontPixelWidth
visible: statsHeader.checked
QGCLabel { text: qsTr("Layers") } QGCLabel { text: qsTr("Layer Height") }
QGCLabel { text: missionItem.layers.valueString } QGCLabel { text: missionItem.cameraCalc.adjustedFootprintFrontal.valueString + " " + QGroundControl.appSettingsDistanceUnitsString }
QGCLabel { text: qsTr("Layer Height") } QGCLabel { text: qsTr("Top Layer Alt") }
QGCLabel { text: missionItem.cameraCalc.adjustedFootprintFrontal.valueString + " " + QGroundControl.appSettingsDistanceUnitsString } QGCLabel { text: QGroundControl.metersToAppSettingsDistanceUnits(missionItem.topFlightAlt).toFixed(1) + " " + QGroundControl.appSettingsDistanceUnitsString }
QGCLabel { text: qsTr("Top Layer Alt") } QGCLabel { text: qsTr("Bottom Layer Alt") }
QGCLabel { text: QGroundControl.metersToAppSettingsDistanceUnits(missionItem.topFlightAlt).toFixed(1) + " " + QGroundControl.appSettingsDistanceUnitsString } QGCLabel { text: QGroundControl.metersToAppSettingsDistanceUnits(missionItem.bottomFlightAlt).toFixed(1) + " " + QGroundControl.appSettingsDistanceUnitsString }
QGCLabel { text: qsTr("Bottom Layer Alt") } QGCLabel { text: qsTr("Photo Count") }
QGCLabel { text: QGroundControl.metersToAppSettingsDistanceUnits(missionItem.bottomFlightAlt).toFixed(1) + " " + QGroundControl.appSettingsDistanceUnitsString } QGCLabel { text: missionItem.cameraShots }
QGCLabel { text: qsTr("Photo Count") } QGCLabel { text: qsTr("Photo Interval") }
QGCLabel { text: missionItem.cameraShots } QGCLabel { text: missionItem.timeBetweenShots.toFixed(1) + " " + qsTr("secs") }
QGCLabel { text: qsTr("Photo Interval") } QGCLabel { text: qsTr("Trigger Distance") }
QGCLabel { text: missionItem.timeBetweenShots.toFixed(1) + " " + qsTr("secs") } QGCLabel { text: missionItem.cameraCalc.adjustedFootprintSide.valueString + " " + QGroundControl.appSettingsDistanceUnitsString }
}
} // Grid Column
QGCLabel { text: qsTr("Trigger Distance") } Column {
QGCLabel { text: missionItem.cameraCalc.adjustedFootprintSide.valueString + " " + QGroundControl.appSettingsDistanceUnitsString } anchors.left: parent.left
} anchors.right: parent.right
} // Column spacing: _margin
visible: tabBar.currentIndex == 1
CameraCalcCamera {
cameraCalc: missionItem.cameraCalc
vehicleFlightIsFrontal: false
distanceToSurfaceLabel: qsTr("Scan Distance")
distanceToSurfaceAltitudeMode: QGroundControl.AltitudeModeNone
frontalDistanceLabel: qsTr("Layer Height")
sideDistanceLabel: qsTr("Trigger Distance")
}
} // Camera Column
}
} // Rectangle } // Rectangle
...@@ -58,176 +58,103 @@ Rectangle { ...@@ -58,176 +58,103 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
spacing: _margin spacing: _margin
QGCLabel { QGCTabBar {
id: tabBar
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
text: qsTr("WARNING: Photo interval is below minimum interval (%1 secs) supported by camera.").arg(_cameraMinTriggerInterval.toFixed(1))
wrapMode: Text.WordWrap
color: qgcPal.warningText
visible: missionItem.cameraShots > 0 && _cameraMinTriggerInterval !== 0 && _cameraMinTriggerInterval > missionItem.timeBetweenShots
}
QGCLabel { Component.onCompleted: currentIndex = 0
text: qsTr("Presets")
QGCTabButton { text: qsTr("Grid") }
QGCTabButton { text: qsTr("Camera") }
QGCTabButton { text: qsTr("Presets") }
} }
QGCComboBox { Column {
id: presetCombo
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
model: _presetList spacing: _margin
visible: tabBar.currentIndex == 0
property var _presetList: []
readonly property int _indexCustom: 0
readonly property int _indexCreate: 1
readonly property int _indexDelete: 2
readonly property int _indexLabel: 3
readonly property int _indexFirstPreset: 4
Component.onCompleted: _updateList()
onActivated: {
if (index == _indexCustom) {
missionItem.clearCurrentPreset()
} else if (index == _indexCreate) {
mainWindow.showComponentDialog(savePresetDialog, qsTr("Save Preset"), mainWindow.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel)
} else if (index == _indexDelete) {
if (missionItem.builtInPreset) {
mainWindow.showMessage(qsTr("Delete Preset"), qsTr("This preset cannot be deleted."))
} else {
missionItem.deleteCurrentPreset()
}
} else if (index >= _indexFirstPreset) {
missionItem.loadPreset(textAt(index))
} else {
_selectCurrentPreset()
}
}
Connections {
target: missionItem
onPresetNamesChanged: presetCombo._updateList() QGCLabel {
onCurrentPresetChanged: presetCombo._selectCurrentPreset() anchors.left: parent.left
anchors.right: parent.right
text: qsTr("WARNING: Photo interval is below minimum interval (%1 secs) supported by camera.").arg(_cameraMinTriggerInterval.toFixed(1))
wrapMode: Text.WordWrap
color: qgcPal.warningText
visible: missionItem.cameraShots > 0 && _cameraMinTriggerInterval !== 0 && _cameraMinTriggerInterval > missionItem.timeBetweenShots
} }
// There is some major strangeness going on with programatically changing the index of a combo box in this scenario. CameraCalcGrid {
// If you just set currentIndex directly it will just change back 1o -1 magically. Has something to do with resetting cameraCalc: missionItem.cameraCalc
// model on the fly I think. But not sure. To work around I delay the currentIndex changes to let things unwind. vehicleFlightIsFrontal: true
Timer { distanceToSurfaceLabel: qsTr("Altitude")
id: delayedIndexChangeTimer distanceToSurfaceAltitudeMode: missionItem.followTerrain ?
interval: 10 QGroundControl.AltitudeModeAboveTerrain :
missionItem.cameraCalc.distanceToSurfaceRelative
property int newIndex frontalDistanceLabel: qsTr("Trigger Dist")
sideDistanceLabel: qsTr("Spacing")
onTriggered: presetCombo.currentIndex = newIndex usingPreset: _usingPreset
cameraSpecifiedInPreset: missionItem.cameraInPreset
} }
function delayedIndexChange(index) { SectionHeader {
delayedIndexChangeTimer.newIndex = index id: transectsHeader
delayedIndexChangeTimer.start() text: qsTr("Transects")
} }
function _updateList() { GridLayout {
_presetList = [] anchors.left: parent.left
_presetList.push(qsTr("Custom (specify all settings)")) anchors.right: parent.right
_presetList.push(qsTr("Save Settings As Preset")) columnSpacing: _margin
_presetList.push(qsTr("Delete Current Preset")) rowSpacing: _margin
if (missionItem.presetNames.length !== 0) { columns: 2
_presetList.push(qsTr("Presets:")) visible: transectsHeader.checked
}
for (var i=0; i<missionItem.presetNames.length; i++) { QGCLabel { text: qsTr("Angle") }
_presetList.push(missionItem.presetNames[i]) FactTextField {
fact: missionItem.gridAngle
Layout.fillWidth: true
onUpdated: angleSlider.value = missionItem.gridAngle.value
} }
model = _presetList
_selectCurrentPreset()
}
function _selectCurrentPreset() { QGCSlider {
if (_usingPreset) { id: angleSlider
var newIndex = find(_currentPreset) minimumValue: 0
if (newIndex !== -1) { maximumValue: 359
delayedIndexChange(newIndex) stepSize: 1
return tickmarksEnabled: false
} Layout.fillWidth: true
Layout.columnSpan: 2
Layout.preferredHeight: ScreenTools.defaultFontPixelHeight * 1.5
onValueChanged: missionItem.gridAngle.value = value
Component.onCompleted: value = missionItem.gridAngle.value
updateValueWhileDragging: true
} }
delayedIndexChange(presetCombo._indexCustom)
}
}
CameraCalc { QGCLabel {
cameraCalc: missionItem.cameraCalc text: qsTr("Turnaround dist")
vehicleFlightIsFrontal: true visible: !_usingPreset
distanceToSurfaceLabel: qsTr("Altitude") }
distanceToSurfaceAltitudeMode: missionItem.followTerrain ? FactTextField {
QGroundControl.AltitudeModeAboveTerrain : fact: missionItem.turnAroundDistance
missionItem.cameraCalc.distanceToSurfaceRelative Layout.fillWidth: true
frontalDistanceLabel: qsTr("Trigger Dist") visible: !_usingPreset
sideDistanceLabel: qsTr("Spacing") }
usingPreset: _usingPreset
cameraSpecifiedInPreset: missionItem.cameraInPreset
}
SectionHeader {
id: transectsHeader
text: qsTr("Transects")
}
GridLayout {
anchors.left: parent.left
anchors.right: parent.right
columnSpacing: _margin
rowSpacing: _margin
columns: 2
visible: transectsHeader.checked
QGCLabel { text: qsTr("Angle") }
FactTextField {
fact: missionItem.gridAngle
Layout.fillWidth: true
onUpdated: angleSlider.value = missionItem.gridAngle.value
}
QGCSlider {
id: angleSlider
minimumValue: 0
maximumValue: 359
stepSize: 1
tickmarksEnabled: false
Layout.fillWidth: true
Layout.columnSpan: 2
Layout.preferredHeight: ScreenTools.defaultFontPixelHeight * 1.5
onValueChanged: missionItem.gridAngle.value = value
Component.onCompleted: value = missionItem.gridAngle.value
updateValueWhileDragging: true
} }
QGCLabel { QGCButton {
text: qsTr("Turnaround dist") text: qsTr("Rotate Entry Point")
visible: !_usingPreset onClicked: missionItem.rotateEntryPoint();
} }
FactTextField {
fact: missionItem.turnAroundDistance
Layout.fillWidth: true
visible: !_usingPreset
}
}
QGCButton {
text: qsTr("Rotate Entry Point")
onClicked: missionItem.rotateEntryPoint();
}
ColumnLayout { ColumnLayout {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
spacing: _margin spacing: _margin
visible: transectsHeader.checked && !_usingPreset visible: transectsHeader.checked && !_usingPreset
/* /*
Temporarily removed due to bug https://github.com/mavlink/qgroundcontrol/issues/7005 Temporarily removed due to bug https://github.com/mavlink/qgroundcontrol/issues/7005
FactCheckBox { FactCheckBox {
text: qsTr("Split concave polygons") text: qsTr("Split concave polygons")
...@@ -237,143 +164,258 @@ Rectangle { ...@@ -237,143 +164,258 @@ Rectangle {
} }
*/ */
QGCOptionsComboBox { QGCOptionsComboBox {
Layout.fillWidth: true Layout.fillWidth: true
model: [ model: [
{ {
text: qsTr("Hover and capture image"), text: qsTr("Hover and capture image"),
fact: missionItem.hoverAndCapture, fact: missionItem.hoverAndCapture,
enabled: !missionItem.followTerrain, enabled: !missionItem.followTerrain,
visible: missionItem.hoverAndCaptureAllowed visible: missionItem.hoverAndCaptureAllowed
}, },
{ {
text: qsTr("Refly at 90 deg offset"), text: qsTr("Refly at 90 deg offset"),
fact: missionItem.refly90Degrees, fact: missionItem.refly90Degrees,
enabled: !missionItem.followTerrain, enabled: !missionItem.followTerrain,
visible: true visible: true
}, },
{ {
text: qsTr("Images in turnarounds"), text: qsTr("Images in turnarounds"),
fact: missionItem.cameraTriggerInTurnAround, fact: missionItem.cameraTriggerInTurnAround,
enabled: missionItem.hoverAndCaptureAllowed ? !missionItem.hoverAndCapture.rawValue : true, enabled: missionItem.hoverAndCaptureAllowed ? !missionItem.hoverAndCapture.rawValue : true,
visible: true visible: true
}, },
{ {
text: qsTr("Fly alternate transects"), text: qsTr("Fly alternate transects"),
fact: missionItem.flyAlternateTransects, fact: missionItem.flyAlternateTransects,
enabled: true, enabled: true,
visible: _vehicle ? (_vehicle.fixedWing || _vehicle.vtol) : false visible: _vehicle ? (_vehicle.fixedWing || _vehicle.vtol) : false
}, },
{ {
text: qsTr("Relative altitude"), text: qsTr("Relative altitude"),
enabled: missionItem.cameraCalc.isManualCamera && !missionItem.followTerrain, enabled: missionItem.cameraCalc.isManualCamera && !missionItem.followTerrain,
visible: QGroundControl.corePlugin.options.showMissionAbsoluteAltitude || (!missionItem.cameraCalc.distanceToSurfaceRelative && !missionItem.followTerrain), visible: QGroundControl.corePlugin.options.showMissionAbsoluteAltitude || (!missionItem.cameraCalc.distanceToSurfaceRelative && !missionItem.followTerrain),
checked: missionItem.cameraCalc.distanceToSurfaceRelative checked: missionItem.cameraCalc.distanceToSurfaceRelative
} }
] ]
onItemClicked: { onItemClicked: {
if (index == 4) { if (index == 4) {
missionItem.cameraCalc.distanceToSurfaceRelative = !missionItem.cameraCalc.distanceToSurfaceRelative missionItem.cameraCalc.distanceToSurfaceRelative = !missionItem.cameraCalc.distanceToSurfaceRelative
console.log(missionItem.cameraCalc.distanceToSurfaceRelative) console.log(missionItem.cameraCalc.distanceToSurfaceRelative)
}
} }
} }
} }
}
SectionHeader {
id: terrainHeader
text: qsTr("Terrain")
checked: missionItem.followTerrain
visible: !_usingPreset
}
ColumnLayout { SectionHeader {
anchors.left: parent.left id: terrainHeader
anchors.right: parent.right text: qsTr("Terrain")
spacing: _margin
visible: terrainHeader.checked && !_usingPreset
QGCCheckBox {
id: followsTerrainCheckBox
text: qsTr("Vehicle follows terrain")
checked: missionItem.followTerrain checked: missionItem.followTerrain
onClicked: missionItem.followTerrain = checked visible: !_usingPreset
} }
GridLayout { ColumnLayout {
Layout.fillWidth: true anchors.left: parent.left
columnSpacing: _margin anchors.right: parent.right
rowSpacing: _margin spacing: _margin
columns: 2 visible: terrainHeader.checked && !_usingPreset
visible: followsTerrainCheckBox.checked
QGCLabel { text: qsTr("Tolerance") }
FactTextField {
fact: missionItem.terrainAdjustTolerance
Layout.fillWidth: true
}
QGCLabel { text: qsTr("Max Climb Rate") } QGCCheckBox {
FactTextField { id: followsTerrainCheckBox
fact: missionItem.terrainAdjustMaxClimbRate text: qsTr("Vehicle follows terrain")
Layout.fillWidth: true checked: missionItem.followTerrain
onClicked: missionItem.followTerrain = checked
} }
QGCLabel { text: qsTr("Max Descent Rate") } GridLayout {
FactTextField {
fact: missionItem.terrainAdjustMaxDescentRate
Layout.fillWidth: true Layout.fillWidth: true
columnSpacing: _margin
rowSpacing: _margin
columns: 2
visible: followsTerrainCheckBox.checked
QGCLabel { text: qsTr("Tolerance") }
FactTextField {
fact: missionItem.terrainAdjustTolerance
Layout.fillWidth: true
}
QGCLabel { text: qsTr("Max Climb Rate") }
FactTextField {
fact: missionItem.terrainAdjustMaxClimbRate
Layout.fillWidth: true
}
QGCLabel { text: qsTr("Max Descent Rate") }
FactTextField {
fact: missionItem.terrainAdjustMaxDescentRate
Layout.fillWidth: true
}
} }
} }
}
SectionHeader { SectionHeader {
id: statsHeader id: statsHeader
text: qsTr("Statistics") text: qsTr("Statistics")
} }
TransectStyleComplexItemStats { } TransectStyleComplexItemStats { }
} // Column } // Grid Column
Component { Column {
id: savePresetDialog anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: tabBar.currentIndex == 1
CameraCalcCamera {
cameraCalc: missionItem.cameraCalc
vehicleFlightIsFrontal: true
distanceToSurfaceLabel: qsTr("Altitude")
distanceToSurfaceAltitudeMode: missionItem.followTerrain ?
QGroundControl.AltitudeModeAboveTerrain :
missionItem.cameraCalc.distanceToSurfaceRelative
frontalDistanceLabel: qsTr("Trigger Dist")
sideDistanceLabel: qsTr("Spacing")
usingPreset: _usingPreset
cameraSpecifiedInPreset: missionItem.cameraInPreset
}
} // Camera Column
QGCViewDialog { Column {
function accept() { anchors.left: parent.left
if (presetNameField.text != "") { anchors.right: parent.right
missionItem.savePreset(presetNameField.text) spacing: _margin
hideDialog() visible: tabBar.currentIndex == 2
QGCComboBox {
id: presetCombo
anchors.left: parent.left
anchors.right: parent.right
model: _presetList
property var _presetList: []
readonly property int _indexCustom: 0
readonly property int _indexCreate: 1
readonly property int _indexDelete: 2
readonly property int _indexLabel: 3
readonly property int _indexFirstPreset: 4
Component.onCompleted: _updateList()
onActivated: {
if (index == _indexCustom) {
missionItem.clearCurrentPreset()
} else if (index == _indexCreate) {
mainWindow.showComponentDialog(savePresetDialog, qsTr("Save Preset"), mainWindow.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel)
} else if (index == _indexDelete) {
if (missionItem.builtInPreset) {
mainWindow.showMessage(qsTr("Delete Preset"), qsTr("This preset cannot be deleted."))
} else {
missionItem.deleteCurrentPreset()
}
} else if (index >= _indexFirstPreset) {
missionItem.loadPreset(textAt(index))
} else {
_selectCurrentPreset()
}
} }
}
ColumnLayout { Connections {
anchors.left: parent.left target: missionItem
anchors.right: parent.right
spacing: ScreenTools.defaultFontPixelHeight
QGCLabel { onPresetNamesChanged: presetCombo._updateList()
Layout.fillWidth: true onCurrentPresetChanged: presetCombo._selectCurrentPreset()
text: qsTr("Save the current settings as a named preset.")
wrapMode: Text.WordWrap
} }
QGCLabel { // There is some major strangeness going on with programatically changing the index of a combo box in this scenario.
text: qsTr("Preset Name") // If you just set currentIndex directly it will just change back 1o -1 magically. Has something to do with resetting
// model on the fly I think. But not sure. To work around I delay the currentIndex changes to let things unwind.
Timer {
id: delayedIndexChangeTimer
interval: 10
property int newIndex
onTriggered: presetCombo.currentIndex = newIndex
} }
QGCTextField { function delayedIndexChange(index) {
id: presetNameField delayedIndexChangeTimer.newIndex = index
Layout.fillWidth: true delayedIndexChangeTimer.start()
text: _currentPreset
} }
QGCCheckBox { function _updateList() {
text: qsTr("Save Camera In Preset") _presetList = []
checked: missionItem.cameraInPreset _presetList.push(qsTr("Custom (specify all settings)"))
onClicked: missionItem.cameraInPreset = checked _presetList.push(qsTr("Save Settings As Preset"))
_presetList.push(qsTr("Delete Current Preset"))
if (missionItem.presetNames.length !== 0) {
_presetList.push(qsTr("Presets:"))
}
for (var i=0; i<missionItem.presetNames.length; i++) {
_presetList.push(missionItem.presetNames[i])
}
model = _presetList
_selectCurrentPreset()
}
function _selectCurrentPreset() {
if (_usingPreset) {
var newIndex = find(_currentPreset)
if (newIndex !== -1) {
delayedIndexChange(newIndex)
return
}
}
delayedIndexChange(presetCombo._indexCustom)
}
}
} // Camera Column
Component {
id: savePresetDialog
QGCViewDialog {
function accept() {
if (presetNameField.text != "") {
missionItem.savePreset(presetNameField.text)
hideDialog()
}
}
ColumnLayout {
anchors.left: parent.left
anchors.right: parent.right
spacing: ScreenTools.defaultFontPixelHeight
QGCLabel {
Layout.fillWidth: true
text: qsTr("Save the current settings as a named preset.")
wrapMode: Text.WordWrap
}
QGCLabel {
text: qsTr("Preset Name")
}
QGCTextField {
id: presetNameField
Layout.fillWidth: true
text: _currentPreset
}
QGCCheckBox {
text: qsTr("Save Camera In Preset")
checked: missionItem.cameraInPreset
onClicked: missionItem.cameraInPreset = checked
}
} }
} }
} }
......
...@@ -4,6 +4,8 @@ AnalyzePage 1.0 AnalyzePage.qml ...@@ -4,6 +4,8 @@ AnalyzePage 1.0 AnalyzePage.qml
AppMessages 1.0 AppMessages.qml AppMessages 1.0 AppMessages.qml
AxisMonitor 1.0 AxisMonitor.qml AxisMonitor 1.0 AxisMonitor.qml
CameraCalc 1.0 CameraCalc.qml CameraCalc 1.0 CameraCalc.qml
CameraCalcCamera 1.0 CameraCalcCamera.qml
CameraCalcGrid 1.0 CameraCalcGrid.qml
APMSubMotorDisplay 1.0 APMSubMotorDisplay.qml APMSubMotorDisplay 1.0 APMSubMotorDisplay.qml
CameraSection 1.0 CameraSection.qml CameraSection 1.0 CameraSection.qml
ClickableColor 1.0 ClickableColor.qml ClickableColor 1.0 ClickableColor.qml
......
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