From b47b6075bc1fc8f689e4f14bd17c580ea32ecd18 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Thu, 31 Jan 2019 13:48:08 -0800 Subject: [PATCH] Save camera shots and complex distance in plan file so that values are valid when reloading --- src/MissionManager/TransectStyleComplexItem.cc | 17 ++++++++++++++++- src/MissionManager/TransectStyleComplexItem.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/MissionManager/TransectStyleComplexItem.cc b/src/MissionManager/TransectStyleComplexItem.cc index d616d7515..764d1915e 100644 --- a/src/MissionManager/TransectStyleComplexItem.cc +++ b/src/MissionManager/TransectStyleComplexItem.cc @@ -35,6 +35,8 @@ const char* TransectStyleComplexItem::_jsonCameraCalcKey = "Cam const char* TransectStyleComplexItem::_jsonVisualTransectPointsKey = "VisualTransectPoints"; const char* TransectStyleComplexItem::_jsonItemsKey = "Items"; const char* TransectStyleComplexItem::_jsonFollowTerrainKey = "FollowTerrain"; +const char* TransectStyleComplexItem::_jsonCameraShotsKey = "CameraShots"; +const char* TransectStyleComplexItem::_jsonComplexDistanceKey = "ComplexDistance"; const int TransectStyleComplexItem::_terrainQueryTimeoutMsecs = 1000; @@ -139,6 +141,8 @@ void TransectStyleComplexItem::_save(QJsonObject& complexObject) innerObject[hoverAndCaptureName] = _hoverAndCaptureFact.rawValue().toBool(); innerObject[refly90DegreesName] = _refly90DegreesFact.rawValue().toBool(); innerObject[_jsonFollowTerrainKey] = _followTerrain; + innerObject[_jsonCameraShotsKey] = _cameraShots; + innerObject[_jsonComplexDistanceKey] = _complexDistance; if (_followTerrain) { innerObject[terrainAdjustToleranceName] = _terrainAdjustToleranceFact.rawValue().toDouble(); @@ -209,9 +213,11 @@ bool TransectStyleComplexItem::_load(const QJsonObject& complexObject, QString& { hoverAndCaptureName, QJsonValue::Bool, true }, { refly90DegreesName, QJsonValue::Bool, true }, { _jsonCameraCalcKey, QJsonValue::Object, true }, - { _jsonVisualTransectPointsKey, QJsonValue::Array, true }, + { _jsonVisualTransectPointsKey, QJsonValue::Array, true }, { _jsonItemsKey, QJsonValue::Array, true }, { _jsonFollowTerrainKey, QJsonValue::Bool, true }, + { _jsonCameraShotsKey, QJsonValue::Double, false }, // Not required since it was missing from initial implementation + { _jsonComplexDistanceKey, QJsonValue::Double, false }, // Not required since it was missing from initial implementation }; if (!JsonHelper::validateKeys(innerObject, innerKeyInfoList, errorString)) { return false; @@ -249,6 +255,15 @@ bool TransectStyleComplexItem::_load(const QJsonObject& complexObject, QString& _refly90DegreesFact.setRawValue (innerObject[refly90DegreesName].toBool()); _followTerrain = innerObject[_jsonFollowTerrainKey].toBool(); + // These two keys where not included in initial implementation so they are optional. Without them the values will be + // incorrect when loaded though. + if (innerObject.contains(_jsonCameraShotsKey)) { + _cameraShots = innerObject[_jsonCameraShotsKey].toInt(); + } + if (innerObject.contains(_jsonComplexDistanceKey)) { + _complexDistance = innerObject[_jsonComplexDistanceKey].toDouble(); + } + if (_followTerrain) { QList followTerrainKeyInfoList = { { terrainAdjustToleranceName, QJsonValue::Double, true }, diff --git a/src/MissionManager/TransectStyleComplexItem.h b/src/MissionManager/TransectStyleComplexItem.h index d392f6ea7..c3ff764c5 100644 --- a/src/MissionManager/TransectStyleComplexItem.h +++ b/src/MissionManager/TransectStyleComplexItem.h @@ -197,6 +197,8 @@ protected: static const char* _jsonVisualTransectPointsKey; static const char* _jsonItemsKey; static const char* _jsonFollowTerrainKey; + static const char* _jsonCameraShotsKey; + static const char* _jsonComplexDistanceKey; static const int _terrainQueryTimeoutMsecs; -- 2.22.0