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
 

Variables

constexpr int _maxRecursionDepth = 32
 
constexpr const char * _errorPrefix = QT_TR_NOOP("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 85 of file GeoJsonHelper.cc.

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

◆ 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 207 of file GeoJsonHelper.cc.

References errorString, and JsonHelper::loadGeoCoordinate().

◆ loadPolygonFromFile()

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

Definition at line 125 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 166 of file GeoJsonHelper.cc.

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

◆ 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 212 of file GeoJsonHelper.cc.

References JsonHelper::saveGeoCoordinate().

Variable Documentation

◆ _errorPrefix

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

◆ _maxRecursionDepth

constexpr int GeoJsonHelper::_maxRecursionDepth = 32
constexpr

Definition at line 22 of file GeoJsonHelper.cc.

Referenced by _extractShapeValuesRecursive().