import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Dialogs 1.2 import QGroundControl 1.0 import QGroundControl.ScreenTools 1.0 import QGroundControl.Vehicle 1.0 import QGroundControl.Controls 1.0 import QGroundControl.FactControls 1.0 import QGroundControl.Palette 1.0 // Editor for Survery mission items Rectangle { id: _root height: visible ? (editorColumn.height + (_margin * 2)) : 0 width: availableWidth color: qgcPal.windowShadeDark radius: _radius // The following properties must be available up the hierarchy chain //property real availableWidth ///< Width for control //property var missionItem ///< Mission Item for editor property real _margin: ScreenTools.defaultFontPixelWidth / 2 property int cameraIndex: 1 ListModel { id: cameraModelList ListElement { text: qsTr("Custom") sensorWidth: 0 sensorHeight: 0 imageWidth: 0 imageHeight: 0 focalLength: 0 } ListElement { text: qsTr("Sony ILCE-QX1") //http://www.sony.co.uk/electronics/interchangeable-lens-cameras/ilce-qx1-body-kit/specifications sensorWidth: 23.2 //http://www.sony.com/electronics/camera-lenses/sel16f28/specifications sensorHeight: 15.4 imageWidth: 5456 imageHeight: 3632 focalLength: 16 } ListElement { text: qsTr("Canon S100 PowerShot") sensorWidth: 7.6 sensorHeight: 5.7 imageWidth: 4000 imageHeight: 3000 focalLength: 5.2 } ListElement { text: qsTr("Canon SX260 HS PowerShot") sensorWidth: 6.17 sensorHeight: 4.55 imageWidth: 4000 imageHeight: 3000 focalLength: 4.5 } ListElement { text: qsTr("Canon EOS-M 22mm") sensorWidth: 22.3 sensorHeight: 14.9 imageWidth: 5184 imageHeight: 3456 focalLength: 22 } } function recalcFromCameraValues() { var focalLength = cameraModelList.get(cameraIndex).focalLength var sensorWidth = cameraModelList.get(cameraIndex).sensorWidth var sensorHeight = cameraModelList.get(cameraIndex).sensorHeight var imageWidth = cameraModelList.get(cameraIndex).imageWidth var imageHeight = cameraModelList.get(cameraIndex).imageHeight var gsd = Number(gsdField.text) var frontalOverlap = Number(frontalOverlapField.text) var sideOverlap = Number(sideOverlapField.text) if (focalLength <= 0.0 || sensorWidth <= 0.0 || sensorHeight <= 0.0 || imageWidth < 0 || imageHeight < 0 || gsd < 0.0 || frontalOverlap < 0 || sideOverlap < 0) { missionItem.gridAltitude.rawValue = 0 missionItem.gridSpacing.rawValue = 0 missionItem.cameraTriggerDistance.rawValue = 0 return } var altitude var imageSizeSideGround //size in side (non flying) direction of the image on the ground var imageSizeFrontGround //size in front (flying) direction of the image on the ground var gridSpacing var cameraTriggerDistance altitude = (imageWidth * gsd * focalLength) / (sensorWidth * 100) if (cameraOrientationLandscape.checked) { imageSizeSideGround = (imageWidth * gsd) / 100 imageSizeFrontGround = (imageHeight * gsd) / 100 } else { imageSizeSideGround = (imageHeight * gsd) / 100 imageSizeFrontGround = (imageWidth * gsd) / 100 } gridSpacing = imageSizeSideGround * ( (100-sideOverlap) / 100 ) cameraTriggerDistance = imageSizeFrontGround * ( (100-frontalOverlap) / 100 ) missionItem.gridAltitude.rawValue = altitude missionItem.gridSpacing.rawValue = gridSpacing missionItem.cameraTriggerDistance.rawValue = cameraTriggerDistance } function recalcFromMissionValues() { var focalLength = cameraModelList.get(cameraIndex).focalLength var sensorWidth = cameraModelList.get(cameraIndex).sensorWidth var sensorHeight = cameraModelList.get(cameraIndex).sensorHeight var imageWidth = cameraModelList.get(cameraIndex).imageWidth var imageHeight = cameraModelList.get(cameraIndex).imageHeight var altitude = missionItem.gridAltitude.rawValue var gridSpacing = missionItem.gridSpacing.rawValue var cameraTriggerDistance = missionItem.cameraTriggerDistance.rawValue if (focalLength <= 0.0 || sensorWidth <= 0.0 || sensorHeight <= 0.0 || imageWidth < 0 || imageHeight < 0 || altitude < 0.0 || gridSpacing < 0.0 || cameraTriggerDistance < 0.0) { gsdField.text = "0.0" sideOverlapField.text = "0" frontalOverlapField.text = "0" return } var gsd var imageSizeSideGround //size in side (non flying) direction of the image on the ground var imageSizeFrontGround //size in front (flying) direction of the image on the ground gsd = (altitude * sensorWidth * 100) / (imageWidth * focalLength) if (cameraOrientationLandscape.checked) { imageSizeSideGround = (imageWidth * gsd) / 100 imageSizeFrontGround = (imageHeight * gsd) / 100 } else { imageSizeSideGround = (imageHeight * gsd) / 100 imageSizeFrontGround = (imageWidth * gsd) / 100 } var sideOverlap = (imageSizeSideGround == 0 ? 0 : 100 - (gridSpacing*100 / imageSizeSideGround)) var frontOverlap = (imageSizeFrontGround == 0 ? 0 : 100 - (cameraTriggerDistance*100 / imageSizeFrontGround)) gsdField.text = gsd.toFixed(1) sideOverlapField.text = sideOverlap.toFixed(0) frontalOverlapField.text = frontOverlap.toFixed(0) } function polygonCaptureStarted() { missionItem.clearPolygon() } function polygonCaptureFinished(coordinates) { for (var i=0; i 0 && !editorMap.polygonDraw.drawingPolygon onClicked: { if (editorMap.polygonDraw.adjustingPolygon) { editorMap.polygonDraw.finishAdjustPolygon() } else { editorMap.polygonDraw.startAdjustPolygon(_root, missionItem.polygonPath) } } } } QGCLabel { text: qsTr("Statistics:") } Rectangle { anchors.left: parent.left anchors.right: parent.right height: 1 color: qgcPal.text } Grid { columns: 2 spacing: ScreenTools.defaultFontPixelWidth QGCLabel { text: qsTr("Survey area:") } QGCLabel { text: QGroundControl.squareMetersToAppSettingsAreaUnits(missionItem.coveredArea).toFixed(2) + " " + QGroundControl.appSettingsAreaUnitsString } QGCLabel { text: qsTr("# shots:") } QGCLabel { text: missionItem.cameraShots } } } }