Skip to content
Snippets Groups Projects
Commit 042f02b5 authored by DonLakeFlyer's avatar DonLakeFlyer
Browse files

Show landing area

parent 65ebabe4
No related branches found
No related tags found
No related merge requests found
...@@ -37,6 +37,7 @@ Item { ...@@ -37,6 +37,7 @@ Item {
readonly property int _loiterPointIndex: 1 readonly property int _loiterPointIndex: 1
readonly property int _loiterRadiusIndex: 2 readonly property int _loiterRadiusIndex: 2
readonly property int _landPointIndex: 3 readonly property int _landPointIndex: 3
readonly property int _landingAreaIndex: 4
function hideItemVisuals() { function hideItemVisuals() {
for (var i=0; i<_itemVisuals.length; i++) { for (var i=0; i<_itemVisuals.length; i++) {
...@@ -59,6 +60,9 @@ Item { ...@@ -59,6 +60,9 @@ Item {
itemVisual = landPointComponent.createObject(map) itemVisual = landPointComponent.createObject(map)
map.addMapItem(itemVisual) map.addMapItem(itemVisual)
_itemVisuals[_landPointIndex] = itemVisual _itemVisuals[_landPointIndex] = itemVisual
itemVisual = landingAreaComponent.createObject(map)
map.addMapItem(itemVisual)
_itemVisuals[_landingAreaIndex] = itemVisual
} }
} }
...@@ -218,7 +222,6 @@ Item { ...@@ -218,7 +222,6 @@ Item {
} }
} }
// Loiter radius visual
Component { Component {
id: loiterRadiusComponent id: loiterRadiusComponent
...@@ -232,7 +235,6 @@ Item { ...@@ -232,7 +235,6 @@ Item {
} }
} }
// Land point
Component { Component {
id: landPointComponent id: landPointComponent
...@@ -252,4 +254,24 @@ Item { ...@@ -252,4 +254,24 @@ Item {
} }
} }
} }
Component {
id: landingAreaComponent
MapRectangle {
z: QGroundControl.zOrderMapItems
border.width: 1
border.color: "black"
color: "green"
opacity: 0.5
topLeft: _missionItem.landingCoordinate.atDistanceAndAzimuth(hypotenuse, -angleDegrees)
bottomRight: _missionItem.landingCoordinate.atDistanceAndAzimuth(hypotenuse, 180 - angleDegrees)
readonly property real landingWidth: 10
readonly property real landingLength: 100
readonly property real angleRadians: Math.atan((landingWidth / 2) / (landingLength / 2))
readonly property real angleDegrees: angleRadians * (180 / Math.PI)
readonly property real hypotenuse: (landingWidth / 2) / Math.sin(angleRadians)
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment