Browse Source

Fix initial load for Plan view

QGC4.4
Don Gagne 6 years ago
parent
commit
ede8575448
  1. 12
      src/MissionManager/GeoFenceController.cc
  2. 3
      src/MissionManager/GeoFenceController.h
  3. 11
      src/MissionManager/MissionController.cc
  4. 2
      src/MissionManager/MissionController.h
  5. 7
      src/MissionManager/PlanMasterController.cc
  6. 1
      src/MissionManager/PlanMasterController.h
  7. 11
      src/MissionManager/RallyPointController.cc
  8. 3
      src/MissionManager/RallyPointController.h

12
src/MissionManager/GeoFenceController.cc

@ -342,8 +342,10 @@ void GeoFenceController::_setReturnPointFromManager(QGeoCoordinate breachReturnP
void GeoFenceController::_managerLoadComplete(void) void GeoFenceController::_managerLoadComplete(void)
{ {
// Fly view always reloads on _loadComplete // Fly view always reloads on _loadComplete
// Plan view only reloads on _loadComplete if specifically requested // Plan view only reloads if:
if (_flyView || _itemsRequested) { // - Load was specifically requested
// - There is no current Plan
if (_flyView || _itemsRequested || isEmpty()) {
_setReturnPointFromManager(_geoFenceManager->breachReturnPoint()); _setReturnPointFromManager(_geoFenceManager->breachReturnPoint());
_setFenceFromManager(_geoFenceManager->polygons(), _geoFenceManager->circles()); _setFenceFromManager(_geoFenceManager->polygons(), _geoFenceManager->circles());
setDirty(false); setDirty(false);
@ -519,3 +521,9 @@ void GeoFenceController::_parametersReady(void)
connect(_px4ParamCircularFenceFact, &Fact::rawValueChanged, this, &GeoFenceController::paramCircularFenceChanged); connect(_px4ParamCircularFenceFact, &Fact::rawValueChanged, this, &GeoFenceController::paramCircularFenceChanged);
emit paramCircularFenceChanged(); emit paramCircularFenceChanged();
} }
bool GeoFenceController::isEmpty(void) const
{
return _polygons.count() == 0 && _circles.count() == 0 && !_breachReturnPoint.isValid();
}

3
src/MissionManager/GeoFenceController.h

@ -82,7 +82,8 @@ public:
QmlObjectListModel* circles (void) { return &_circles; } QmlObjectListModel* circles (void) { return &_circles; }
QGeoCoordinate breachReturnPoint (void) const { return _breachReturnPoint; } QGeoCoordinate breachReturnPoint (void) const { return _breachReturnPoint; }
void setBreachReturnPoint(const QGeoCoordinate& breachReturnPoint); void setBreachReturnPoint (const QGeoCoordinate& breachReturnPoint);
bool isEmpty (void) const;
signals: signals:
void breachReturnPointChanged (QGeoCoordinate breachReturnPoint); void breachReturnPointChanged (QGeoCoordinate breachReturnPoint);

11
src/MissionManager/MissionController.cc

@ -148,8 +148,10 @@ void MissionController::_newMissionItemsAvailableFromVehicle(bool removeAllReque
qCDebug(MissionControllerLog) << "_newMissionItemsAvailableFromVehicle flyView:count" << _flyView << _missionManager->missionItems().count(); qCDebug(MissionControllerLog) << "_newMissionItemsAvailableFromVehicle flyView:count" << _flyView << _missionManager->missionItems().count();
// Fly view always reloads on _loadComplete // Fly view always reloads on _loadComplete
// Plan view only reloads on _loadComplete if specifically requested // Plan view only reloads if:
if (_flyView || removeAllRequested || _itemsRequested || _visualItems->count() <= 1) { // - Load was specifically requested
// - There is no current Plan
if (_flyView || removeAllRequested || _itemsRequested || isEmpty()) {
// Fly Mode (accept if): // Fly Mode (accept if):
// - Always accepts new items from the vehicle so Fly view is kept up to date // - Always accepts new items from the vehicle so Fly view is kept up to date
// Edit Mode (accept if): // Edit Mode (accept if):
@ -2174,3 +2176,8 @@ void MissionController::_complexBoundingBoxChanged()
{ {
_updateTimer.start(UPDATE_TIMEOUT); _updateTimer.start(UPDATE_TIMEOUT);
} }
bool MissionController::isEmpty(void) const
{
return _visualItems->count() <= 1;
}

2
src/MissionManager/MissionController.h

@ -196,6 +196,8 @@ public:
int batteryChangePoint (void) const { return _missionFlightStatus.batteryChangePoint; } ///< -1 for not supported, 0 for not needed 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 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 // 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:: // they don't want through the QGCCorePlugin::
static const QString patternFWLandingName; static const QString patternFWLandingName;

7
src/MissionManager/PlanMasterController.cc

@ -576,3 +576,10 @@ bool PlanMasterController::syncInProgress(void) const
_geoFenceController.syncInProgress() || _geoFenceController.syncInProgress() ||
_rallyPointController.syncInProgress(); _rallyPointController.syncInProgress();
} }
bool PlanMasterController::isEmpty(void) const
{
return _missionController.isEmpty() &&
_geoFenceController.isEmpty() &&
_rallyPointController.isEmpty();
}

1
src/MissionManager/PlanMasterController.h

@ -84,6 +84,7 @@ public:
QString currentPlanFile (void) const { return _currentPlanFile; } QString currentPlanFile (void) const { return _currentPlanFile; }
QStringList loadNameFilters (void) const; QStringList loadNameFilters (void) const;
QStringList saveNameFilters (void) const; QStringList saveNameFilters (void) const;
bool isEmpty (void) const;
QJsonDocument saveToJson (); QJsonDocument saveToJson ();

11
src/MissionManager/RallyPointController.cc

@ -202,8 +202,10 @@ QString RallyPointController::editorQml(void) const
void RallyPointController::_managerLoadComplete(void) void RallyPointController::_managerLoadComplete(void)
{ {
// Fly view always reloads on _loadComplete // Fly view always reloads on _loadComplete
// Plan view only reloads on _loadComplete if specifically requested // Plan view only reloads if:
if (_flyView || _itemsRequested) { // - Load was specifically requested
// - There is no current Plan
if (_flyView || _itemsRequested || isEmpty()) {
_points.clearAndDeleteContents(); _points.clearAndDeleteContents();
QObjectList pointList; QObjectList pointList;
for (int i=0; i<_rallyPointManager->points().count(); i++) { 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;
}

3
src/MissionManager/RallyPointController.h

@ -54,7 +54,8 @@ public:
QString editorQml (void) const; QString editorQml (void) const;
QObject* currentRallyPoint (void) const { return _currentRallyPoint; } QObject* currentRallyPoint (void) const { return _currentRallyPoint; }
void setCurrentRallyPoint(QObject* rallyPoint); void setCurrentRallyPoint (QObject* rallyPoint);
bool isEmpty (void) const;
signals: signals:
void currentRallyPointChanged(QObject* rallyPoint); void currentRallyPointChanged(QObject* rallyPoint);

Loading…
Cancel
Save