Commit ede85754 authored by Don Gagne's avatar Don Gagne

parent 81955d82
......@@ -342,8 +342,10 @@ void GeoFenceController::_setReturnPointFromManager(QGeoCoordinate breachReturnP
void GeoFenceController::_managerLoadComplete(void)
{
// Fly view always reloads on _loadComplete
// Plan view only reloads on _loadComplete if specifically requested
if (_flyView || _itemsRequested) {
// Plan view only reloads if:
// - Load was specifically requested
// - There is no current Plan
if (_flyView || _itemsRequested || isEmpty()) {
_setReturnPointFromManager(_geoFenceManager->breachReturnPoint());
_setFenceFromManager(_geoFenceManager->polygons(), _geoFenceManager->circles());
setDirty(false);
......@@ -519,3 +521,9 @@ void GeoFenceController::_parametersReady(void)
connect(_px4ParamCircularFenceFact, &Fact::rawValueChanged, this, &GeoFenceController::paramCircularFenceChanged);
emit paramCircularFenceChanged();
}
bool GeoFenceController::isEmpty(void) const
{
return _polygons.count() == 0 && _circles.count() == 0 && !_breachReturnPoint.isValid();
}
......@@ -82,7 +82,8 @@ public:
QmlObjectListModel* circles (void) { return &_circles; }
QGeoCoordinate breachReturnPoint (void) const { return _breachReturnPoint; }
void setBreachReturnPoint(const QGeoCoordinate& breachReturnPoint);
void setBreachReturnPoint (const QGeoCoordinate& breachReturnPoint);
bool isEmpty (void) const;
signals:
void breachReturnPointChanged (QGeoCoordinate breachReturnPoint);
......
......@@ -148,8 +148,10 @@ void MissionController::_newMissionItemsAvailableFromVehicle(bool removeAllReque
qCDebug(MissionControllerLog) << "_newMissionItemsAvailableFromVehicle flyView:count" << _flyView << _missionManager->missionItems().count();
// Fly view always reloads on _loadComplete
// Plan view only reloads on _loadComplete if specifically requested
if (_flyView || removeAllRequested || _itemsRequested || _visualItems->count() <= 1) {
// Plan view only reloads if:
// - Load was specifically requested
// - There is no current Plan
if (_flyView || removeAllRequested || _itemsRequested || isEmpty()) {
// Fly Mode (accept if):
// - Always accepts new items from the vehicle so Fly view is kept up to date
// Edit Mode (accept if):
......@@ -2174,3 +2176,8 @@ void MissionController::_complexBoundingBoxChanged()
{
_updateTimer.start(UPDATE_TIMEOUT);
}
bool MissionController::isEmpty(void) const
{
return _visualItems->count() <= 1;
}
......@@ -196,6 +196,8 @@ public:
int batteryChangePoint (void) const { return _missionFlightStatus.batteryChangePoint; } ///< -1 for not supported, 0 for not needed
int batteriesRequired (void) const { return _missionFlightStatus.batteriesRequired; } ///< -1 for not supported
bool isEmpty (void) const;
// These are the names shown in the UI for the pattern items. They are public so custom builds can remove the ones
// they don't want through the QGCCorePlugin::
static const QString patternFWLandingName;
......
......@@ -576,3 +576,10 @@ bool PlanMasterController::syncInProgress(void) const
_geoFenceController.syncInProgress() ||
_rallyPointController.syncInProgress();
}
bool PlanMasterController::isEmpty(void) const
{
return _missionController.isEmpty() &&
_geoFenceController.isEmpty() &&
_rallyPointController.isEmpty();
}
......@@ -84,6 +84,7 @@ public:
QString currentPlanFile (void) const { return _currentPlanFile; }
QStringList loadNameFilters (void) const;
QStringList saveNameFilters (void) const;
bool isEmpty (void) const;
QJsonDocument saveToJson ();
......
......@@ -202,8 +202,10 @@ QString RallyPointController::editorQml(void) const
void RallyPointController::_managerLoadComplete(void)
{
// Fly view always reloads on _loadComplete
// Plan view only reloads on _loadComplete if specifically requested
if (_flyView || _itemsRequested) {
// Plan view only reloads if:
// - Load was specifically requested
// - There is no current Plan
if (_flyView || _itemsRequested || isEmpty()) {
_points.clearAndDeleteContents();
QObjectList pointList;
for (int i=0; i<_rallyPointManager->points().count(); i++) {
......@@ -318,3 +320,8 @@ bool RallyPointController::showPlanFromManagerVehicle (void)
}
}
}
bool RallyPointController::isEmpty(void) const
{
return _points.count() == 0;
}
......@@ -54,7 +54,8 @@ public:
QString editorQml (void) const;
QObject* currentRallyPoint (void) const { return _currentRallyPoint; }
void setCurrentRallyPoint(QObject* rallyPoint);
void setCurrentRallyPoint (QObject* rallyPoint);
bool isEmpty (void) const;
signals:
void currentRallyPointChanged(QObject* rallyPoint);
......
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