QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GeoJsonHelper Namespace Reference

Functions

QJsonDocument _loadFile (const QString &filePath, QString &errorString)
 
QVariantList _extractShapeValues (const QVariantList &values)
 
void _extractShapeValuesRecursive (const QVariant &value, QVariantList &shapes, int depth=0)
 
ShapeFileHelper::ShapeType determineShapeType (const QString &filePath, QString &errorString)
 
bool loadPolygonFromFile (const QString &filePath, QList< QGeoCoordinate > &vertices, QString &errorString)
 
bool loadPolylineFromFile (const QString &filePath, QList< QGeoCoordinate > &coords, QString &errorString)
 
bool loadGeoJsonCoordinate (const QJsonValue &jsonValue, bool altitudeRequired, QGeoCoordinate &coordinate, QString &errorString)
 returned error string if load failure
 
void saveGeoJsonCoordinate (const QGeoCoordinate &coordinate, bool writeAltitude, QJsonValue &jsonValue)
 json value to save to
 
bool loadGeoCoordinate (const QJsonValue &jsonValue, bool altitudeRequired, QGeoCoordinate &coordinate, QString &errorString)
 
void saveGeoCoordinate (const QGeoCoordinate &coordinate, bool writeAltitude, QJsonValue &jsonValue)
 Saves a QGeoCoordinate as [lat, lon, alt] array (QGC plan format).
 
bool loadGeoCoordinateArray (const QJsonValue &jsonValue, bool altitudeRequired, QVariantList &rgVarPoints, QString &errorString)
 Loads a list of QGeoCoordinates (QGC plan format) from a json array.
 
bool loadGeoCoordinateArray (const QJsonValue &jsonValue, bool altitudeRequired, QList< QGeoCoordinate > &rgPoints, QString &errorString)
 
void saveGeoCoordinateArray (const QVariantList &rgVarPoints, bool writeAltitude, QJsonValue &jsonValue)
 Saves a list of QGeoCoordinates (QGC plan format) to a json array.
 
void saveGeoCoordinateArray (const QList< QGeoCoordinate > &rgPoints, bool writeAltitude, QJsonValue &jsonValue)
 

Variables

constexpr int _maxRecursionDepth = 32
 
constexpr const char * _errorPrefix = QT_TRANSLATE_NOOP("GeoJsonHelper", "GeoJson file load failed. %1")
 

Function Documentation

◆ _extractShapeValues()

QVariantList GeoJsonHelper::_extractShapeValues ( const QVariantList &  values)

◆ _extractShapeValuesRecursive()

void GeoJsonHelper::_extractShapeValuesRecursive ( const QVariant &  value,
QVariantList &  shapes,
int  depth = 0 
)

◆ _loadFile()

QJsonDocument GeoJsonHelper::_loadFile ( const QString &  filePath,
QString &  errorString 
)

◆ determineShapeType()

ShapeFileHelper::ShapeType GeoJsonHelper::determineShapeType ( const QString &  filePath,
QString &  errorString 
)

Definition at line 86 of file GeoJsonHelper.cc.

References _errorPrefix, _extractShapeValues(), _loadFile(), and errorString.

◆ loadGeoCoordinate()

bool GeoJsonHelper::loadGeoCoordinate ( const QJsonValue &  jsonValue,
bool  altitudeRequired,
QGeoCoordinate &  coordinate,
QString &  errorString 
)

Loads a QGeoCoordinate stored as [lat, lon, alt] array (QGC plan format). For GeoJson [lon, lat, alt] ordering use loadGeoJsonCoordinate.

Definition at line 249 of file GeoJsonHelper.cc.

References errorString, and JsonParsing::possibleNaNJsonValue().

Referenced by LandingComplexItem::_load(), GeoFenceController::load(), QGCMapCircle::loadFromJson(), and loadGeoCoordinateArray().

◆ loadGeoCoordinateArray() [1/2]

bool GeoJsonHelper::loadGeoCoordinateArray ( const QJsonValue &  jsonValue,
bool  altitudeRequired,
QList< QGeoCoordinate > &  rgPoints,
QString &  errorString 
)

Definition at line 317 of file GeoJsonHelper.cc.

References errorString, and loadGeoCoordinateArray().

◆ loadGeoCoordinateArray() [2/2]

bool GeoJsonHelper::loadGeoCoordinateArray ( const QJsonValue &  jsonValue,
bool  altitudeRequired,
QVariantList &  rgVarPoints,
QString &  errorString 
)

Loads a list of QGeoCoordinates (QGC plan format) from a json array.

Definition at line 295 of file GeoJsonHelper.cc.

References errorString, and loadGeoCoordinate().

Referenced by TransectStyleComplexItem::_load(), RallyPointController::load(), QGCMapPolygon::loadFromJson(), QGCMapPolyline::loadFromJson(), and loadGeoCoordinateArray().

◆ loadGeoJsonCoordinate()

bool GeoJsonHelper::loadGeoJsonCoordinate ( const QJsonValue &  jsonValue,
bool  altitudeRequired,
QGeoCoordinate &  coordinate,
QString &  errorString 
)

returned error string if load failure

Loads a QGeoCoordinate Stored as array [ lon, lat, alt ]

Returns
false: validation failed
Parameters
jsonValuejson value to load from
altitudeRequiredtrue: altitude must be specified
coordinatereturned QGeoCordinate

Definition at line 208 of file GeoJsonHelper.cc.

References errorString, and JsonParsing::possibleNaNJsonValue().

◆ loadPolygonFromFile()

bool GeoJsonHelper::loadPolygonFromFile ( const QString &  filePath,
QList< QGeoCoordinate > &  vertices,
QString &  errorString 
)

Definition at line 126 of file GeoJsonHelper.cc.

References _errorPrefix, _extractShapeValues(), _loadFile(), and errorString.

◆ loadPolylineFromFile()

bool GeoJsonHelper::loadPolylineFromFile ( const QString &  filePath,
QList< QGeoCoordinate > &  coords,
QString &  errorString 
)

Definition at line 167 of file GeoJsonHelper.cc.

References _errorPrefix, _extractShapeValues(), _loadFile(), and errorString.

◆ saveGeoCoordinate()

void GeoJsonHelper::saveGeoCoordinate ( const QGeoCoordinate &  coordinate,
bool  writeAltitude,
QJsonValue &  jsonValue 
)

Saves a QGeoCoordinate as [lat, lon, alt] array (QGC plan format).

Definition at line 283 of file GeoJsonHelper.cc.

Referenced by LandingComplexItem::_save(), GeoFenceController::save(), MissionController::save(), RallyPointController::save(), saveGeoCoordinateArray(), and QGCMapCircle::saveToJson().

◆ saveGeoCoordinateArray() [1/2]

void GeoJsonHelper::saveGeoCoordinateArray ( const QList< QGeoCoordinate > &  rgPoints,
bool  writeAltitude,
QJsonValue &  jsonValue 
)

Definition at line 346 of file GeoJsonHelper.cc.

References saveGeoCoordinateArray().

◆ saveGeoCoordinateArray() [2/2]

void GeoJsonHelper::saveGeoCoordinateArray ( const QVariantList &  rgVarPoints,
bool  writeAltitude,
QJsonValue &  jsonValue 
)

Saves a list of QGeoCoordinates (QGC plan format) to a json array.

Definition at line 334 of file GeoJsonHelper.cc.

References saveGeoCoordinate().

Referenced by TransectStyleComplexItem::_save(), saveGeoCoordinateArray(), QGCMapPolygon::saveToJson(), and QGCMapPolyline::saveToJson().

◆ saveGeoJsonCoordinate()

void GeoJsonHelper::saveGeoJsonCoordinate ( const QGeoCoordinate &  coordinate,
bool  writeAltitude,
QJsonValue &  jsonValue 
)

json value to save to

Saves a QGeoCoordinate Stored as array [ lon, lat, alt ]

Parameters
coordinateQGeoCoordinate to save
writeAltitudetrue: write altitude to json

Definition at line 239 of file GeoJsonHelper.cc.

Variable Documentation

◆ _errorPrefix

constexpr const char* GeoJsonHelper::_errorPrefix = QT_TRANSLATE_NOOP("GeoJsonHelper", "GeoJson file load failed. %1")
constexpr

◆ _maxRecursionDepth

constexpr int GeoJsonHelper::_maxRecursionDepth = 32
constexpr

Definition at line 23 of file GeoJsonHelper.cc.

Referenced by _extractShapeValuesRecursive().