3#include <QtCore/QObject>
4#include <QtPositioning/QGeoCoordinate>
5#include <QtCore/QVariantList>
6#include <QtGui/QPolygonF>
7#include <QtXml/QDomElement>
47 Q_INVOKABLE
void clear(
void);
48 Q_INVOKABLE
void appendVertex(
const QGeoCoordinate& coordinate);
57 Q_INVOKABLE
void adjustVertex(
int vertexIndex,
const QGeoCoordinate coordinate);
67 Q_INVOKABLE
bool offset(
double distance);
96 bool loadFromJson(
const QJsonObject& json,
bool required, QString& errorString);
102 double area(
void)
const;
108 int count (
void)
const {
return _polygonPath.count(); }
109 bool dirty (
void)
const {
return _dirty; }
111 QGeoCoordinate
center (
void)
const {
return _center; }
115 bool isValid (
void)
const {
return _polygonModel.count() >= 3; }
116 bool empty (
void)
const {
return _polygonModel.count() == 0; }
121 QVariantList
path (
void)
const {
return _polygonPath; }
127 void setCenter (QGeoCoordinate newCenter);
155 void _polygonModelCountChanged(
int count);
156 void _polygonModelDirtyChanged(
bool dirty);
157 void _updateCenter(
void);
161 QPolygonF _toPolygonF (
void)
const;
162 QGeoCoordinate _coordFromPointF (
const QPointF& point)
const;
163 QPointF _pointFFromCoord (
const QGeoCoordinate& coordinate)
const;
165 QVariantList _polygonPath;
168 QGeoCoordinate _center;
169 bool _centerDrag =
false;
170 bool _vertexDrag =
false;
171 bool _ignoreCenterUpdates =
false;
172 bool _interactive =
false;
173 bool _traceMode =
false;
174 bool _showAltColor =
false;
175 int _selectedVertexIndex = -1;
176 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)
Q_INVOKABLE bool loadKMLOrSHPFile(const QString &file)
bool isEmptyChanged(void)
Q_INVOKABLE bool offset(double distance)
Q_INVOKABLE 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)
Q_INVOKABLE void splitPolygonSegment(int vertexIndex)
Splits the segment comprised of vertextIndex -> vertexIndex + 1.
bool traceMode(void) const
void vertexDragChanged(bool vertexDrag)
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 setVertexDrag(bool vertexDrag)
void dragPathChanged(void)
void setDirty(bool dirty)
bool centerDrag(void) const
void selectedVertexChanged(int index)
void traceModeChanged(bool traceMode)
bool showAltColor(void) const
Q_INVOKABLE bool containsCoordinate(const QGeoCoordinate &coordinate) const
Returns true if the specified coordinate is within the polygon.
Q_INVOKABLE QGeoCoordinate vertexCoordinate(int vertex) const
Returns the QGeoCoordinate for the vertex specified.
Q_INVOKABLE void removeVertex(int vertexIndex)
void setPath(const QList< QGeoCoordinate > &path)
QVariantList path(void) const
void showAltColorChanged(bool showAltColor)
void dragCenterChanged(QGeoCoordinate center)
const QGCMapPolygon & operator=(const QGCMapPolygon &other)
Q_INVOKABLE void verifyClockwiseWinding(void)
Adjust polygon winding order to be clockwise (if needed).
void setInteractive(bool interactive)
Q_INVOKABLE void beginReset(void)
bool interactive(void) const
void saveToJson(QJsonObject &json)
QList< QPointF > nedPolygon(void) const
Convert polygon to NED and return (D is ignored).
Q_INVOKABLE void endReset(void)
QDomElement kmlPolygonElement(KMLDomDocument &domDocument)
static constexpr const char * jsonPolygonKey
void centerChanged(QGeoCoordinate center)
Q_INVOKABLE void clear(void)
bool isValidChanged(void)
void setShowAltColor(bool showAltColor)
Q_INVOKABLE void appendVertex(const QGeoCoordinate &coordinate)
bool vertexDrag(void) const
void countChanged(int count)
bool loadFromJson(const QJsonObject &json, bool required, QString &errorString)
Q_INVOKABLE void appendVertices(const QVariantList &varCoords)
void setCenterDrag(bool centerDrag)
QGCMapPolygon(QObject *parent=nullptr)
void centerDragChanged(bool centerDrag)