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 <QtGui/QVector3D>
26#include <QtPositioning/QGeoCoordinate>
27
28namespace QGCGeo
29{
30
31// ============================================================================
32// NED (North-East-Down) Local Tangent Plane
33// ============================================================================
34
42void convertGeoToNed(const QGeoCoordinate &coord, const QGeoCoordinate &origin, double &x, double &y, double &z);
43
50void convertNedToGeo(double x, double y, double z, const QGeoCoordinate &origin, QGeoCoordinate &coord);
51
52// ============================================================================
53// ENU (East-North-Up) Local Tangent Plane
54// ============================================================================
55
61QVector3D convertGpsToEnu(const QGeoCoordinate &coord, const QGeoCoordinate &ref);
62
67QGeoCoordinate convertEnuToGps(const QVector3D &enu, const QGeoCoordinate &ref);
68
69// ============================================================================
70// ECEF (Earth-Centered Earth-Fixed)
71// ============================================================================
72
77QVector3D convertGeodeticToEcef(const QGeoCoordinate &coord);
78
82QGeoCoordinate convertEcefToGeodetic(const QVector3D &ecef);
83
88QVector3D convertEcefToEnu(const QVector3D &ecef, const QGeoCoordinate &ref);
89
94QVector3D convertEnuToEcef(const QVector3D &enu, const QGeoCoordinate &ref);
95
96// ============================================================================
97// UTM (Universal Transverse Mercator)
98// ============================================================================
99
105int convertGeoToUTM(const QGeoCoordinate &coord, double &easting, double &northing);
106
114bool convertUTMToGeo(double easting, double northing, int zone, bool southhemi, QGeoCoordinate &coord);
115
116// ============================================================================
117// MGRS (Military Grid Reference System)
118// ============================================================================
119
123QString convertGeoToMGRS(const QGeoCoordinate &coord);
124
129bool convertMGRSToGeo(const QString &mgrs, QGeoCoordinate &coord);
130
131// ============================================================================
132// DMS (Degrees Minutes Seconds)
133// ============================================================================
134
139QString convertDegreesToDMS(double value, bool isLatitude);
140
150double convertDMSToDegrees(const QString &text, bool isLatitude, bool *ok = nullptr);
151
157bool convertDMSToGeo(const QString &latitude, const QString &longitude, QGeoCoordinate &coord);
158
159// ============================================================================
160// Geodesic Calculations (Great Circle on Ellipsoid)
161// ============================================================================
162
168double geodesicDistance(const QGeoCoordinate &from, const QGeoCoordinate &to);
169
175double geodesicAzimuth(const QGeoCoordinate &from, const QGeoCoordinate &to);
176
182QGeoCoordinate geodesicDestination(const QGeoCoordinate &from, double azimuth, double distance);
183
184// ============================================================================
185// Path and Polygon Calculations
186// ============================================================================
187
191double pathLength(const QList<QGeoCoordinate> &path);
192
197double polygonArea(const QList<QGeoCoordinate> &polygon);
198
202double polygonPerimeter(const QList<QGeoCoordinate> &polygon);
203
210QList<QGeoCoordinate> interpolatePath(const QGeoCoordinate &from, const QGeoCoordinate &to, int numPoints);
211
218QGeoCoordinate interpolateAtDistance(const QGeoCoordinate &from, const QGeoCoordinate &to, double distance);
219
220} // namespace QGCGeo
QList< QGeoCoordinate > interpolatePath(const QGeoCoordinate &from, const QGeoCoordinate &to, int numPoints)
Definition QGCGeo.cc:416
QVector3D convertEcefToEnu(const QVector3D &ecef, const QGeoCoordinate &ref)
Definition QGCGeo.cc:118
void convertGeoToNed(const QGeoCoordinate &coord, const QGeoCoordinate &origin, double &x, double &y, double &z)
Definition QGCGeo.cc:36
double polygonPerimeter(const QList< QGeoCoordinate > &polygon)
Definition QGCGeo.cc:400
double geodesicAzimuth(const QGeoCoordinate &from, const QGeoCoordinate &to)
Definition QGCGeo.cc:345
QVector3D convertGeodeticToEcef(const QGeoCoordinate &coord)
Definition QGCGeo.cc:104
QGeoCoordinate geodesicDestination(const QGeoCoordinate &from, double azimuth, double distance)
Definition QGCGeo.cc:358
double convertDMSToDegrees(const QString &text, bool isLatitude, bool *ok)
Definition QGCGeo.cc:245
QGeoCoordinate convertEcefToGeodetic(const QVector3D &ecef)
Definition QGCGeo.cc:111
QString convertGeoToMGRS(const QGeoCoordinate &coord)
Definition QGCGeo.cc:181
double pathLength(const QList< QGeoCoordinate > &path)
Definition QGCGeo.cc:369
double polygonArea(const QList< QGeoCoordinate > &polygon)
Definition QGCGeo.cc:382
double geodesicDistance(const QGeoCoordinate &from, const QGeoCoordinate &to)
Definition QGCGeo.cc:337
bool convertDMSToGeo(const QString &latitude, const QString &longitude, QGeoCoordinate &coord)
Definition QGCGeo.cc:318
QVector3D convertEnuToEcef(const QVector3D &enu, const QGeoCoordinate &ref)
Definition QGCGeo.cc:132
int convertGeoToUTM(const QGeoCoordinate &coord, double &easting, double &northing)
Definition QGCGeo.cc:150
void convertNedToGeo(double x, double y, double z, const QGeoCoordinate &origin, QGeoCoordinate &coord)
Definition QGCGeo.cc:58
QGeoCoordinate convertEnuToGps(const QVector3D &enu, const QGeoCoordinate &ref)
Definition QGCGeo.cc:91
QVector3D convertGpsToEnu(const QGeoCoordinate &coord, const QGeoCoordinate &ref)
Definition QGCGeo.cc:82
bool convertUTMToGeo(double easting, double northing, int zone, bool southhemi, QGeoCoordinate &coord)
Definition QGCGeo.cc:163
QString convertDegreesToDMS(double value, bool isLatitude)
Definition QGCGeo.cc:231
QGeoCoordinate interpolateAtDistance(const QGeoCoordinate &from, const QGeoCoordinate &to, double distance)
Definition QGCGeo.cc:457
bool convertMGRSToGeo(const QString &mgrs, QGeoCoordinate &coord)
Definition QGCGeo.cc:207