Commit a6cffd54 authored by Don Gagne's avatar Don Gagne

Merge pull request #2841 from DonLakeFlyer/Gradient

Plan: Add Gradient to bottom item status
parents f1075263 fd7afab6
......@@ -34,7 +34,7 @@ Rectangle {
property real expandedWidth ///< Width of control when expanded
width: _expanded ? expandedWidth : _collapsedWidth
height: expandLabel.y + expandLabel.height + _margins
height: azimuthLabel.y + azimuthLabel.height + _margins
radius: ScreenTools.defaultFontPixelWidth
color: qgcPal.window
opacity: 0.80
......@@ -44,13 +44,16 @@ Rectangle {
property real _collapsedWidth: distanceLabel.width + (margins * 2)
property bool _expanded: true
property real _distance: _currentMissionItem ? _currentMissionItem.distance : -1
property real _altDifference: _currentMissionItem ? _currentMissionItem.altDifference : -1
property real _azimuth: _currentMissionItem ? _currentMissionItem.azimuth : -1
property real _isHomePosition: _currentMissionItem ? _currentMissionItem.homePosition : false
property bool _statusValid: _distance != -1
property string _distanceText: _statusValid ? Math.round(_distance) + " meters" : ""
property string _altText: _statusValid ? Math.round(_altDifference) + " meters" : ""
property real _distance: _statusValid ? _currentMissionItem.distance : 0
property real _altDifference: _statusValid ? _currentMissionItem.altDifference : 0
property real _gradient: _statusValid ? Math.atan(_currentMissionItem.altDifference / _currentMissionItem.distance) : 0
property real _gradientPercent: isNaN(_gradient) ? 0 : _gradient * 100
property real _azimuth: _statusValid ? _currentMissionItem.azimuth : -1
property real _isHomePosition: _statusValid ? _currentMissionItem.homePosition : false
property bool _statusValid: currentMissionItem != undefined
property string _distanceText: _statusValid ? _distance.toFixed(2) + " m" : ""
property string _altText: _statusValid ? _altDifference.toFixed(2) + " m" : ""
property string _gradientText: _statusValid ? _gradientPercent.toFixed(0) + "%" : ""
property string _azimuthText: _statusValid ? Math.round(_azimuth) : ""
readonly property real _margins: ScreenTools.defaultFontPixelWidth
......@@ -76,17 +79,17 @@ Rectangle {
}
QGCLabel {
id: azimuthLabel
anchors.left: altLabel.left
id: gradientLabel
anchors.left: distanceLabel.left
anchors.top: altLabel.bottom
text: "Azimuth: " + _azimuthText
text: "Gradient: " + _gradientText
}
QGCLabel {
id: expandLabel
anchors.left: azimuthLabel.left
anchors.top: azimuthLabel.bottom
text: _expanded ? "<<" : ">>"
id: azimuthLabel
anchors.left: distanceLabel.left
anchors.top: gradientLabel.bottom
text: "Azimuth: " + _azimuthText
}
QGCFlickable {
......@@ -128,12 +131,15 @@ Rectangle {
visible: object.relativeAltitude ? true : (object.homePosition || graphAbsolute)
}
/*
Taking these off for now since there really isn't room for the numbers
QGCLabel {
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: ScreenTools.smallFontPixelSize
text: (object.relativeAltitude ? "" : "=") + object.coordinate.altitude
text: (object.relativeAltitude ? "" : "=") + object.coordinate.altitude.toFixed(0)
}
*/
}
}
......
......@@ -778,7 +778,8 @@ bool MissionController::_findLastAltitude(double* lastAltitude)
bool found = false;
double foundAltitude;
for (int i=0; i<_missionItems->count(); i++) {
// Don't use home position
for (int i=1; i<_missionItems->count(); i++) {
MissionItem* item = qobject_cast<MissionItem*>(_missionItems->get(i));
if (item->specifiesCoordinate() && !item->standaloneCoordinate()) {
......
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