Commit bdb044df authored by Gus Grubba's avatar Gus Grubba

Show flight area on map when listing flights

Add message asking user confirmation to end a flight
parent 15b2bde0
......@@ -58,7 +58,7 @@ adv_sort(QObject* a, QObject* b)
void
AirMapAdvisoryManager::_requestAdvisories()
{
qCDebug(AirMapManagerLog) << "Advisories Request";
qCDebug(AirMapManagerLog) << "Advisories Request (ROI Changed)";
if (!_shared.client()) {
qCDebug(AirMapManagerLog) << "No AirMap client instance. Not updating Advisories";
_valid = false;
......
......@@ -37,9 +37,9 @@ AirMapManager::AirMapManager(QGCApplication* app, QGCToolbox* toolbox)
{
_logger = std::make_shared<qt::Logger>();
qt::register_types(); // TODO: still needed?
_logger->logging_category().setEnabled(QtDebugMsg, true);
_logger->logging_category().setEnabled(QtInfoMsg, true);
_logger->logging_category().setEnabled(QtWarningMsg, true);
_logger->logging_category().setEnabled(QtDebugMsg, false);
_logger->logging_category().setEnabled(QtInfoMsg, false);
_logger->logging_category().setEnabled(QtWarningMsg, false);
_dispatchingLogger = std::make_shared<qt::DispatchingLogger>(_logger);
connect(&_shared, &AirMapSharedState::error, this, &AirMapManager::_error);
}
......
......@@ -49,7 +49,7 @@ AirMapRestrictionManager::_requestRestrictions(const QGCGeoBoundingCube& roi)
qCWarning(AirMapManagerLog) << "AirMapRestrictionManager::updateROI: state not idle";
return;
}
qCDebug(AirMapManagerLog) << "Setting Restriction Manager ROI";
qCDebug(AirMapManagerLog) << "Restrictions Request (ROI Changed)";
_polygons.clear();
_circles.clear();
_state = State::RetrieveItems;
......
......@@ -199,7 +199,7 @@ void AirMapRulesetsManager::setROI(const QGCGeoBoundingCube& roi)
qCWarning(AirMapManagerLog) << "AirMapRulesetsManager::updateROI: state not idle";
return;
}
qCDebug(AirMapManagerLog) << "Setting ROI for Rulesets";
qCDebug(AirMapManagerLog) << "Rulesets Request (ROI Changed)";
_valid = false;
_ruleSets.clearAndDeleteContents();
_state = State::RetrieveItems;
......
......@@ -42,7 +42,7 @@ AirMapWeatherInfoManager::setROI(const QGCGeoBoundingCube& roi)
void
AirMapWeatherInfoManager::_requestWeatherUpdate(const QGeoCoordinate& coordinate)
{
qCDebug(AirMapManagerLog) << "Request Weather";
qCDebug(AirMapManagerLog) << "Weather Request (ROI Changed)";
if (!_shared.client()) {
qCDebug(AirMapManagerLog) << "No AirMap client instance. Not updating Weather information";
_valid = false;
......
......@@ -306,14 +306,10 @@ QGCView {
selectionMode: SelectionMode.SingleSelection
Layout.fillWidth: true
onCurrentRowChanged: {
map.fitViewportToMapItems()
var o = _flightList.get(tableView.currentRow)
if(o) {
console.log(o.boundingBox.count)
console.log(o.boundingBox)
console.log(o.flightID)
} else {
console.log('No bounding box')
flightArea.path = o.boundingBox
map.fitViewportToMapItems()
}
}
TableViewColumn {
......@@ -516,9 +512,24 @@ QGCView {
}
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
var o = _flightList.get(tableView.currentRow)
if(o) {
QGroundControl.airspaceManager.flightPlan.endFlight(o.flightID)
endFlightDialog.visible = true
}
MessageDialog {
id: endFlightDialog
visible: false
icon: StandardIcon.Warning
standardButtons: StandardButton.Yes | StandardButton.No
title: qsTr("End Flight")
text: qsTr("Confirm ending active flight?")
onYes: {
var o = _flightList.get(tableView.currentRow)
if(o) {
QGroundControl.airspaceManager.flightPlan.endFlight(o.flightID)
}
endFlightDialog.visible = false
}
onNo: {
endFlightDialog.visible = false
}
}
}
......@@ -573,19 +584,10 @@ QGCView {
}
}
}
MapItemView {
model: {
var o = _flightList.get(tableView.currentRow)
if(o) {
return o.boundingBox
}
return []
}
delegate: MapPolygon {
path: object
color: Qt.rgba(1,0,0,0.2)
border.color: Qt.rgba(1,1,1,0.65)
}
MapPolygon {
id: flightArea
color: Qt.rgba(1,0,0,0.2)
border.color: Qt.rgba(1,1,1,0.65)
}
Component.onCompleted: {
updateActiveMapType()
......
......@@ -105,13 +105,13 @@ void
AirspaceFlightModel::clear(void)
{
if(!_flightEntries.isEmpty()) {
beginRemoveRows(QModelIndex(), 0, _flightEntries.count());
beginResetModel();
while (_flightEntries.count()) {
AirspaceFlightInfo* entry = _flightEntries.last();
if(entry) entry->deleteLater();
_flightEntries.removeLast();
}
endRemoveRows();
endResetModel();
emit countChanged();
}
}
......
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