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);
66 Q_INVOKABLE
void offset(
double distance);
99 double area(
void)
const;
105 int count (
void)
const {
return _polygonPath.count(); }
106 bool dirty (
void)
const {
return _dirty; }
108 QGeoCoordinate
center (
void)
const {
return _center; }
113 bool empty (
void)
const {
return _polygonModel.
count() == 0; }
118 QVariantList
path (
void)
const {
return _polygonPath; }
124 void setCenter (QGeoCoordinate newCenter);
152 void _polygonModelCountChanged(
int count);
153 void _polygonModelDirtyChanged(
bool dirty);
154 void _updateCenter(
void);
158 QPolygonF _toPolygonF (
void)
const;
159 QGeoCoordinate _coordFromPointF (
const QPointF& point)
const;
160 QPointF _pointFFromCoord (
const QGeoCoordinate& coordinate)
const;
162 QVariantList _polygonPath;
165 QGeoCoordinate _center;
166 bool _centerDrag =
false;
167 bool _vertexDrag =
false;
168 bool _ignoreCenterUpdates =
false;
169 bool _interactive =
false;
170 bool _traceMode =
false;
171 bool _showAltColor =
false;
172 int _selectedVertexIndex = -1;
173 bool _deferredPathChanged =
false;
Used to convert a Plan to a KML document.
The QGCMapPolygon class provides a polygon which can be displayed on a map using a map visuals contro...
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 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)
Q_INVOKABLE 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
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)
void centerDragChanged(bool centerDrag)
int count() const override final