Unverified Commit 10fc35fb authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #7876 from DonLakeFlyer/StructureScan

Structure Scan: Start with no polygon
parents d6685452 f3ddd277
......@@ -525,14 +525,14 @@ Item {
QGCButton {
_horizontalPadding: 0
text: qsTr("Basic Polygon")
text: qsTr("Basic")
visible: !_traceMode
onClicked: _resetPolygon()
}
QGCButton {
_horizontalPadding: 0
text: qsTr("Circular Polygon")
text: qsTr("Circular")
visible: !_traceMode
onClicked: _resetCircle()
}
......
......@@ -323,14 +323,14 @@ Item {
QGCButton {
_horizontalPadding: 0
text: qsTr("Basic Corridor")
text: qsTr("Basic")
visible: !_traceMode
onClicked: _resetPolyline()
}
QGCButton {
_horizontalPadding: 0
text: _traceMode ? qsTr("Done Tracing") : qsTr("Trace Corridor")
text: _traceMode ? qsTr("Done Tracing") : qsTr("Trace")
onClicked: {
if (_traceMode) {
if (mapPolyline.count < 2) {
......
......@@ -72,7 +72,7 @@ Rectangle {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: missionItem.surveyAreaPolygon.isValid
visible: missionItem.corridorPolyline.isValid
QGCTabBar {
id: tabBar
......
......@@ -55,168 +55,187 @@ Rectangle {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
QGCTabBar {
id: tabBar
ColumnLayout {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: !missionItem.structurePolygon.isValid
Component.onCompleted: currentIndex = 0
QGCTabButton { text: qsTr("Grid") }
QGCTabButton { text: qsTr("Camera") }
QGCLabel {
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: qsTr("Use the Polygon Tools to create the polygon which outlines the structure.")
}
}
Column {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: tabBar.currentIndex == 0
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: missionItem.structurePolygon.isValid
QGCLabel {
QGCTabBar {
id: tabBar
anchors.left: parent.left
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
}
Component.onCompleted: currentIndex = 0
CameraCalcGrid {
cameraCalc: missionItem.cameraCalc
vehicleFlightIsFrontal: false
distanceToSurfaceLabel: qsTr("Scan Distance")
distanceToSurfaceAltitudeMode: QGroundControl.AltitudeModeNone
frontalDistanceLabel: qsTr("Layer Height")
sideDistanceLabel: qsTr("Trigger Distance")
}
SectionHeader {
id: scanHeader
text: qsTr("Scan")
QGCTabButton { text: qsTr("Grid") }
QGCTabButton { text: qsTr("Camera") }
}
Column {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: scanHeader.checked
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
visible: tabBar.currentIndex == 0
GridLayout {
QGCLabel {
anchors.left: parent.left
anchors.right: parent.right
columnSpacing: _margin
rowSpacing: _margin
columns: 2
text: qsTr("Note: Polygon respresents structure surface not vehicle flight path.")
wrapMode: Text.WordWrap
font.pointSize: ScreenTools.smallFontPointSize
}
FactComboBox {
fact: missionItem.startFromTop
indexModel: true
model: [ qsTr("Start Scan From Bottom"), qsTr("Start Scan From Top") ]
Layout.columnSpan: 2
Layout.fillWidth: true
}
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
}
QGCLabel {
text: qsTr("Structure Height")
}
FactTextField {
fact: missionItem.structureHeight
Layout.fillWidth: true
}
CameraCalcGrid {
cameraCalc: missionItem.cameraCalc
vehicleFlightIsFrontal: false
distanceToSurfaceLabel: qsTr("Scan Distance")
distanceToSurfaceAltitudeMode: QGroundControl.AltitudeModeNone
frontalDistanceLabel: qsTr("Layer Height")
sideDistanceLabel: qsTr("Trigger Distance")
}
QGCLabel { text: qsTr("Scan Bottom Alt") }
AltitudeFactTextField {
fact: missionItem.scanBottomAlt
altitudeMode: QGroundControl.AltitudeModeRelative
Layout.fillWidth: true
}
SectionHeader {
id: scanHeader
text: qsTr("Scan")
}
QGCLabel { text: qsTr("Entrance/Exit Alt") }
AltitudeFactTextField {
fact: missionItem.entranceAlt
altitudeMode: QGroundControl.AltitudeModeRelative
Layout.fillWidth: true
Column {
anchors.left: parent.left
anchors.right: parent.right
spacing: _margin
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 {
text: qsTr("Gimbal Pitch")
visible: missionItem.cameraCalc.isManualCamera
}
FactTextField {
fact: missionItem.gimbalPitch
Layout.fillWidth: true
visible: missionItem.cameraCalc.isManualCamera
Item {
height: ScreenTools.defaultFontPixelHeight / 2
width: 1
}
}
Item {
height: ScreenTools.defaultFontPixelHeight / 2
width: 1
}
QGCButton {
text: qsTr("Rotate entry point")
onClicked: missionItem.rotateEntryPoint()
}
} // Column - Scan
QGCButton {
text: qsTr("Rotate entry point")
onClicked: missionItem.rotateEntryPoint()
SectionHeader {
id: statsHeader
text: qsTr("Statistics")
}
} // Column - Scan
SectionHeader {
id: statsHeader
text: qsTr("Statistics")
}
Grid {
columns: 2
columnSpacing: ScreenTools.defaultFontPixelWidth
visible: statsHeader.checked
Grid {
columns: 2
columnSpacing: ScreenTools.defaultFontPixelWidth
visible: statsHeader.checked
QGCLabel { text: qsTr("Layers") }
QGCLabel { text: missionItem.layers.valueString }
QGCLabel { text: qsTr("Layers") }
QGCLabel { text: missionItem.layers.valueString }
QGCLabel { text: qsTr("Layer Height") }
QGCLabel { text: missionItem.cameraCalc.adjustedFootprintFrontal.valueString + " " + QGroundControl.appSettingsDistanceUnitsString }
QGCLabel { text: qsTr("Layer Height") }
QGCLabel { text: missionItem.cameraCalc.adjustedFootprintFrontal.valueString + " " + QGroundControl.appSettingsDistanceUnitsString }
QGCLabel { text: qsTr("Top Layer Alt") }
QGCLabel { text: QGroundControl.metersToAppSettingsDistanceUnits(missionItem.topFlightAlt).toFixed(1) + " " + QGroundControl.appSettingsDistanceUnitsString }
QGCLabel { text: qsTr("Top Layer Alt") }
QGCLabel { text: QGroundControl.metersToAppSettingsDistanceUnits(missionItem.topFlightAlt).toFixed(1) + " " + QGroundControl.appSettingsDistanceUnitsString }
QGCLabel { text: qsTr("Bottom Layer Alt") }
QGCLabel { text: QGroundControl.metersToAppSettingsDistanceUnits(missionItem.bottomFlightAlt).toFixed(1) + " " + QGroundControl.appSettingsDistanceUnitsString }
QGCLabel { text: qsTr("Bottom Layer Alt") }
QGCLabel { text: QGroundControl.metersToAppSettingsDistanceUnits(missionItem.bottomFlightAlt).toFixed(1) + " " + QGroundControl.appSettingsDistanceUnitsString }
QGCLabel { text: qsTr("Photo Count") }
QGCLabel { text: missionItem.cameraShots }
QGCLabel { text: qsTr("Photo Count") }
QGCLabel { text: missionItem.cameraShots }
QGCLabel { text: qsTr("Photo Interval") }
QGCLabel { text: missionItem.timeBetweenShots.toFixed(1) + " " + qsTr("secs") }
QGCLabel { text: qsTr("Photo Interval") }
QGCLabel { text: missionItem.timeBetweenShots.toFixed(1) + " " + qsTr("secs") }
QGCLabel { text: qsTr("Trigger Distance") }
QGCLabel { text: missionItem.cameraCalc.adjustedFootprintSide.valueString + " " + QGroundControl.appSettingsDistanceUnitsString }
}
} // Grid Column
QGCLabel { text: qsTr("Trigger Distance") }
QGCLabel { text: missionItem.cameraCalc.adjustedFootprintSide.valueString + " " + QGroundControl.appSettingsDistanceUnitsString }
}
} // Grid Column
Column {
anchors.left: parent.left
anchors.right: parent.right
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")
Column {
anchors.left: parent.left
anchors.right: parent.right
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
}
......@@ -18,7 +18,7 @@ import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FlightMap 1.0
/// Survey Complex Mission Item visuals
/// Structure Scan Complex Mission Item visuals
Item {
id: _root
......@@ -34,54 +34,11 @@ Item {
objMgr.createObjects([entryPointComponent, exitPointComponent], map, true /* parentObjectIsMap */)
}
function _destroyVisualElements() {
objMgr.destroyObjects()
}
/// Add an initial 4 sided polygon if there is none
function _addInitialPolygon() {
if (_structurePolygon.count < 3) {
// Initial polygon is inset to take 2/3rds space
var rect = Qt.rect(map.centerViewport.x, map.centerViewport.y, map.centerViewport.width, map.centerViewport.height)
rect.x += (rect.width * 0.25) / 2
rect.y += (rect.height * 0.25) / 2
rect.width *= 0.75
rect.height *= 0.75
var centerCoord = map.toCoordinate(Qt.point(rect.x + (rect.width / 2), rect.y + (rect.height / 2)), false /* clipToViewPort */)
var topLeftCoord = map.toCoordinate(Qt.point(rect.x, rect.y), false /* clipToViewPort */)
var topRightCoord = map.toCoordinate(Qt.point(rect.x + rect.width, rect.y), false /* clipToViewPort */)
var bottomLeftCoord = map.toCoordinate(Qt.point(rect.x, rect.y + rect.height), false /* clipToViewPort */)
var bottomRightCoord = map.toCoordinate(Qt.point(rect.x + rect.width, rect.y + rect.height), false /* clipToViewPort */)
// Adjust polygon to max size
var maxSize = 100
var halfWidthMeters = Math.min(topLeftCoord.distanceTo(topRightCoord), maxSize) / 2
var halfHeightMeters = Math.min(topLeftCoord.distanceTo(bottomLeftCoord), maxSize) / 2
topLeftCoord = centerCoord.atDistanceAndAzimuth(halfWidthMeters, -90).atDistanceAndAzimuth(halfHeightMeters, 0)
topRightCoord = centerCoord.atDistanceAndAzimuth(halfWidthMeters, 90).atDistanceAndAzimuth(halfHeightMeters, 0)
bottomLeftCoord = centerCoord.atDistanceAndAzimuth(halfWidthMeters, -90).atDistanceAndAzimuth(halfHeightMeters, 180)
bottomRightCoord = centerCoord.atDistanceAndAzimuth(halfWidthMeters, 90).atDistanceAndAzimuth(halfHeightMeters, 180)
_structurePolygon.appendVertex(topLeftCoord)
_structurePolygon.appendVertex(topRightCoord)
_structurePolygon.appendVertex(bottomRightCoord)
_structurePolygon.appendVertex(bottomLeftCoord)
}
}
Component.onCompleted: {
_addInitialPolygon()
_addVisualElements()
}
Component.onDestruction: {
_destroyVisualElements()
}
QGCDynamicObjectManager {
id: objMgr
}
QGCDynamicObjectManager { id: objMgr }
QGCMapPolygonVisuals {
mapControl: map
......
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