|
QGroundControl
Ground Control Station for MAVLink Drones
|
Classes | |
| struct | KeyValidateInfo |
Functions | |
| QStringList | _addDefaultLocKeys (QJsonObject &jsonObject) |
| QJsonObject | _translateRoot (QJsonObject &jsonObject, const QString &translateContext, const QStringList &translateKeys) |
| QJsonObject | _translateObject (QJsonObject &jsonObject, const QString &translateContext, const QStringList &translateKeys) |
| QJsonArray | _translateArray (QJsonArray &jsonArray, const QString &translateContext, const QStringList &translateKeys) |
| QTranslator * | translator () |
| void | saveQGCJsonFileHeader (QJsonObject &jsonObject, const QString &fileType, int version) |
| Saves the standard file header the json object. | |
| bool | validateExternalQGCJsonFile (const QJsonObject &jsonObject, const QString &expectedFileType, int minSupportedVersion, int maxSupportedVersion, int &version, QString &errorString) |
| returned error string if validation fails | |
| bool | validateInternalQGCJsonFile (const QJsonObject &jsonObject, const QString &expectedFileType, int minSupportedVersion, int maxSupportedVersion, int &version, QString &errorString) |
| returned error string if validation fails | |
| QJsonObject | openInternalQGCJsonFile (const QString &jsonFilename, const QString &expectedFileType, int minSupportedVersion, int maxSupportedVersion, int &version, QString &errorString) |
| returned error string if validation fails | |
| bool | validateKeys (const QJsonObject &jsonObject, const QList< KeyValidateInfo > &keyInfo, QString &errorString) |
| bool | loadGeoCoordinate (const QJsonValue &jsonValue, bool altitudeRequired, QGeoCoordinate &coordinate, QString &errorString, bool geoJsonFormat=false) |
| if true, use [lon, lat], [lat, lon] otherwise | |
| void | saveGeoCoordinate (const QGeoCoordinate &coordinate, bool writeAltitude, QJsonValue &jsonValue, bool geoJsonFormat=false) |
| bool | loadGeoCoordinateArray (const QJsonValue &jsonValue, bool altitudeRequired, QVariantList &rgVarPoints, QString &errorString) |
| returned error string if load failure | |
| bool | loadGeoCoordinateArray (const QJsonValue &jsonValue, bool altitudeRequired, QList< QGeoCoordinate > &rgPoints, QString &errorString) |
| returned error string if load failure | |
| void | saveGeoCoordinateArray (const QVariantList &rgVarPoints, bool writeAltitude, QJsonValue &jsonValue) |
| Saves a list of QGeoCoordinates to a json array. | |
| void | saveGeoCoordinateArray (const QList< QGeoCoordinate > &rgPoints, bool writeAltitude, QJsonValue &jsonValue) |
| json value to save to | |
| bool | loadPolygon (const QJsonArray &polygonArray, QmlObjectListModel &list, QObject *parent, QString &errorString) |
| Loads a polygon from an array. | |
| void | savePolygon (const QmlObjectListModel &list, QJsonArray &polygonArray) |
| Saves a polygon to a json array. | |
Variables | |
| constexpr const char * | _translateKeysKey = "translateKeys" |
| constexpr const char * | _arrayIDKeysKey = "_arrayIDKeys" |
| constexpr const char * | _jsonGroundStationKey = "groundStation" |
| constexpr const char * | _jsonGroundStationValue = "QGroundControl" |
| constexpr const char * | jsonVersionKey = "version" |
| constexpr const char * | jsonFileTypeKey = "fileType" |
Json manipulation helper class. Primarily used for parsing and processing Fact metadata.
| QStringList JsonHelper::_addDefaultLocKeys | ( | QJsonObject & | jsonObject | ) |
Definition at line 37 of file JsonHelper.cc.
References _arrayIDKeysKey, _translateKeysKey, jsonFileTypeKey, FactMetaData::qgcFileType, and MissionCommandList::qgcFileType.
Referenced by openInternalQGCJsonFile().
| QJsonArray JsonHelper::_translateArray | ( | QJsonArray & | jsonArray, |
| const QString & | translateContext, | ||
| const QStringList & | translateKeys | ||
| ) |
Definition at line 116 of file JsonHelper.cc.
References _translateObject().
Referenced by _translateObject().
| QJsonObject JsonHelper::_translateObject | ( | QJsonObject & | jsonObject, |
| const QString & | translateContext, | ||
| const QStringList & | translateKeys | ||
| ) |
Definition at line 76 of file JsonHelper.cc.
References _translateArray(), _translateObject(), and translator().
Referenced by _translateArray(), _translateObject(), and _translateRoot().
| QJsonObject JsonHelper::_translateRoot | ( | QJsonObject & | jsonObject, |
| const QString & | translateContext, | ||
| const QStringList & | translateKeys | ||
| ) |
Definition at line 70 of file JsonHelper.cc.
References _translateObject().
Referenced by openInternalQGCJsonFile().
| bool JsonHelper::loadGeoCoordinate | ( | const QJsonValue & | jsonValue, |
| bool | altitudeRequired, | ||
| QGeoCoordinate & | coordinate, | ||
| QString & | errorString, | ||
| bool | geoJsonFormat = false |
||
| ) |
if true, use [lon, lat], [lat, lon] otherwise
Loads a QGeoCoordinate Stored as array [ lat, lon, alt ]
| jsonValue | json value to load from |
| altitudeRequired | true: altitude must be specified |
| coordinate | returned QGeoCordinate |
| errorString | returned error string if load failure |
Definition at line 132 of file JsonHelper.cc.
References errorString, and JsonParsing::possibleNaNJsonValue().
Referenced by LandingComplexItem::_load(), GeoFenceController::load(), QGCMapCircle::loadFromJson(), loadGeoCoordinateArray(), GeoJsonHelper::loadGeoJsonCoordinate(), and loadPolygon().
| bool JsonHelper::loadGeoCoordinateArray | ( | const QJsonValue & | jsonValue, |
| bool | altitudeRequired, | ||
| QList< QGeoCoordinate > & | rgPoints, | ||
| QString & | errorString | ||
| ) |
returned error string if load failure
| jsonValue | json value which contains points |
| altitudeRequired | true: altitude field must be specified |
| rgPoints | returned points |
Definition at line 304 of file JsonHelper.cc.
References errorString, and loadGeoCoordinateArray().
| bool JsonHelper::loadGeoCoordinateArray | ( | const QJsonValue & | jsonValue, |
| bool | altitudeRequired, | ||
| QVariantList & | rgVarPoints, | ||
| QString & | errorString | ||
| ) |
returned error string if load failure
Loads a list of QGeoCoordinates from a json array
| jsonValue | json value which contains points |
| altitudeRequired | true: altitude field must be specified |
| rgVarPoints | returned points |
Definition at line 282 of file JsonHelper.cc.
References errorString, and loadGeoCoordinate().
Referenced by TransectStyleComplexItem::_load(), RallyPointController::load(), QGCMapPolygon::loadFromJson(), QGCMapPolyline::loadFromJson(), and loadGeoCoordinateArray().
| bool JsonHelper::loadPolygon | ( | const QJsonArray & | polygonArray, |
| QmlObjectListModel & | list, | ||
| QObject * | parent, | ||
| QString & | errorString | ||
| ) |
Loads a polygon from an array.
returned error string if load failure
| polygonArray | Array of coordinates |
| list | Empty list to add vertices to |
| parent | parent for newly allocated QGCQGeoCoordinates |
Definition at line 368 of file JsonHelper.cc.
References QmlObjectListModel::append(), QmlObjectListModel::clearAndDeleteContents(), errorString, and loadGeoCoordinate().
| QJsonObject JsonHelper::openInternalQGCJsonFile | ( | const QString & | jsonFilename, |
| const QString & | expectedFileType, | ||
| int | minSupportedVersion, | ||
| int | maxSupportedVersion, | ||
| int & | version, | ||
| QString & | errorString | ||
| ) |
returned error string if validation fails
| jsonFilename | Json file to open |
| expectedFileType | correct file type for file |
| minSupportedVersion | minimum supported version |
| maxSupportedVersion | maximum supported major version |
| version | returned file version |
Definition at line 239 of file JsonHelper.cc.
References _addDefaultLocKeys(), _translateRoot(), errorString, QGCNetworkHelper::parseCompressedJson(), QGCFileHelper::readFile(), and validateInternalQGCJsonFile().
Referenced by FactMetaData::createMapFromJsonFile().
| void JsonHelper::saveGeoCoordinate | ( | const QGeoCoordinate & | coordinate, |
| bool | writeAltitude, | ||
| QJsonValue & | jsonValue, | ||
| bool | geoJsonFormat = false |
||
| ) |
Saves a QGeoCoordinate Stored as array [ lat, lon, alt ]
| coordinate | QGeoCoordinate to save |
| writeAltitude | true: write altitude to json |
| jsonValue | json value to save to |
Definition at line 170 of file JsonHelper.cc.
Referenced by LandingComplexItem::_save(), GeoFenceController::save(), MissionController::save(), RallyPointController::save(), saveGeoCoordinateArray(), GeoJsonHelper::saveGeoJsonCoordinate(), and savePolygon().
| void JsonHelper::saveGeoCoordinateArray | ( | const QList< QGeoCoordinate > & | rgPoints, |
| bool | writeAltitude, | ||
| QJsonValue & | jsonValue | ||
| ) |
json value to save to
| rgPoints | points to save |
| writeAltitude | true: write altitide value |
Definition at line 333 of file JsonHelper.cc.
References saveGeoCoordinateArray().
| void JsonHelper::saveGeoCoordinateArray | ( | const QVariantList & | rgVarPoints, |
| bool | writeAltitude, | ||
| QJsonValue & | jsonValue | ||
| ) |
Saves a list of QGeoCoordinates to a json array.
json value to save to
| rgVarPoints | points to save |
| writeAltitude | true: write altitide value |
Definition at line 321 of file JsonHelper.cc.
References saveGeoCoordinate().
Referenced by TransectStyleComplexItem::_save(), saveGeoCoordinateArray(), QGCMapPolygon::saveToJson(), and QGCMapPolyline::saveToJson().
| void JsonHelper::savePolygon | ( | const QmlObjectListModel & | list, |
| QJsonArray & | polygonArray | ||
| ) |
Saves a polygon to a json array.
Array to save into
| list | List which contains vertices |
Definition at line 383 of file JsonHelper.cc.
References QmlObjectListModel::count(), saveGeoCoordinate(), and QmlObjectListModel::value().
| void JsonHelper::saveQGCJsonFileHeader | ( | QJsonObject & | jsonObject, |
| const QString & | fileType, | ||
| int | version | ||
| ) |
Saves the standard file header the json object.
version number for file
| jsonObject | root json object |
| fileType | file type for file |
Definition at line 275 of file JsonHelper.cc.
References _jsonGroundStationKey, _jsonGroundStationValue, jsonFileTypeKey, and jsonVersionKey.
Referenced by PlanMasterController::saveToJson().
| QTranslator * JsonHelper::translator | ( | ) |
Definition at line 127 of file JsonHelper.cc.
References s_jsonTranslator.
Referenced by _translateObject(), and QGCApplication::setLanguage().
| bool JsonHelper::validateExternalQGCJsonFile | ( | const QJsonObject & | jsonObject, |
| const QString & | expectedFileType, | ||
| int | minSupportedVersion, | ||
| int | maxSupportedVersion, | ||
| int & | version, | ||
| QString & | errorString | ||
| ) |
returned error string if validation fails
Validates the standard parts of an external QGC json file (Plan file, ...): jsonFileTypeKey - Required and checked to be equal to expectedFileType jsonVersionKey - Required and checked to be below supportedMajorVersion, supportedMinorVersion jsonGroundStationKey - Required and checked to be string type
| jsonObject | json object to validate |
| expectedFileType | correct file type for file |
| minSupportedVersion | minimum supported version |
| maxSupportedVersion | maximum supported major version |
| version | returned file version |
Definition at line 223 of file JsonHelper.cc.
References _jsonGroundStationKey, errorString, validateInternalQGCJsonFile(), and validateKeys().
Referenced by PlanMasterController::loadFromFile().
| bool JsonHelper::validateInternalQGCJsonFile | ( | const QJsonObject & | jsonObject, |
| const QString & | expectedFileType, | ||
| int | minSupportedVersion, | ||
| int | maxSupportedVersion, | ||
| int & | version, | ||
| QString & | errorString | ||
| ) |
returned error string if validation fails
Validates the standard parts of a internal QGC json file (FactMetaData, ...): jsonFileTypeKey - Required and checked to be equal to expectedFileType jsonVersionKey - Required and checked to be below supportedMajorVersion, supportedMinorVersion
| jsonObject | json object to validate |
| expectedFileType | correct file type for file |
| minSupportedVersion | minimum supported version |
| maxSupportedVersion | maximum supported major version |
| version | returned file version |
Definition at line 188 of file JsonHelper.cc.
References errorString, jsonFileTypeKey, jsonVersionKey, and validateKeys().
Referenced by openInternalQGCJsonFile(), and validateExternalQGCJsonFile().
| bool JsonHelper::validateKeys | ( | const QJsonObject & | jsonObject, |
| const QList< KeyValidateInfo > & | keyInfo, | ||
| QString & | errorString | ||
| ) |
Referenced by TransectStyleComplexItem::_load(), LandingComplexItem::_load(), FactMetaData::createFromJsonObject(), FactMetaData::createMapFromJsonFile(), TerrainTileCopernicus::getJsonFromData(), FixedWingLandingComplexItem::load(), StructureScanComplexItem::load(), SurveyComplexItem::load(), VTOLLandingComplexItem::load(), CameraCalc::load(), MissionItem::load(), SimpleMissionItem::load(), CameraSpec::load(), GeoFenceController::load(), RallyPointController::load(), PlanMasterController::loadFromFile(), QGCFencePolygon::loadFromJson(), QGCFenceCircle::loadFromJson(), QGCMapCircle::loadFromJson(), TerrainTileCopernicus::serializeFromData(), CompInfoGeneral::setJson(), CompInfoParam::setJson(), validateExternalQGCJsonFile(), and validateInternalQGCJsonFile().
|
constexpr |
Definition at line 32 of file JsonHelper.cc.
Referenced by _addDefaultLocKeys().
|
constexpr |
Definition at line 33 of file JsonHelper.cc.
Referenced by saveQGCJsonFileHeader(), and validateExternalQGCJsonFile().
|
constexpr |
Definition at line 34 of file JsonHelper.cc.
Referenced by saveQGCJsonFileHeader().
|
constexpr |
Definition at line 31 of file JsonHelper.cc.
Referenced by _addDefaultLocKeys().
|
constexpr |
Definition at line 110 of file JsonHelper.h.
Referenced by _addDefaultLocKeys(), saveQGCJsonFileHeader(), and validateInternalQGCJsonFile().
|
constexpr |
Definition at line 109 of file JsonHelper.h.
Referenced by TransectStyleComplexItem::_load(), LandingComplexItem::_load(), TransectStyleComplexItem::_save(), FixedWingLandingComplexItem::load(), StructureScanComplexItem::load(), SurveyComplexItem::load(), VTOLLandingComplexItem::load(), CameraCalc::load(), GeoFenceController::load(), RallyPointController::load(), QGCFencePolygon::loadFromJson(), QGCFenceCircle::loadFromJson(), FixedWingLandingComplexItem::save(), StructureScanComplexItem::save(), VTOLLandingComplexItem::save(), CameraCalc::save(), GeoFenceController::save(), MissionController::save(), RallyPointController::save(), saveQGCJsonFileHeader(), QGCFenceCircle::saveToJson(), QGCFencePolygon::saveToJson(), CompInfoGeneral::setJson(), CompInfoParam::setJson(), and validateInternalQGCJsonFile().