Commit fa6684ff authored by Gus Grubba's avatar Gus Grubba

Make "required" rules to be selected by default and you cannot change it.

Fix sorting issues with QmlObjectListModel
Show airspaces in Plan View as well
parent 01ac7e82
...@@ -93,7 +93,9 @@ AirMapAdvisoryManager::_requestAdvisories() ...@@ -93,7 +93,9 @@ AirMapAdvisoryManager::_requestAdvisories()
qCDebug(AirMapManagerLog) << "Adding advisory" << pAdvisory->name(); qCDebug(AirMapManagerLog) << "Adding advisory" << pAdvisory->name();
} }
//-- Sort in order of color (priority) //-- Sort in order of color (priority)
_airspaces.beginReset();
std::sort(_airspaces.objectList()->begin(), _airspaces.objectList()->end(), adv_sort); std::sort(_airspaces.objectList()->begin(), _airspaces.objectList()->end(), adv_sort);
_airspaces.endReset();
_valid = true; _valid = true;
} else { } else {
qCDebug(AirMapManagerLog) << "Advisories Request Failed"; qCDebug(AirMapManagerLog) << "Advisories Request Failed";
......
...@@ -71,6 +71,7 @@ void AirMapRulesetsManager::setROI(const QGeoCoordinate& center) ...@@ -71,6 +71,7 @@ void AirMapRulesetsManager::setROI(const QGeoCoordinate& center)
break; break;
case RuleSet::SelectionType::required: case RuleSet::SelectionType::required:
pRule->_selectionType = AirspaceRule::Required; pRule->_selectionType = AirspaceRule::Required;
pRule->_selected = true;
break; break;
default: default:
case RuleSet::SelectionType::optional: case RuleSet::SelectionType::optional:
......
...@@ -470,6 +470,7 @@ Item { ...@@ -470,6 +470,7 @@ Item {
delegate: RuleSelector { delegate: RuleSelector {
visible: object.selectionType === AirspaceRule.Required visible: object.selectionType === AirspaceRule.Required
rule: object rule: object
required: true
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: ScreenTools.defaultFontPixelWidth anchors.rightMargin: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left anchors.left: parent.left
......
## To be deleted when development is complete ## To be deleted when development is complete
* "Required" rules must be pre-selectd and cannot be unselected by the user * Traffic monitor timeout is now set to 2 minutes following instructions from Thomas Voß.
* AirMapRestrictionManager seems to be incomplete (if not redundant). Shouldn't we use the array of AirSpace items returned by AirMapAdvisoryManager instead? In addition to the AirSpace object, it gives you a color to use in order of importance. * Group rules jurisdictions
* Traffic monitor timeout is now set to 2 minutes following instructions from Thomas Voß. * Check rules sorting order. Repopulating QmlObjectListModel causes the repeater to show the contents in random order.
* Check rules sorting order * ~AirMapRestrictionManager seems to be incomplete (if not redundant). Shouldn't we use the array of AirSpace items returned by AirMapAdvisoryManager instead? In addition to the AirSpace object, it gives you a color to use in order of importance.~ See question below.
* Group rules jurisdictions * ~"Required" rules must be pre-selectd and cannot be unselected by the user~
* ~Add a "Wrong Way" icon to the airspace widget when not connected~ * ~Add a "Wrong Way" icon to the airspace widget when not connected~
Questions:
Given a same set of coordinates, what is the relationship between the `Airspace` elements returned by `Airspaces::Search` and those returned by `Status::GetStatus` (Advisories)? The former don’t have a “color”. The latter do but those don’t have any geometry. In addition, given two identical set of arguments (coordinates), the resulting sets are not the same. A given airspace may also be repeated several times with different “levels”, such as an airport having several “green” and several “yellow” advisories (but no red or orange). How do you filter what to show on the screen?
Also, the main glaring airspace nearby, KRDU has one entry in Airspaces whose ID is not in the array returned by the advisories (and therefore no color to assign to it). In fact, KRDU shows up 20 times in Advisories and 11 times in Airspaces.
In summary, why do I have to make two requests to get two arrays of Airspaces, which should be mostly the same?
\ No newline at end of file
...@@ -17,6 +17,7 @@ Rectangle { ...@@ -17,6 +17,7 @@ Rectangle {
color: _selected ? qgcPal.windowShade : qgcPal.window color: _selected ? qgcPal.windowShade : qgcPal.window
property var rule: null property var rule: null
property bool checked: false property bool checked: false
property bool required: false
property bool _selected: { property bool _selected: {
if (exclusiveGroup) { if (exclusiveGroup) {
return checked return checked
...@@ -57,7 +58,8 @@ Rectangle { ...@@ -57,7 +58,8 @@ Rectangle {
} }
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
enabled: !required
onClicked: { onClicked: {
if (exclusiveGroup) { if (exclusiveGroup) {
checked = true checked = true
......
...@@ -59,6 +59,7 @@ QGCView { ...@@ -59,6 +59,7 @@ QGCView {
property real _toolbarHeight: _qgcView.height - ScreenTools.availableHeight property real _toolbarHeight: _qgcView.height - ScreenTools.availableHeight
property int _editingLayer: _layerMission property int _editingLayer: _layerMission
property int _toolStripBottom: toolStrip.height + toolStrip.y property int _toolStripBottom: toolStrip.height + toolStrip.y
property bool _airspaceManagement: QGroundControl.airmapSupported && _activeVehicle
readonly property int _layerMission: 1 readonly property int _layerMission: 1
readonly property int _layerGeoFence: 2 readonly property int _layerGeoFence: 2
...@@ -348,6 +349,12 @@ QGCView { ...@@ -348,6 +349,12 @@ QGCView {
QGCMapPalette { id: mapPal; lightColors: editorMap.isSatelliteMap } QGCMapPalette { id: mapPal; lightColors: editorMap.isSatelliteMap }
onCenterChanged: {
if(_activeVehicle && QGroundControl.airmapSupported) {
_activeVehicle.airspaceController.setROI(center, 5000)
}
}
MouseArea { MouseArea {
//-- It's a whole lot faster to just fill parent and deal with top offset below //-- It's a whole lot faster to just fill parent and deal with top offset below
// than computing the coordinate offset. // than computing the coordinate offset.
...@@ -427,6 +434,26 @@ QGCView { ...@@ -427,6 +434,26 @@ QGCView {
planView: true planView: true
} }
// Airspace overlap support
MapItemView {
model: _airspaceManagement && _activeVehicle.airspaceController.airspaceVisible ? _activeVehicle.airspaceController.airspaces.circles : []
delegate: MapCircle {
center: object.center
radius: object.radius
color: Qt.rgba(0.94, 0.87, 0, 0.1)
border.color: Qt.rgba(1,1,1,0.65)
}
}
MapItemView {
model: _airspaceManagement && _activeVehicle.airspaceController.airspaceVisible ? _activeVehicle.airspaceController.airspaces.polygons : []
delegate: MapPolygon {
path: object.polygon
color: Qt.rgba(0.94, 0.87, 0, 0.1)
border.color: Qt.rgba(1,1,1,0.65)
}
}
ToolStrip { ToolStrip {
id: toolStrip id: toolStrip
anchors.leftMargin: ScreenTools.defaultFontPixelWidth anchors.leftMargin: ScreenTools.defaultFontPixelWidth
......
...@@ -226,8 +226,10 @@ void QmlObjectListModel::deleteListAndContents(void) ...@@ -226,8 +226,10 @@ void QmlObjectListModel::deleteListAndContents(void)
void QmlObjectListModel::clearAndDeleteContents(void) void QmlObjectListModel::clearAndDeleteContents(void)
{ {
beginResetModel();
for (int i=0; i<_objectList.count(); i++) { for (int i=0; i<_objectList.count(); i++) {
_objectList[i]->deleteLater(); _objectList[i]->deleteLater();
} }
clear(); clear();
endResetModel();
} }
...@@ -50,10 +50,13 @@ public: ...@@ -50,10 +50,13 @@ public:
template<class T> T value(int index) { return qobject_cast<T>(_objectList[index]); } template<class T> T value(int index) { return qobject_cast<T>(_objectList[index]); }
/// Calls deleteLater on all items and this itself. /// Calls deleteLater on all items and this itself.
void deleteListAndContents(void); void deleteListAndContents (void);
/// Clears the list and calls deleteLater on each entry /// Clears the list and calls deleteLater on each entry
void clearAndDeleteContents(void); void clearAndDeleteContents (void);
void beginReset () { beginResetModel(); }
void endReset () { endResetModel(); }
signals: signals:
void countChanged (int count); void countChanged (int count);
......
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