3#include <QtCore/QObject>
4#include <QtPositioning/QGeoCoordinate>
5#include <QtCore/QVariantList>
6#include <QtGui/QPolygonF>
7#include <QtXml/QDomElement>
42 Q_INVOKABLE
void clear(
void);
43 Q_INVOKABLE
void appendVertex(
const QGeoCoordinate& coordinate);
52 Q_INVOKABLE
void adjustVertex(
int vertexIndex,
const QGeoCoordinate coordinate);
61 Q_INVOKABLE
void offset(
double distance);
94 double area(
void)
const;
100 int count (
void)
const {
return _polygonPath.count(); }
101 bool dirty (
void)
const {
return _dirty; }
103 QGeoCoordinate
center (
void)
const {
return _center; }
107 bool empty (
void)
const {
return _polygonModel.
count() == 0; }
112 QVariantList
path (
void)
const {
return _polygonPath; }
118 void setCenter (QGeoCoordinate newCenter);
142 void _polygonModelCountChanged(
int count);
143 void _polygonModelDirtyChanged(
bool dirty);
144 void _updateCenter(
void);
148 QPolygonF _toPolygonF (
void)
const;
149 QGeoCoordinate _coordFromPointF (
const QPointF& point)
const;
150 QPointF _pointFFromCoord (
const QGeoCoordinate& coordinate)
const;
152 QVariantList _polygonPath;
155 QGeoCoordinate _center;
156 bool _centerDrag =
false;
157 bool _ignoreCenterUpdates =
false;
158 bool _interactive =
false;
159 bool _traceMode =
false;
160 bool _showAltColor =
false;
161 int _selectedVertexIndex = -1;
162 bool _deferredPathChanged =
false;
Used to convert a Plan to a KML document.
void interactiveChanged(bool interactive)
~QGCMapPolygon() override
int selectedVertex() const
void dirtyChanged(bool dirty)
void selectVertex(int index)
bool loadKMLOrSHPFile(const QString &file)
bool isEmptyChanged(void)
void adjustVertex(int vertexIndex, const QGeoCoordinate coordinate)
QmlObjectListModel & pathModel(void)
double area(void) const
Returns the area of the polygon in meters squared.
void setCenter(QGeoCoordinate newCenter)
void splitPolygonSegment(int vertexIndex)
Splits the segment comprised of vertextIndex -> vertexIndex + 1.
bool traceMode(void) const
QGeoCoordinate center(void) const
void setTraceMode(bool traceMode)
QmlObjectListModel * qmlPathModel(void)
QList< QGeoCoordinate > coordinateList(void) const
Returns the path in a list of QGeoCoordinate's format.
void offset(double distance)
Offsets the current polygon edges by the specified distance in meters.
void setDirty(bool dirty)
bool centerDrag(void) const
void selectedVertexChanged(int index)
void traceModeChanged(bool traceMode)
bool showAltColor(void) const
bool containsCoordinate(const QGeoCoordinate &coordinate) const
Returns true if the specified coordinate is within the polygon.
QGeoCoordinate vertexCoordinate(int vertex) const
Returns the QGeoCoordinate for the vertex specified.
void removeVertex(int vertexIndex)
void setPath(const QList< QGeoCoordinate > &path)
QVariantList path(void) const
void showAltColorChanged(bool showAltColor)
const QGCMapPolygon & operator=(const QGCMapPolygon &other)
void verifyClockwiseWinding(void)
Adjust polygon winding order to be clockwise (if needed)
void setInteractive(bool interactive)
bool interactive(void) const
void saveToJson(QJsonObject &json)
QList< QPointF > nedPolygon(void) const
Convert polygon to NED and return (D is ignored)
QDomElement kmlPolygonElement(KMLDomDocument &domDocument)
static constexpr const char * jsonPolygonKey
void centerChanged(QGeoCoordinate center)
bool isValidChanged(void)
void setShowAltColor(bool showAltColor)
void appendVertex(const QGeoCoordinate &coordinate)
void countChanged(int count)
bool loadFromJson(const QJsonObject &json, bool required, QString &errorString)
void appendVertices(const QVariantList &varCoords)
int count READ count NOTIFY countChanged(QVariantList path READ path NOTIFY pathChanged) 1(double area READ area NOTIFY pathChanged) 1(QmlObjectListModel *pathModel READ qmlPathModel CONSTANT) 1(bool dirty READ dirty WRITE setDirty NOTIFY dirtyChanged) 1(QGeoCoordinate center READ center WRITE setCenter NOTIFY centerChanged) 1(bool centerDrag READ centerDrag WRITE setCenterDrag NOTIFY centerDragChanged) 1(bool interactive READ interactive WRITE setInteractive NOTIFY interactiveChanged) 1(bool isValid READ isValid NOTIFY isValidChanged) 1(bool empty READ empty NOTIFY isEmptyChanged) 1(bool traceMode READ traceMode WRITE setTraceMode NOTIFY traceModeChanged) 1(bool showAltColor READ showAltColor WRITE setShowAltColor NOTIFY showAltColorChanged) 1(int selectedVertex READ selectedVertex WRITE selectVertex NOTIFY selectedVertexChanged) 1 void clear(void)
void setCenterDrag(bool centerDrag)
void centerDragChanged(bool centerDrag)
int count() const override final