QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCGeoBoundingCube.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QObject>
4#include <QtPositioning/QGeoCoordinate>
5#include <QtQmlIntegration/QtQmlIntegration>
6
7// A bounding "cube" for small surface areas (doesn't take in consideration earth's curvature)
8// Coordinate system makes NW Up Left Bottom (0,0,0) and SE Bottom Right Top (y,x,z)
9class QGCGeoBoundingCube : public QObject
10{
11 Q_OBJECT
12 QML_ELEMENT
13 QML_UNCREATABLE("")
14public:
15 QGCGeoBoundingCube(QObject* parent = nullptr);
16
18 : QObject()
19 {
20 pointNW = other.pointNW;
21 pointSE = other.pointSE;
22 }
23
24 QGCGeoBoundingCube(QGeoCoordinate p1, QGeoCoordinate p2)
25 : pointNW(p1)
26 , pointSE(p2)
27 {
28 }
29
30 Q_PROPERTY(QGeoCoordinate pointNW MEMBER pointNW CONSTANT)
31 Q_PROPERTY(QGeoCoordinate pointSE MEMBER pointSE CONSTANT)
32
33 Q_INVOKABLE void reset ();
34 Q_INVOKABLE bool isValid () const;
35 Q_INVOKABLE QGeoCoordinate center () const;
36
37 inline bool operator ==(const QGCGeoBoundingCube& other) const
38 {
39 return pointNW == other.pointNW && pointSE == other.pointSE;
40 }
41
42 bool operator ==(const QList<QGeoCoordinate>& coords) const;
43
44 inline bool operator !=(const QGCGeoBoundingCube& other)
45 {
46 return !(*this == other);
47 }
48
50 {
51 pointNW = other.pointNW;
52 pointSE = other.pointSE;
53 return *this;
54 }
55
56 //-- 2D
57 Q_INVOKABLE QList<QGeoCoordinate> polygon2D(double clipTo = 0.0) const;
58
59 Q_INVOKABLE double width () const;
60 Q_INVOKABLE double height () const;
61 Q_INVOKABLE double area () const;
62 Q_INVOKABLE double radius () const;
63
64 QGeoCoordinate pointNW;
65 QGeoCoordinate pointSE;
66 static double MaxAlt;
67 static double MinAlt;
68 static double MaxNorth;
69 static double MaxSouth;
70 static double MaxWest;
71 static double MaxEast;
72};
QGeoCoordinate center() const
QGCGeoBoundingCube(QGeoCoordinate p1, QGeoCoordinate p2)
QGeoCoordinate pointNW MEMBER pointNW CONSTANT(QGeoCoordinate pointSE MEMBER pointSE CONSTANT) 1 void reset()
QList< QGeoCoordinate > polygon2D(double clipTo=0.0) const
bool operator!=(const QGCGeoBoundingCube &other)
bool operator==(const QGCGeoBoundingCube &other) const
const QGCGeoBoundingCube & operator=(const QGCGeoBoundingCube &other)
QGCGeoBoundingCube(const QGCGeoBoundingCube &other)