Commit b47b6075 authored by Don Gagne's avatar Don Gagne

parent 924d5ceb
......@@ -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<JsonHelper::KeyValidateInfo> followTerrainKeyInfoList = {
{ terrainAdjustToleranceName, QJsonValue::Double, true },
......
......@@ -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;
......
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