QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCGeo.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * (c) 2009-2024 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 *
5 * QGroundControl is licensed according to the terms in the file
6 * COPYING.md in the root of the source code directory.
7 *
8 ****************************************************************************/
9
10#pragma once
11
24
25#include <QtCore/QLoggingCategory>
26#include <QtGui/QVector3D>
27#include <QtPositioning/QGeoCoordinate>
28
30
31namespace QGCGeo
32{
33
34// ============================================================================
35// NED (North-East-Down) Local Tangent Plane
36// ============================================================================
37
45void convertGeoToNed(const QGeoCoordinate &coord, const QGeoCoordinate &origin, double &x, double &y, double &z);
46
53void convertNedToGeo(double x, double y, double z, const QGeoCoordinate &origin, QGeoCoordinate &coord);
54
55// ============================================================================
56// ENU (East-North-Up) Local Tangent Plane
57// ============================================================================
58
64QVector3D convertGpsToEnu(const QGeoCoordinate &coord, const QGeoCoordinate &ref);
65
70QGeoCoordinate convertEnuToGps(const QVector3D &enu, const QGeoCoordinate &ref);
71
72// ============================================================================
73// ECEF (Earth-Centered Earth-Fixed)
74// ============================================================================
75
80QVector3D convertGeodeticToEcef(const QGeoCoordinate &coord);
81
85QGeoCoordinate convertEcefToGeodetic(const QVector3D &ecef);
86
91QVector3D convertEcefToEnu(const QVector3D &ecef, const QGeoCoordinate &ref);
92
97QVector3D convertEnuToEcef(const QVector3D &enu, const QGeoCoordinate &ref);
98
99// ============================================================================
100// UTM (Universal Transverse Mercator)
101// ============================================================================
102
108int convertGeoToUTM(const QGeoCoordinate &coord, double &easting, double &northing);
109
117bool convertUTMToGeo(double easting, double northing, int zone, bool southhemi, QGeoCoordinate &coord);
118
119// ============================================================================
120// MGRS (Military Grid Reference System)
121// ============================================================================
122
126QString convertGeoToMGRS(const QGeoCoordinate &coord);
127
132bool convertMGRSToGeo(const QString &mgrs, QGeoCoordinate &coord);
133
134// ============================================================================
135// Geodesic Calculations (Great Circle on Ellipsoid)
136// ============================================================================
137
143double geodesicDistance(const QGeoCoordinate &from, const QGeoCoordinate &to);
144
150double geodesicAzimuth(const QGeoCoordinate &from, const QGeoCoordinate &to);
151
157QGeoCoordinate geodesicDestination(const QGeoCoordinate &from, double azimuth, double distance);
158
159// ============================================================================
160// Path and Polygon Calculations
161// ============================================================================
162
166double pathLength(const QList<QGeoCoordinate> &path);
167
172double polygonArea(const QList<QGeoCoordinate> &polygon);
173
177double polygonPerimeter(const QList<QGeoCoordinate> &polygon);
178
185QList<QGeoCoordinate> interpolatePath(const QGeoCoordinate &from, const QGeoCoordinate &to, int numPoints);
186
193QGeoCoordinate interpolateAtDistance(const QGeoCoordinate &from, const QGeoCoordinate &to, double distance);
194
195} // namespace QGCGeo
Q_DECLARE_LOGGING_CATEGORY(AndroidSerialLog)
QList< QGeoCoordinate > interpolatePath(const QGeoCoordinate &from, const QGeoCoordinate &to, int numPoints)
Definition QGCGeo.cc:308
QVector3D convertEcefToEnu(const QVector3D &ecef, const QGeoCoordinate &ref)
Definition QGCGeo.cc:116
void convertGeoToNed(const QGeoCoordinate &coord, const QGeoCoordinate &origin, double &x, double &y, double &z)
Definition QGCGeo.cc:34
double polygonPerimeter(const QList< QGeoCoordinate > &polygon)
Definition QGCGeo.cc:292
double geodesicAzimuth(const QGeoCoordinate &from, const QGeoCoordinate &to)
Definition QGCGeo.cc:237
QVector3D convertGeodeticToEcef(const QGeoCoordinate &coord)
Definition QGCGeo.cc:102
QGeoCoordinate geodesicDestination(const QGeoCoordinate &from, double azimuth, double distance)
Definition QGCGeo.cc:250
QGeoCoordinate convertEcefToGeodetic(const QVector3D &ecef)
Definition QGCGeo.cc:109
QString convertGeoToMGRS(const QGeoCoordinate &coord)
Definition QGCGeo.cc:179
double pathLength(const QList< QGeoCoordinate > &path)
Definition QGCGeo.cc:261
double polygonArea(const QList< QGeoCoordinate > &polygon)
Definition QGCGeo.cc:274
double geodesicDistance(const QGeoCoordinate &from, const QGeoCoordinate &to)
Definition QGCGeo.cc:229
QVector3D convertEnuToEcef(const QVector3D &enu, const QGeoCoordinate &ref)
Definition QGCGeo.cc:130
int convertGeoToUTM(const QGeoCoordinate &coord, double &easting, double &northing)
Definition QGCGeo.cc:148
void convertNedToGeo(double x, double y, double z, const QGeoCoordinate &origin, QGeoCoordinate &coord)
Definition QGCGeo.cc:56
QGeoCoordinate convertEnuToGps(const QVector3D &enu, const QGeoCoordinate &ref)
Definition QGCGeo.cc:89
QVector3D convertGpsToEnu(const QGeoCoordinate &coord, const QGeoCoordinate &ref)
Definition QGCGeo.cc:80
bool convertUTMToGeo(double easting, double northing, int zone, bool southhemi, QGeoCoordinate &coord)
Definition QGCGeo.cc:161
QGeoCoordinate interpolateAtDistance(const QGeoCoordinate &from, const QGeoCoordinate &to, double distance)
Definition QGCGeo.cc:349
bool convertMGRSToGeo(const QString &mgrs, QGeoCoordinate &coord)
Definition QGCGeo.cc:205