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

Finalizing flight brief rules UI

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