From 6b0ef0737f614e775bb85b86fad0bc8b226655ad Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Thu, 31 Jan 2019 11:38:17 -0800 Subject: [PATCH] Fix Survey additionalTimeDelay as it relates to hover and capture --- src/MissionManager/ComplexMissionItem.h | 4 ---- src/MissionManager/CorridorScanComplexItem.h | 1 + src/MissionManager/FixedWingLandingComplexItem.h | 1 + src/MissionManager/MissionSettingsItem.h | 1 + src/MissionManager/StructureScanComplexItem.h | 1 + src/MissionManager/SurveyComplexItem.cc | 13 +++++++++++++ src/MissionManager/SurveyComplexItem.h | 1 + src/MissionManager/TransectStyleComplexItem.cc | 1 + src/MissionManager/TransectStyleComplexItemTest.h | 1 + 9 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/MissionManager/ComplexMissionItem.h b/src/MissionManager/ComplexMissionItem.h index 66209491a..71046d1d4 100644 --- a/src/MissionManager/ComplexMissionItem.h +++ b/src/MissionManager/ComplexMissionItem.h @@ -44,10 +44,6 @@ public: /// This mission item attribute specifies the type of the complex item. static const char* jsonComplexItemTypeKey; - // Overrides from VisualMissionItem - double additionalTimeDelay(void) const final { return 0; } - - signals: void complexDistanceChanged (void); void boundingCubeChanged (void); diff --git a/src/MissionManager/CorridorScanComplexItem.h b/src/MissionManager/CorridorScanComplexItem.h index a5fe2cab8..278ef847f 100644 --- a/src/MissionManager/CorridorScanComplexItem.h +++ b/src/MissionManager/CorridorScanComplexItem.h @@ -52,6 +52,7 @@ public: QString commandName (void) const final { return tr("Corridor Scan"); } QString abbreviation (void) const final { return tr("C"); } bool readyForSave (void) const; + double additionalTimeDelay (void) const final { return 0; } static const char* jsonComplexItemTypeValue; diff --git a/src/MissionManager/FixedWingLandingComplexItem.h b/src/MissionManager/FixedWingLandingComplexItem.h index 70e77b092..9f81b5695 100644 --- a/src/MissionManager/FixedWingLandingComplexItem.h +++ b/src/MissionManager/FixedWingLandingComplexItem.h @@ -91,6 +91,7 @@ public: double specifiedGimbalPitch (void) final { return std::numeric_limits::quiet_NaN(); } void appendMissionItems (QList& items, QObject* missionItemParent) final; void applyNewAltitude (double newAltitude) final; + double additionalTimeDelay (void) const final { return 0; } bool coordinateHasRelativeAltitude (void) const final { return _altitudesAreRelative; } bool exitCoordinateHasRelativeAltitude (void) const final { return _altitudesAreRelative; } diff --git a/src/MissionManager/MissionSettingsItem.h b/src/MissionManager/MissionSettingsItem.h index 2a0312175..935cade38 100644 --- a/src/MissionManager/MissionSettingsItem.h +++ b/src/MissionManager/MissionSettingsItem.h @@ -77,6 +77,7 @@ public: void appendMissionItems (QList& items, QObject* missionItemParent) final; void applyNewAltitude (double newAltitude) final { Q_UNUSED(newAltitude); /* no action */ } double specifiedFlightSpeed (void) final; + double additionalTimeDelay (void) const final { return 0; } bool coordinateHasRelativeAltitude (void) const final { return false; } bool exitCoordinateHasRelativeAltitude (void) const final { return false; } diff --git a/src/MissionManager/StructureScanComplexItem.h b/src/MissionManager/StructureScanComplexItem.h index 5f38be25f..9b8b09d4c 100644 --- a/src/MissionManager/StructureScanComplexItem.h +++ b/src/MissionManager/StructureScanComplexItem.h @@ -84,6 +84,7 @@ public: void appendMissionItems (QList& items, QObject* missionItemParent) final; void setMissionFlightStatus (MissionController::MissionFlightStatus_t& missionFlightStatus) final; void applyNewAltitude (double newAltitude) final; + double additionalTimeDelay (void) const final { return 0; } bool coordinateHasRelativeAltitude (void) const final { return _altitudeRelative; } bool exitCoordinateHasRelativeAltitude (void) const final { return _altitudeRelative; } diff --git a/src/MissionManager/SurveyComplexItem.cc b/src/MissionManager/SurveyComplexItem.cc index 8a0fac378..95d958140 100644 --- a/src/MissionManager/SurveyComplexItem.cc +++ b/src/MissionManager/SurveyComplexItem.cc @@ -1476,3 +1476,16 @@ double SurveyComplexItem::timeBetweenShots(void) { return _cruiseSpeed == 0 ? 0 : triggerDistance() / _cruiseSpeed; } + +double SurveyComplexItem::additionalTimeDelay (void) const +{ + double hoverTime = 0; + + if (hoverAndCaptureEnabled()) { + for (const QList& transect: _transects) { + hoverTime += _hoverAndCaptureDelaySeconds * transect.count(); + } + } + + return hoverTime; +} diff --git a/src/MissionManager/SurveyComplexItem.h b/src/MissionManager/SurveyComplexItem.h index 01248446c..8bac39b89 100644 --- a/src/MissionManager/SurveyComplexItem.h +++ b/src/MissionManager/SurveyComplexItem.h @@ -52,6 +52,7 @@ public: QString commandName (void) const final { return tr("Survey"); } QString abbreviation (void) const final { return tr("S"); } bool readyForSave (void) const final; + double additionalTimeDelay (void) const final; // Must match json spec for GridEntryLocation enum EntryLocation { diff --git a/src/MissionManager/TransectStyleComplexItem.cc b/src/MissionManager/TransectStyleComplexItem.cc index d616d7515..7e4a03c3a 100644 --- a/src/MissionManager/TransectStyleComplexItem.cc +++ b/src/MissionManager/TransectStyleComplexItem.cc @@ -398,6 +398,7 @@ void TransectStyleComplexItem::_rebuildTransects(void) emit lastSequenceNumberChanged(lastSequenceNumber()); emit timeBetweenShotsChanged(); + emit additionalTimeDelayChanged(); } void TransectStyleComplexItem::_queryTransectsPathHeightInfo(void) diff --git a/src/MissionManager/TransectStyleComplexItemTest.h b/src/MissionManager/TransectStyleComplexItemTest.h index dac201cf7..e0b00751e 100644 --- a/src/MissionManager/TransectStyleComplexItemTest.h +++ b/src/MissionManager/TransectStyleComplexItemTest.h @@ -94,6 +94,7 @@ public: bool specifiesCoordinate (void) const final { return true; } void appendMissionItems (QList& items, QObject* missionItemParent) final { Q_UNUSED(items); Q_UNUSED(missionItemParent); } void applyNewAltitude (double newAltitude) final { Q_UNUSED(newAltitude); } + double additionalTimeDelay (void) const final { return 0; } bool rebuildTransectsPhase1Called; bool rebuildTransectsPhase2Called; -- 2.22.0