Commit 1baa72ac authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #4914 from DonLakeFlyer/PlanGeoFence

Fix plan view geofence display
parents eaaeab0c e5d8d11c
......@@ -1228,6 +1228,7 @@ void MissionController::_initAllVisualItems(void)
}
connect(_settingsItem, &MissionSettingsItem::coordinateChanged, this, &MissionController::_recalcAll);
connect(_settingsItem, &MissionSettingsItem::coordinateChanged, this, &MissionController::plannedHomePositionChanged);
for (int i=0; i<_visualItems->count(); i++) {
VisualMissionItem* item = qobject_cast<VisualMissionItem*>(_visualItems->get(i));
......@@ -1241,12 +1242,16 @@ void MissionController::_initAllVisualItems(void)
emit visualItemsChanged();
emit containsItemsChanged(containsItems());
emit plannedHomePositionChanged(plannedHomePosition());
_visualItems->setDirty(false);
}
void MissionController::_deinitAllVisualItems(void)
{
disconnect(_settingsItem, &MissionSettingsItem::coordinateChanged, this, &MissionController::_recalcAll);
disconnect(_settingsItem, &MissionSettingsItem::coordinateChanged, this, &MissionController::plannedHomePositionChanged);
for (int i=0; i<_visualItems->count(); i++) {
_deinitVisualItem(qobject_cast<VisualMissionItem*>(_visualItems->get(i)));
}
......@@ -1583,3 +1588,12 @@ void MissionController::resumeMission(int resumeIndex)
}
_activeVehicle->missionManager()->generateResumeMission(resumeIndex);
}
QGeoCoordinate MissionController::plannedHomePosition(void) const
{
if (_settingsItem) {
return _settingsItem->coordinate();
} else {
return QGeoCoordinate();
}
}
......@@ -62,6 +62,7 @@ public:
Q_PROPERTY(QmlObjectListModel* visualItems READ visualItems NOTIFY visualItemsChanged)
Q_PROPERTY(QmlObjectListModel* waypointLines READ waypointLines NOTIFY waypointLinesChanged)
Q_PROPERTY(QStringList complexMissionItemNames READ complexMissionItemNames NOTIFY complexMissionItemNamesChanged)
Q_PROPERTY(QGeoCoordinate plannedHomePosition READ plannedHomePosition NOTIFY plannedHomePositionChanged)
Q_PROPERTY(int resumeMissionItem READ resumeMissionItem NOTIFY resumeMissionItemChanged)
......@@ -123,6 +124,7 @@ public:
QmlObjectListModel* visualItems (void) { return _visualItems; }
QmlObjectListModel* waypointLines (void) { return &_waypointLines; }
QStringList complexMissionItemNames (void) const;
QGeoCoordinate plannedHomePosition (void) const;
/// Returns the item index two which a mission should be resumed. -1 indicates resume mission not available.
int resumeMissionItem(void) const;
......@@ -154,6 +156,7 @@ signals:
void resumeMissionReady(void);
void batteryChangePointChanged(int batteryChangePoint);
void batteriesRequiredChanged(int batteriesRequired);
void plannedHomePositionChanged(QGeoCoordinate plannedHomePosition);
private slots:
void _newMissionItemsAvailableFromVehicle(bool removeAllRequested);
......
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