Commit 5d111753 authored by Gus Grubba's avatar Gus Grubba

Finalizing flight brief rules UI

parent f109339e
......@@ -142,7 +142,7 @@ AirMapFlightPlanManager::_createFlightPlan()
qCDebug(AirMapManagerLog) << "Flight End: " << _flightEndTime;
//-- Not Yet
return;
//return;
if (_pilotID == "") {
//-- Need to get the pilot id before uploading the flight plan
......@@ -190,6 +190,7 @@ AirMapFlightPlanManager::_uploadFlightPlan()
if (_state != State::FlightUpload) return;
FlightPlans::Create::Parameters params;
params.max_altitude = _flight.maxAltitude;
params.min_altitude = 0.0;
params.buffer = 2.f;
params.latitude = _flight.takeoffCoord.latitude();
params.longitude = _flight.takeoffCoord.longitude();
......@@ -400,6 +401,10 @@ AirMapFlightPlanManager::_pollBriefing()
_advisories.endReset();
_valid = true;
//-- Collect Rulesets
_rulesViolation.clearAndDeleteContents();
_rulesInfo.clearAndDeleteContents();
_rulesReview.clearAndDeleteContents();
_rulesFollowing.clearAndDeleteContents();
for(const auto& ruleset : briefing.evaluation.rulesets) {
AirMapRuleSet* pRuleSet = new AirMapRuleSet(this);
pRuleSet->_id = QString::fromStdString(ruleset.id);
......@@ -412,13 +417,33 @@ AirMapFlightPlanManager::_pollBriefing()
pRule->_features.append(pFeature);
}
pRuleSet->_rules.append(pRule);
//-- Rules separated by status for presentation
switch(rule.status) {
case RuleSet::Rule::Status::conflicting:
_rulesViolation.append(new AirMapRule(rule, this));
break;
case RuleSet::Rule::Status::not_conflicting:
_rulesFollowing.append(new AirMapRule(rule, this));
break;
case RuleSet::Rule::Status::missing_info:
_rulesInfo.append(new AirMapRule(rule, this));
break;
case RuleSet::Rule::Status::informational:
_rulesReview.append(new AirMapRule(rule, this));
break;
default:
break;
}
}
//-- Sort rules by relevance order
pRuleSet->_rules.beginReset();
std::sort(pRuleSet->_rules.objectList()->begin(), pRuleSet->_rules.objectList()->end(), rules_sort);
pRuleSet->_rules.endReset();
_rulesets.append(pRuleSet);
qCDebug(AirMapManagerLog) << "Adding briefing ruleset" << pRuleSet->id();
}
emit advisoryChanged();
emit rulesChanged();
//-- Evaluate briefing status
bool rejected = false;
bool accepted = false;
......@@ -512,7 +537,7 @@ AirMapFlightPlanManager::_missionChanged()
_createFlightPlan();
} else {
//-- Plan is being modified
// _updateFlightPlan();
//_updateFlightPlan();
}
}
}
......@@ -39,6 +39,11 @@ public:
QGCGeoBoundingCube* missionArea () override { return &_flight.bc; }
AirspaceAdvisoryProvider::AdvisoryColor airspaceColor () override { return _airspaceColor; }
QmlObjectListModel* rulesViolation () override { return &_rulesViolation; }
QmlObjectListModel* rulesInfo () override { return &_rulesInfo; }
QmlObjectListModel* rulesReview () override { return &_rulesReview; }
QmlObjectListModel* rulesFollowing () override { return &_rulesFollowing; }
void startFlightPlanning (PlanMasterController* planController) override;
void setFlightStartTime (QDateTime start) override;
void setFlightEndTime (QDateTime end) override;
......@@ -91,6 +96,10 @@ private:
QDateTime _flightEndTime;
QmlObjectListModel _advisories;
QmlObjectListModel _rulesets;
QmlObjectListModel _rulesViolation;
QmlObjectListModel _rulesInfo;
QmlObjectListModel _rulesReview;
QmlObjectListModel _rulesFollowing;
AirspaceAdvisoryProvider::AdvisoryColor _airspaceColor;
AirspaceFlightPlanProvider::PermitStatus _flightPermitStatus = AirspaceFlightPlanProvider::PermitNone;
......
This diff is collapsed.
......@@ -13,27 +13,36 @@ import QGroundControl.SettingsManager 1.0
Item {
id: _root
height: ScreenTools.defaultFontPixelHeight * 2
property alias text: title.text
readonly property color _colorOrange: "#d75e0d"
readonly property color _colorYellow: "#d7c61d"
readonly property color _colorRed: "#aa1200"
readonly property color _colorGreen: "#125f00"
height: checked ? (header.height + content.height) : header.height
property var rules: null
property color color: "white"
property alias text: title.text
property bool checked: false
property ExclusiveGroup exclusiveGroup: null
onExclusiveGroupChanged: {
if (exclusiveGroup) {
exclusiveGroup.bindCheckable(_root)
}
}
QGCPalette {
id: qgcPal
colorGroupEnabled: enabled
}
Rectangle {
anchors.fill: parent
id: header
height: ScreenTools.defaultFontPixelHeight * 2
color: qgcPal.windowShade
anchors.top: parent.top
anchors.right: parent.right
anchors.left: parent.left
}
Row {
spacing: ScreenTools.defaultFontPixelWidth * 2
anchors.verticalCenter: parent.verticalCenter
anchors.fill: header
Rectangle {
height: _root.height
height: parent.height
width: ScreenTools.defaultFontPixelWidth * 0.75
color: _colorGreen
color: _root.color
}
QGCLabel {
id: title
......@@ -41,14 +50,75 @@ Item {
}
}
QGCColoredImage {
source: "qrc:/airmap/expand.svg"
source: checked ? "qrc:/airmap/colapse.svg" : "qrc:/airmap/expand.svg"
height: ScreenTools.defaultFontPixelHeight
width: height
color: qgcPal.text
fillMode: Image.PreserveAspectFit
sourceSize.height: height
anchors.right: parent.right
anchors.right: header.right
anchors.rightMargin: ScreenTools.defaultFontPixelWidth
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenter: header.verticalCenter
}
MouseArea {
anchors.fill: header
onClicked: {
_root.checked = !_root.checked
}
}
Rectangle {
id: content
color: qgcPal.window
visible: checked
height: ScreenTools.defaultFontPixelHeight * 10
anchors.top: header.bottom
anchors.right: parent.right
anchors.left: parent.left
anchors.margins: ScreenTools.defaultFontPixelWidth
Flickable {
clip: true
anchors.fill: parent
contentHeight: rulesetCol.height
flickableDirection: Flickable.VerticalFlick
Column {
id: rulesetCol
spacing: ScreenTools.defaultFontPixelHeight * 0.25
anchors.right: parent.right
anchors.left: parent.left
Repeater {
model: _root.rules ? _root.rules : []
delegate: Item {
height: ruleCol.height
anchors.right: parent.right
anchors.left: parent.left
anchors.margins: ScreenTools.defaultFontPixelWidth
Column {
id: ruleCol
spacing: ScreenTools.defaultFontPixelHeight * 0.5
anchors.right: parent.right
anchors.left: parent.left
Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 0.25; }
QGCLabel {
text: object.shortText !== "" ? object.shortText : qsTr("Rule")
anchors.right: parent.right
anchors.left: parent.left
wrapMode: Text.WordWrap
}
QGCLabel {
text: object.description
visible: object.description !== ""
font.pointSize: ScreenTools.smallFontPointSize
anchors.right: parent.right
anchors.left: parent.left
wrapMode: Text.WordWrap
anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 0.5
anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 0.5
}
}
}
}
Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 0.25; }
}
}
}
}
......@@ -49,6 +49,11 @@ public:
Q_PROPERTY(QGCGeoBoundingCube* missionArea READ missionArea NOTIFY missionAreaChanged)
Q_PROPERTY(AirspaceAdvisoryProvider::AdvisoryColor airspaceColor READ airspaceColor NOTIFY advisoryChanged)
Q_PROPERTY(QmlObjectListModel* rulesViolation READ rulesViolation NOTIFY rulesChanged)
Q_PROPERTY(QmlObjectListModel* rulesInfo READ rulesInfo NOTIFY rulesChanged)
Q_PROPERTY(QmlObjectListModel* rulesReview READ rulesReview NOTIFY rulesChanged)
Q_PROPERTY(QmlObjectListModel* rulesFollowing READ rulesFollowing NOTIFY rulesChanged)
virtual PermitStatus flightPermitStatus () const { return PermitNone; }
virtual QDateTime flightStartTime () const = 0;
virtual QDateTime flightEndTime () const = 0;
......@@ -58,6 +63,11 @@ public:
virtual QmlObjectListModel* ruleSets () = 0; ///< List of AirspaceRuleSet
virtual AirspaceAdvisoryProvider::AdvisoryColor airspaceColor () = 0; ///< Aispace overall color
virtual QmlObjectListModel* rulesViolation () = 0; ///< List of AirspaceRule in violation
virtual QmlObjectListModel* rulesInfo () = 0; ///< List of AirspaceRule need more information
virtual QmlObjectListModel* rulesReview () = 0; ///< List of AirspaceRule should review
virtual QmlObjectListModel* rulesFollowing () = 0; ///< List of AirspaceRule following
virtual void setFlightStartTime (QDateTime start) = 0;
virtual void setFlightEndTime (QDateTime end) = 0;
virtual void startFlightPlanning (PlanMasterController* planController) = 0;
......@@ -68,4 +78,5 @@ signals:
void flightEndTimeChanged ();
void advisoryChanged ();
void missionAreaChanged ();
void rulesChanged ();
};
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