Commit e5b570c5 authored by Valentin Platzgummer's avatar Valentin Platzgummer

temp, QVariant compile error

parent 6485d280
......@@ -37,7 +37,7 @@ FactGroup::FactGroup(int updateRateMsecs, QObject* parent, bool ignoreCamelCase)
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
}
void FactGroup::_loadFromJsonArray(const QJsonArray jsonArray)
void FactGroup::_loadFromJsonArray(const QJsonObject jsonArray)
{
QMap<QString, QString> defineMap;
_nameToFactMetaDataMap = FactMetaData::createMapFromJsonArray(jsonArray, defineMap, this);
......
......@@ -64,7 +64,7 @@ protected slots:
protected:
void _addFact (Fact* fact, const QString& name);
void _addFactGroup (FactGroup* factGroup, const QString& name);
void _loadFromJsonArray (const QJsonArray jsonArray);
void _loadFromJsonArray (const QJsonObject jsonArray);
void _setTelemetryAvailable (bool telemetryAvailable);
int _updateRateMSecs; ///< Update rate for Fact::valueChanged signals, 0: immediate update
......
......@@ -1448,7 +1448,7 @@ QMap<QString, FactMetaData*> FactMetaData::createMapFromJsonFile(const QString&
return metaDataMap;
}
QJsonArray factArray;
QJsonObject factArray;
QMap<QString /* define name */, QString /* define value */> defineMap;
QList<JsonHelper::KeyValidateInfo> keyInfoList = {
......@@ -1466,7 +1466,7 @@ QMap<QString, FactMetaData*> FactMetaData::createMapFromJsonFile(const QString&
return createMapFromJsonArray(factArray, defineMap, metaDataParent);
}
QMap<QString, FactMetaData*> FactMetaData::createMapFromJsonArray(const QJsonArray jsonArray, QMap<QString, QString>& defineMap, QObject* metaDataParent)
QMap<QString, FactMetaData*> FactMetaData::createMapFromJsonArray(const QJsonObject jsonArray, QMap<QString, QString>& defineMap, QObject* metaDataParent)
{
QMap<QString, FactMetaData*> metaDataMap;
for (int i=0; i<jsonArray.count(); i++) {
......@@ -1554,7 +1554,7 @@ bool FactMetaData::_parseValuesArray(const QJsonObject& jsonObject, QStringList&
{ _enumValuesArrayValueJsonKey, QJsonValue::Double, true },
};
const QJsonArray& rgValueDescription = jsonObject[_enumValuesArrayJsonKey].toArray();
const QJsonObject& rgValueDescription = jsonObject[_enumValuesArrayJsonKey].toArray();
for (int i=0; i<rgValueDescription.count(); i++) {
if (rgValueDescription[i].type() != QJsonValue::Object) {
errorString = QStringLiteral("Value at index %1 in \"values\" array is not an object.").arg(i);
......@@ -1589,7 +1589,7 @@ bool FactMetaData::_parseBitmaskArray(const QJsonObject& jsonObject, QStringList
{ _enumBitmaskArrayIndexJsonKey, QJsonValue::Double, true },
};
const QJsonArray& rgValueDescription = jsonObject[_enumBitmaskArrayJsonKey].toArray();
const QJsonObject& rgValueDescription = jsonObject[_enumBitmaskArrayJsonKey].toArray();
for (int i=0; i<rgValueDescription.count(); i++) {
if (rgValueDescription[i].type() != QJsonValue::Object) {
errorString = QStringLiteral("Value at index %1 in \"values\" array is not an object.").arg(i);
......
......@@ -57,7 +57,7 @@ public:
typedef QMap<QString, QString> DefineMap_t;
static QMap<QString, FactMetaData*> createMapFromJsonFile(const QString& jsonFilename, QObject* metaDataParent);
static QMap<QString, FactMetaData*> createMapFromJsonArray(const QJsonArray jsonArray, DefineMap_t& defineMap, QObject* metaDataParent);
static QMap<QString, FactMetaData*> createMapFromJsonArray(const QJsonObject jsonArray, DefineMap_t& defineMap, QObject* metaDataParent);
static FactMetaData* createFromJsonObject(const QJsonObject& json, QMap<QString, QString>& defineMap, QObject* metaDataParent);
......
This diff is collapsed.
This diff is collapsed.
......@@ -4,12 +4,17 @@
#include "geometry/SafeArea.h"
#include "geometry/snake.h"
#include "JsonHelper.h"
#include "QGCApplication.h"
#include "QGCLoggingCategory.h"
#include "QGCQGeoCoordinate.h"
QGC_LOGGING_CATEGORY(AreaDataLog, "AreaDataLog")
const char *originJsonKey = "Origin";
const char *areaListJsonKey = "AreaList";
const char *initializedJsonKey = "Initialized";
AreaData::AreaData(QObject *parent) : QObject(parent) {}
AreaData::~AreaData() {}
......@@ -270,6 +275,41 @@ bool AreaData::operator!=(const AreaData &other) const {
return !(*this == other);
}
bool AreaData::load(const QJsonObject &obj, QString &guiErrorString) {
qWarning() << "AreaData::load impl. missing";
return true;
}
bool AreaData::save(QJsonObject &obj) const {
// QJsonObject temp;
// QJsonValue jsonOrigin;
// JsonHelper::saveGeoCoordinate(_origin, true, jsonOrigin);
// temp[originJsonKey] = jsonOrigin;
// temp[initializedJsonKey] = _initialized;
// QJsonObject jsonAreaList;
// for (int i = 0; i < _areaList.count(); ++i) {
// auto const &qobj = _areaList[i];
// auto const &area = qobject_cast<const GeoArea *>(qobj);
// QJsonObject jsonArea;
// if (area->saveToJson(jsonArea)) {
// QJsonObject jsonObj;
// jsonObj[area->objectName()] = jsonArea;
// jsonAreaList.append(jsonObj);
// } else {
// qDebug(AreaListLog) << "save(): not able to save area: "
// << area->objectName();
// _processError(tr("Not able to save area: ") + area->objectName());
// return false;
// }
// }
// temp[areaListJsonKey] = jsonAreaList;
// obj = std::move(temp);
return true;
}
void AreaData::_setOrigin(const QGeoCoordinate &origin) {
if (this->_origin != origin) {
this->_origin = origin;
......
#pragma once
#include <QGeoCoordinate>
#include <QJsonObject>
#include <QObject>
#include <QString>
#include "QmlObjectListModel.h"
......@@ -72,6 +74,9 @@ public:
bool operator==(const AreaData &other) const;
bool operator!=(const AreaData &other) const;
bool load(const QJsonObject &obj, QString &guiErrorString);
bool save(QJsonObject &obj) const;
QString errorString() const; // Contains a message about the last error.
bool showErrorMessages() const;
......
#include "CircularGenerator.h"
#include "JsonHelper.h"
#include "QGCLoggingCategory.h"
#include "SettingsFact.h"
......@@ -29,9 +30,7 @@ const char *CircularGenerator::settingsGroup = "CircularGenerator";
const char *CircularGenerator::distanceName = "TransectDistance";
const char *CircularGenerator::deltaAlphaName = "DeltaAlpha";
const char *CircularGenerator::minLengthName = "MinLength";
const char *CircularGenerator::refPointLatitudeName = "ReferencePointLat";
const char *CircularGenerator::refPointLongitudeName = "ReferencePointLong";
const char *CircularGenerator::refPointAltitudeName = "ReferencePointAlt";
const char *CircularGenerator::refPointName = "ReferencePoint";
CircularGenerator::CircularGenerator(QObject *parent)
: CircularGenerator(nullptr, parent) {}
......@@ -184,6 +183,55 @@ void CircularGenerator::setReference(const QGeoCoordinate &reference) {
}
}
bool CircularGenerator::save(QJsonObject &obj) const {
// QJsonObject temp;
// bool ok = false;
// auto variant = _distance.rawValue();
// auto val = variant.toDouble(ok);
// if (!ok) {
// qCDebug(CircularGeneratorLog)
// << "save(): not able to save distance. Not a double: "
// << variant.typeName();
// return false;
// } else {
// temp[distanceName] = val;
// }
// variant = _deltaAlpha.rawValue();
// val = variant.toDouble(ok);
// if (!ok) {
// qCDebug(CircularGeneratorLog)
// << "save(): not able to save deltaAlpha. Not a double: "
// << variant.typeName();
// return false;
// } else {
// temp[deltaAlphaName] = val;
// }
// variant = _minLength.rawValue();
// val = variant.toDouble(ok);
// if (!ok) {
// qCDebug(CircularGeneratorLog)
// << "save(): not able to save minLength. Not a double: "
// << variant.typeName();
// return false;
// } else {
// temp[minLengthName] = val;
// }
// QJsonObject jsonReference;
// JsonHelper::saveGeoCoordinate(_reference, true, jsonReference);
// temp[refPointName] = jsonReference;
// obj = std::move(temp);
return true;
}
bool CircularGenerator::load(const QJsonObject &obj, QString &guiErrorMessage) {
qWarning() << "CircularGenerator::load() impl. missing";
return true;
}
void CircularGenerator::resetReferenceIfInvalid() {
if (!this->_reference.isValid()) {
resetReference();
......
......@@ -35,13 +35,22 @@ public:
void setReference(const QGeoCoordinate &reference);
//!
//! \brief save Saves the generator.
//! \param obj Json object for saveing.
//! \return Returns true on success, false either.
//!
//! Saves distance, alpha and minLength.
//! \note This methode does not save the data.
//!
virtual bool save(QJsonObject &obj) const override;
virtual bool load(const QJsonObject &obj, QString &guiErrorMessage) override;
static const char *settingsGroup;
static const char *distanceName;
static const char *deltaAlphaName;
static const char *minLengthName;
static const char *refPointLongitudeName;
static const char *refPointLatitudeName;
static const char *refPointAltitudeName;
static const char *refPointName;
signals:
void referenceChanged();
......
#pragma once
#include <QJsonObject>
#include <QObject>
#include <QString>
#include <functional>
#include <memory>
......@@ -27,6 +29,9 @@ public:
virtual QString editorQml() = 0;
virtual QString mapVisualQml() = 0;
virtual bool save(QJsonObject &obj) const = 0;
virtual bool load(const QJsonObject &obj, QString &guiErrorMessage) = 0;
virtual QString name() = 0;
virtual QString abbreviation() = 0;
......
......@@ -149,6 +149,52 @@ bool LinearGenerator::get(Generator &generator) {
}
}
bool LinearGenerator::save(QJsonObject &obj) const {
// QJsonObject temp;
// bool ok = false;
// auto variant = _distance.rawValue();
// auto val = variant.toDouble(ok);
// if (!ok) {
// qCDebug(LinearGeneratorLog)
// << "save(): not able to save distance. Not a double: "
// << variant.typeName();
// return false;
// } else {
// temp[distanceName] = val;
// }
// variant = _alpha.rawValue();
// val = variant.toDouble(ok);
// if (!ok) {
// qCDebug(LinearGeneratorLog)
// << "save(): not able to save alpha. Not a double: "
// << variant.typeName();
// return false;
// } else {
// temp[alphaName] = val;
// }
// variant = _minLength.rawValue();
// val = variant.toDouble(ok);
// if (!ok) {
// qCDebug(LinearGeneratorLog)
// << "save(): not able to save minLength. Not a double: "
// << variant.typeName();
// return false;
// } else {
// temp[minLengthName] = val;
// }
// obj = std::move(temp);
return true;
}
bool LinearGenerator::load(const QJsonObject &obj, QString &guiErrorString) {
qWarning() << "LinearGenerator::load() impl. missing";
return true;
}
Fact *LinearGenerator::distance() { return &_distance; }
Fact *LinearGenerator::alpha() { return &_alpha; }
......
......@@ -27,6 +27,17 @@ public:
virtual bool get(Generator &generator) override;
//!
//! \brief save Saves the generator.
//! \param obj Json object for saveing.
//! \return Returns true on success, false either.
//!
//! Saves distance, alpha and minLength.
//! \note This methode does not save the data.
//!
virtual bool save(QJsonObject &obj) const override;
virtual bool load(const QJsonObject &obj, QString &guiErrorString) override;
Fact *distance();
Fact *alpha();
Fact *minLength();
......
......@@ -33,6 +33,10 @@ const char *MeasurementComplexItem::jsonComplexItemTypeValue =
const char *MeasurementComplexItem::variantName = "Variant";
const char *MeasurementComplexItem::altitudeName = "Altitude";
const QString MeasurementComplexItem::name(tr("Measurement"));
const char *areaDataName = "AreaDataName";
const char *variantNamesName = "VariantNames";
const char *generatorsName = "Generators";
const char *variantsName = "Variants";
MeasurementComplexItem::MeasurementComplexItem(
PlanMasterController *masterController, bool flyView,
......@@ -208,10 +212,7 @@ QString MeasurementComplexItem::mapVisualQML() const {
return QStringLiteral("MeasurementItemMapVisual.qml");
}
void MeasurementComplexItem::save(QJsonArray &planItems) {
qWarning() << "MeasurementComplexItem::save(): area data save missing.";
qWarning() << "MeasurementComplexItem::save(): mission item save missing.";
void MeasurementComplexItem::save(QJsonObject &planItems) {
if (idle()) {
QJsonObject saveObject;
......@@ -221,10 +222,60 @@ void MeasurementComplexItem::save(QJsonArray &planItems) {
saveObject[ComplexMissionItem::jsonComplexItemTypeKey] =
jsonComplexItemTypeValue;
// Variant and altitude.
saveObject[variantName] = double(_variant.rawValue().toUInt());
saveObject[altitudeName] = double(_altitude.rawValue().toUInt());
// Variant names.
QJsonObject jsonVariantNames;
for (auto const &name : _variantNames) {
jsonVariantNames.append(name);
}
saveObject[variantNamesName] = jsonVariantNames;
// AreaData.
// QJsonObject jsonAreaData;
// if (!_pAreaData->save(jsonAreaData)) {
// qCDebug(MeasurementComplexItemLog)
// << "save(): not able to save area data";
// return;
// }
// saveObject[areaDataName] = jsonAreaData;
// Generators.
// QJsonArray generatorArray;
// for (int i = 0; i < _generatorList.size(); ++i) {
// auto const gen = _generatorList[i];
// auto const &name = _generatorNameList[i];
// QJsonObject innerObj;
// if (!gen->save(innerObj)) {
// qCDebug(MeasurementComplexItemLog)
// << "save(): not able to save generator: " << name;
// return;
// } else {
// QJsonObject outerObj;
// outerObj[name] = innerObj;
// generatorArray.append(outerObj);
// }
// }
// saveObject[generatorsName] = generatorArray;
// Route Variants
QJsonObject variantsArray;
for (auto const &route : _variantVector) {
QJsonValue variant;
if (!(route.size() == 0)) {
JsonHelper::saveGeoCoordinateArray(route, true, variant);
} else {
JsonHelper::saveGeoCoordinateArray(_route, true, variant);
}
variantsArray.append(variant);
}
saveObject[variantsName] = variantsArray;
planItems.append(saveObject);
} else {
qCDebug(MeasurementComplexItemLog) << "save(): called while not idle.";
}
}
......
#pragma once
#include <QFutureWatcher>
#include <QJsonArray>
#include <QVector>
#include <memory>
......@@ -84,7 +85,7 @@ public:
virtual void setDirty(bool dirty) override final;
virtual void setCoordinate(const QGeoCoordinate &coordinate) override final;
virtual void setSequenceNumber(int sequenceNumber) override final;
virtual void save(QJsonArray &missionItems) override final;
virtual void save(QJsonObject &missionItems) override final;
virtual double amslEntryAlt(void) const override final;
virtual double amslExitAlt(void) const override final;
virtual double minAMSLAltitude(void) const override final;
......
......@@ -61,7 +61,7 @@ CorridorScanComplexItem::CorridorScanComplexItem(PlanMasterController* masterCon
setDirty(false);
}
void CorridorScanComplexItem::save(QJsonArray& planItems)
void CorridorScanComplexItem::save(QJsonObject& planItems)
{
QJsonObject saveObject;
......
......@@ -37,7 +37,7 @@ public:
// Overrides from TransectStyleComplexItem
QString patternName (void) const final { return name; }
void save (QJsonArray& planItems) final;
void save (QJsonObject& planItems) final;
bool specifiesCoordinate (void) const final;
double timeBetweenShots (void) final;
......
......@@ -81,7 +81,7 @@ void FWLandingPatternTest::_testDirty(void)
void FWLandingPatternTest::_testSaveLoad(void)
{
QJsonArray items;
QJsonObject items;
_fwItem->save(items);
......
......@@ -60,7 +60,7 @@ FixedWingLandingComplexItem::FixedWingLandingComplexItem(PlanMasterController* m
setDirty(false);
}
void FixedWingLandingComplexItem::save(QJsonArray& missionItems)
void FixedWingLandingComplexItem::save(QJsonObject& missionItems)
{
QJsonObject saveObject = _save();
......
......@@ -44,7 +44,7 @@ public:
QString mapVisualQML (void) const final { return QStringLiteral("FWLandingPatternMapVisual.qml"); }
// Overrides from VisualMissionItem
void save (QJsonArray& missionItems) final;
void save (QJsonObject& missionItems) final;
static const QString name;
......
......@@ -152,7 +152,7 @@ bool GeoFenceController::load(const QJsonObject& json, QString& errorString)
return false;
}
QJsonArray jsonPolygonArray = json[_jsonPolygonsKey].toArray();
QJsonObject jsonPolygonArray = json[_jsonPolygonsKey].toArray();
for (const QJsonValue jsonPolygonValue: jsonPolygonArray) {
if (jsonPolygonValue.type() != QJsonValue::Object) {
errorString = tr("GeoFence polygon not stored as object");
......@@ -166,7 +166,7 @@ bool GeoFenceController::load(const QJsonObject& json, QString& errorString)
_polygons.append(fencePolygon);
}
QJsonArray jsonCircleArray = json[_jsonCirclesKey].toArray();
QJsonObject jsonCircleArray = json[_jsonCirclesKey].toArray();
for (const QJsonValue jsonCircleValue: jsonCircleArray) {
if (jsonCircleValue.type() != QJsonValue::Object) {
errorString = tr("GeoFence circle not stored as object");
......@@ -200,7 +200,7 @@ void GeoFenceController::save(QJsonObject& json)
{
json[JsonHelper::jsonVersionKey] = _jsonCurrentVersion;
QJsonArray jsonPolygonArray;
QJsonObject jsonPolygonArray;
for (int i=0; i<_polygons.count(); i++) {
QJsonObject jsonPolygon;
QGCFencePolygon* fencePolygon = _polygons.value<QGCFencePolygon*>(i);
......@@ -209,7 +209,7 @@ void GeoFenceController::save(QJsonObject& json)
}
json[_jsonPolygonsKey] = jsonPolygonArray;
QJsonArray jsonCircleArray;
QJsonObject jsonCircleArray;
for (int i=0; i<_circles.count(); i++) {
QJsonObject jsonCircle;
QGCFenceCircle* fenceCircle = _circles.value<QGCFenceCircle*>(i);
......
......@@ -82,7 +82,7 @@ public:
QString mapVisualQML(void) const final { return QStringLiteral("FWLandingPatternMapVisual.qml"); }
// Overrides from VisualMissionItem
void save (QJsonArray& /*missionItems*/) { };
void save (QJsonObject& /*missionItems*/) { };
static const QString name;
......
......@@ -55,7 +55,7 @@ void MissionCommandList::_loadMavCmdInfoJson(const QString& jsonFilename, bool b
}
// Iterate over MissionCommandUIInfo objects
QJsonArray jsonArray = jsonValue.toArray();
QJsonObject jsonArray = jsonValue.toArray();
for(QJsonValue info: jsonArray) {
if (!info.isObject()) {
qWarning() << jsonFilename << "mavCmdArray should contain objects";
......
......@@ -744,7 +744,7 @@ bool MissionController::_loadJsonMissionFileV1(const QJsonObject &json,
// Read complex items
QList<SurveyComplexItem *> surveyItems;
QJsonArray complexArray(json[_jsonComplexItemsKey].toArray());
QJsonObject complexArray(json[_jsonComplexItemsKey].toArray());
qCDebug(MissionControllerLog)
<< "Json load: complex item count" << complexArray.count();
for (int i = 0; i < complexArray.count(); i++) {
......@@ -771,7 +771,7 @@ bool MissionController::_loadJsonMissionFileV1(const QJsonObject &json,
int nextSimpleItemIndex = 0;
int nextComplexItemIndex = 0;
int nextSequenceNumber = 1; // Start with 1 since home is in 0
QJsonArray itemArray(json[_jsonItemsKey].toArray());
QJsonObject itemArray(json[_jsonItemsKey].toArray());
MissionSettingsItem *settingsItem = _addMissionSettings(visualItems);
if (json.contains(_jsonPlannedHomePositionKey)) {
......@@ -932,7 +932,7 @@ bool MissionController::_loadJsonMissionFileV2(const QJsonObject &json,
// Read mission items
int nextSequenceNumber = 1; // Start with 1 since home is in 0
const QJsonArray rgMissionItems(json[_jsonItemsKey].toArray());
const QJsonObject rgMissionItems(json[_jsonItemsKey].toArray());
for (int i = 0; i < rgMissionItems.count(); i++) {
// Convert to QJsonObject
const QJsonValue &itemValue = rgMissionItems[i];
......@@ -1335,7 +1335,7 @@ void MissionController::save(QJsonObject &json) {
// Save the visual items
QJsonArray rgJsonMissionItems;
QJsonObject rgJsonMissionItems;
for (int i = 0; i < _visualItems->count(); i++) {
VisualMissionItem *visualItem =
qobject_cast<VisualMissionItem *>(_visualItems->get(i));
......
......@@ -147,7 +147,7 @@ void MissionItem::save(QJsonObject &json) const {
json[_jsonAutoContinueKey] = autoContinue();
json[_jsonDoJumpIdKey] = _sequenceNumber;
QJsonArray rgParams = {param1(), param2(), param3(), param4(),
QJsonObject rgParams = {param1(), param2(), param3(), param4(),
param5(), param6(), param7()};
json[_jsonParamsKey] = rgParams;
}
......@@ -206,7 +206,7 @@ bool MissionItem::_convertJsonV1ToV2(const QJsonObject &json,
VisualMissionItem::jsonTypeSimpleItemValue;
}
QJsonArray rgParams = {
QJsonObject rgParams = {
json[_jsonParam1Key].toDouble(), json[_jsonParam2Key].toDouble(),
json[_jsonParam3Key].toDouble(), json[_jsonParam4Key].toDouble()};
v2Json[_jsonParamsKey] = rgParams;
......@@ -241,7 +241,7 @@ bool MissionItem::_convertJsonV2ToV3(QJsonObject &json, QString &errorString) {
return false;
}
QJsonArray rgParam = json[_jsonParamsKey].toArray();
QJsonObject rgParam = json[_jsonParamsKey].toArray();
rgParam.append(coordinate.latitude());
rgParam.append(coordinate.longitude());
rgParam.append(coordinate.altitude());
......@@ -283,7 +283,7 @@ bool MissionItem::load(const QJsonObject &json, int sequenceNumber,
return false;
}
QJsonArray rgParams = convertedJson[_jsonParamsKey].toArray();
QJsonObject rgParams = convertedJson[_jsonParamsKey].toArray();
if (rgParams.count() != 7) {
errorString = tr("%1 key must contains 7 values").arg(_jsonParamsKey);
return false;
......
......@@ -342,7 +342,7 @@ void MissionItemTest::_testLoadFromJsonV2(void)
QVERIFY(!errorString.isEmpty());
qDebug() << errorString;
QJsonArray badCoordinateArray;
QJsonObject badCoordinateArray;
badCoordinateArray << -10.0 << -20.0 ;
badObject = jsonObject;
badObject.remove("coordinate");
......@@ -351,7 +351,7 @@ void MissionItemTest::_testLoadFromJsonV2(void)
QVERIFY(!errorString.isEmpty());
qDebug() << errorString;
QJsonArray badCoordinateArray_second;
QJsonObject badCoordinateArray_second;
badCoordinateArray_second << -10.0 << -20.0 << true;
badObject = jsonObject;
badObject.remove("coordinate");
......@@ -360,9 +360,9 @@ void MissionItemTest::_testLoadFromJsonV2(void)
QVERIFY(!errorString.isEmpty());
qDebug() << errorString;
QJsonArray badCoordinateArray2;
QJsonObject badCoordinateArray2;
badCoordinateArray2 << 1 << 2;
QJsonArray badCoordinateArray_third;
QJsonObject badCoordinateArray_third;
badCoordinateArray_third << -10.0 << -20.0 << badCoordinateArray2;
badObject = jsonObject;
badObject.remove("coordinate");
......@@ -412,7 +412,7 @@ void MissionItemTest::_testLoadFromJsonV3(void)
// Incorrect param count
badObject = jsonObject;
QJsonArray rgParam = badObject[MissionItem::_jsonParamsKey].toArray();
QJsonObject rgParam = badObject[MissionItem::_jsonParamsKey].toArray();
rgParam.removeFirst();
badObject[MissionItem::_jsonParamsKey] = rgParam;
QCOMPARE(missionItem.load(badObject, _seq, errorString), false);
......@@ -450,7 +450,7 @@ void MissionItemTest::_testSimpleLoadFromJson(void)
SimpleMissionItem simpleMissionItem(_masterController, false /* flyView */, false /* forLoad */, nullptr);
QString errorString;
QJsonArray coordinateArray;
QJsonObject coordinateArray;
QJsonObject jsonObject;
coordinateArray << -10.0 << -20.0 <<-30.0;
......@@ -460,7 +460,7 @@ void MissionItemTest::_testSimpleLoadFromJson(void)
jsonObject.insert(VisualMissionItem::jsonTypeKey, VisualMissionItem::jsonTypeSimpleItemValue);
jsonObject.insert(MissionItem::_jsonCoordinateKey, coordinateArray);
QJsonArray rgParams = { 10, 20, 30, 40 };
QJsonObject rgParams = { 10, 20, 30, 40 };
jsonObject.insert(MissionItem::_jsonParamsKey, rgParams);
QVERIFY(simpleMissionItem.load(jsonObject, _seq, errorString));
......@@ -489,7 +489,7 @@ void MissionItemTest::_testSaveToJson(void)
QJsonObject MissionItemTest::_createV1Json(void)
{
QJsonObject jsonObject;
QJsonArray coordinateArray;
QJsonObject coordinateArray;
coordinateArray << -10.0 << -20.0 <<-30.0;
jsonObject.insert(MissionItem::_jsonAutoContinueKey, true);
......@@ -508,7 +508,7 @@ QJsonObject MissionItemTest::_createV1Json(void)
QJsonObject MissionItemTest::_createV2Json(void)
{
QJsonObject jsonObject;
QJsonArray coordinateArray;
QJsonObject coordinateArray;
coordinateArray << -10.0 << -20.0 <<-30.0;
jsonObject.insert(MissionItem::_jsonAutoContinueKey, true);
......@@ -517,7 +517,7 @@ QJsonObject MissionItemTest::_createV2Json(void)
jsonObject.insert(VisualMissionItem::jsonTypeKey, VisualMissionItem::jsonTypeSimpleItemValue);
jsonObject.insert(MissionItem::_jsonCoordinateKey, coordinateArray);
QJsonArray rgParams = { 10, 20, 30, 40 };
QJsonObject rgParams = { 10, 20, 30, 40 };
jsonObject.insert(MissionItem::_jsonParamsKey, rgParams);
return jsonObject;
......@@ -533,10 +533,10 @@ QJsonObject MissionItemTest::_createV3Json(bool allNaNs)
jsonObject.insert(VisualMissionItem::jsonTypeKey, VisualMissionItem::jsonTypeSimpleItemValue);
if (allNaNs) {
QJsonArray rgParams = { NAN, NAN, NAN, NAN, NAN, NAN, NAN };