|
QGroundControl
Ground Control Station for MAVLink Drones
|
#include <QGCMapPolygon.h>
Inheritance diagram for QGCMapPolygon:
Collaboration diagram for QGCMapPolygon:Signals | |
| void | countChanged (int count) |
| void | pathChanged (void) |
| void | dirtyChanged (bool dirty) |
| void | cleared (void) |
| void | centerChanged (QGeoCoordinate center) |
| void | centerDragChanged (bool centerDrag) |
| void | interactiveChanged (bool interactive) |
| bool | isValidChanged (void) |
| bool | isEmptyChanged (void) |
| void | traceModeChanged (bool traceMode) |
| void | showAltColorChanged (bool showAltColor) |
| void | selectedVertexChanged (int index) |
Public Member Functions | |
| QGCMapPolygon (QObject *parent=nullptr) | |
| QGCMapPolygon (const QGCMapPolygon &other, QObject *parent=nullptr) | |
| ~QGCMapPolygon () override | |
| const QGCMapPolygon & | operator= (const QGCMapPolygon &other) |
| 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 | appendVertex (const QGeoCoordinate &coordinate) |
| void | removeVertex (int vertexIndex) |
| void | appendVertices (const QVariantList &varCoords) |
| void | appendVertices (const QList< QGeoCoordinate > &coordinates) |
| void | adjustVertex (int vertexIndex, const QGeoCoordinate coordinate) |
| void | splitPolygonSegment (int vertexIndex) |
| Splits the segment comprised of vertextIndex -> vertexIndex + 1. | |
| bool | containsCoordinate (const QGeoCoordinate &coordinate) const |
| Returns true if the specified coordinate is within the polygon. | |
| void | offset (double distance) |
| Offsets the current polygon edges by the specified distance in meters. | |
| bool | loadKMLOrSHPFile (const QString &file) |
| QList< QGeoCoordinate > | coordinateList (void) const |
| Returns the path in a list of QGeoCoordinate's format. | |
| QGeoCoordinate | vertexCoordinate (int vertex) const |
| Returns the QGeoCoordinate for the vertex specified. | |
| void | verifyClockwiseWinding (void) |
| Adjust polygon winding order to be clockwise (if needed) | |
| void | beginReset (void) |
| void | endReset (void) |
| void | saveToJson (QJsonObject &json) |
| bool | loadFromJson (const QJsonObject &json, bool required, QString &errorString) |
| QList< QPointF > | nedPolygon (void) const |
| Convert polygon to NED and return (D is ignored) | |
| double | area (void) const |
| Returns the area of the polygon in meters squared. | |
| QDomElement | kmlPolygonElement (KMLDomDocument &domDocument) |
| int | count (void) const |
| bool | dirty (void) const |
| void | setDirty (bool dirty) |
| QGeoCoordinate | center (void) const |
| bool | centerDrag (void) const |
| bool | interactive (void) const |
| bool | isValid (void) const |
| bool | empty (void) const |
| bool | traceMode (void) const |
| bool | showAltColor (void) const |
| int | selectedVertex () const |
| QVariantList | path (void) const |
| QmlObjectListModel * | qmlPathModel (void) |
| QmlObjectListModel & | pathModel (void) |
| void | setPath (const QList< QGeoCoordinate > &path) |
| void | setPath (const QVariantList &path) |
| void | setCenter (QGeoCoordinate newCenter) |
| void | setCenterDrag (bool centerDrag) |
| void | setInteractive (bool interactive) |
| void | setTraceMode (bool traceMode) |
| void | setShowAltColor (bool showAltColor) |
| void | selectVertex (int index) |
Static Public Attributes | |
| static constexpr const char * | jsonPolygonKey = "polygon" |
The QGCMapPolygon class provides a polygon which can be displayed on a map using a map visuals control. It maintains a representation of the polygon on QVariantList and QmlObjectListModel format.
Definition at line 15 of file QGCMapPolygon.h.
| QGCMapPolygon::QGCMapPolygon | ( | QObject * | parent = nullptr | ) |
Definition at line 16 of file QGCMapPolygon.cc.
| QGCMapPolygon::QGCMapPolygon | ( | const QGCMapPolygon & | other, |
| QObject * | parent = nullptr |
||
| ) |
Definition at line 26 of file QGCMapPolygon.cc.
|
override |
Definition at line 38 of file QGCMapPolygon.cc.
References pathChanged(), and qgcApp.
| void QGCMapPolygon::adjustVertex | ( | int | vertexIndex, |
| const QGeoCoordinate | coordinate | ||
| ) |
Adjust the value for the specified coordinate
| vertexIndex | Polygon point index to modify (0-based) |
| coordinate | New coordinate for point |
Definition at line 95 of file QGCMapPolygon.cc.
References pathChanged(), setDirty(), and QmlObjectListModel::value().
Referenced by setCenter().
| void QGCMapPolygon::appendVertex | ( | const QGeoCoordinate & | coordinate | ) |
Definition at line 270 of file QGCMapPolygon.cc.
References QmlObjectListModel::append(), and pathChanged().
Referenced by splitPolygonSegment().
| void QGCMapPolygon::appendVertices | ( | const QList< QGeoCoordinate > & | coordinates | ) |
Definition at line 284 of file QGCMapPolygon.cc.
References QmlObjectListModel::append(), beginReset(), endReset(), and pathChanged().
| void QGCMapPolygon::appendVertices | ( | const QVariantList & | varCoords | ) |
Definition at line 299 of file QGCMapPolygon.cc.
References appendVertices().
Referenced by appendVertices(), loadKMLOrSHPFile(), offset(), operator=(), and verifyClockwiseWinding().
| double QGCMapPolygon::area | ( | void | ) | const |
Returns the area of the polygon in meters squared.
Definition at line 531 of file QGCMapPolygon.cc.
References nedPolygon().
Referenced by TransectStyleComplexItem::coveredArea().
| void QGCMapPolygon::beginReset | ( | void | ) |
Definition at line 580 of file QGCMapPolygon.cc.
References ObjectItemModelBase::beginResetModel().
Referenced by appendVertices(), loadKMLOrSHPFile(), offset(), and verifyClockwiseWinding().
|
inline |
Definition at line 103 of file QGCMapPolygon.h.
Referenced by SurveyComplexItem::centerCoordinate().
|
signal |
Referenced by setCenter().
|
inline |
Definition at line 104 of file QGCMapPolygon.h.
Referenced by setCenterDrag().
|
signal |
Referenced by setCenterDrag().
|
signal |
| bool QGCMapPolygon::containsCoordinate | ( | const QGeoCoordinate & | coordinate | ) | const |
Returns true if the specified coordinate is within the polygon.
Definition at line 162 of file QGCMapPolygon.cc.
| QList< QGeoCoordinate > QGCMapPolygon::coordinateList | ( | void | ) | const |
Returns the path in a list of QGeoCoordinate's format.
Definition at line 233 of file QGCMapPolygon.cc.
Referenced by StructureScanComplexItem::greatestDistanceTo(), StructureScanComplexItem::setCoordinate(), and TransectStyleComplexItem::setCoordinate().
|
inline |
Definition at line 100 of file QGCMapPolygon.h.
Referenced by StructureScanComplexItem::appendMissionItems(), StructureScanComplexItem::coordinate(), StructureScanComplexItem::lastSequenceNumber(), nedPolygon(), offset(), StructureScanComplexItem::rotateEntryPoint(), selectVertex(), GeoFenceManager::sendToVehicle(), setCenter(), StructureScanComplexItem::setCoordinate(), and TransectStyleComplexItem::setCoordinate().
|
signal |
| int count READ count NOTIFY QGCMapPolygon::countChanged | ( | QVariantList path READ path NOTIFY | pathChanged | ) |
Referenced by StructureScanComplexItem::StructureScanComplexItem().
|
inline |
Definition at line 101 of file QGCMapPolygon.h.
Referenced by setDirty().
|
signal |
|
inline |
Definition at line 107 of file QGCMapPolygon.h.
References QmlObjectListModel::count().
| void QGCMapPolygon::endReset | ( | void | ) |
Definition at line 585 of file QGCMapPolygon.cc.
References ObjectItemModelBase::endResetModel().
Referenced by appendVertices(), loadKMLOrSHPFile(), offset(), and verifyClockwiseWinding().
|
inline |
Definition at line 105 of file QGCMapPolygon.h.
Referenced by setInteractive().
|
signal |
Referenced by setInteractive().
|
signal |
|
inline |
Definition at line 106 of file QGCMapPolygon.h.
References QmlObjectListModel::count().
Referenced by StructureScanComplexItem::readyForSaveState(), and TransectStyleComplexItem::readyForSaveState().
|
signal |
| QDomElement QGCMapPolygon::kmlPolygonElement | ( | KMLDomDocument & | domDocument | ) |
Definition at line 590 of file QGCMapPolygon.cc.
References KMLDomDocument::addTextElement(), and KMLDomDocument::kmlCoordString().
Referenced by TransectStyleComplexItem::addKMLVisuals().
| bool QGCMapPolygon::loadFromJson | ( | const QJsonObject & | json, |
| bool | required, | ||
| QString & | errorString | ||
| ) |
Load a polygon from json
| json | Json object to load from |
| required | true: no polygon in object will generate error |
| errorString | Error string if return is false |
Definition at line 206 of file QGCMapPolygon.cc.
References QmlObjectListModel::append(), errorString, jsonPolygonKey, JsonHelper::loadGeoCoordinateArray(), pathChanged(), setDirty(), and JsonParsing::validateRequiredKeys().
Referenced by StructureScanComplexItem::load(), and QGCFencePolygon::loadFromJson().
| bool QGCMapPolygon::loadKMLOrSHPFile | ( | const QString & | file | ) |
Loads a polygon from a KML/SHP file
Definition at line 509 of file QGCMapPolygon.cc.
References appendVertices(), beginReset(), endReset(), errorString, and qgcApp.
| QList< QPointF > QGCMapPolygon::nedPolygon | ( | void | ) | const |
Convert polygon to NED and return (D is ignored)
Definition at line 431 of file QGCMapPolygon.cc.
References QGCGeo::convertGeoToNed(), QmlObjectListModel::count(), count(), nedPolygon(), and vertexCoordinate().
Referenced by area(), nedPolygon(), and offset().
| void QGCMapPolygon::offset | ( | double | distance | ) |
Offsets the current polygon edges by the specified distance in meters.
Definition at line 455 of file QGCMapPolygon.cc.
References appendVertices(), beginReset(), QGCGeo::convertNedToGeo(), count(), endReset(), nedPolygon(), and vertexCoordinate().
| const QGCMapPolygon & QGCMapPolygon::operator= | ( | const QGCMapPolygon & | other | ) |
Definition at line 58 of file QGCMapPolygon.cc.
References appendVertices(), path(), and setDirty().
Referenced by QGCFencePolygon::operator=().
|
inline |
Definition at line 112 of file QGCMapPolygon.h.
Referenced by operator=(), GeoFenceManager::sendToVehicle(), setPath(), and setPath().
|
signal |
|
inline |
Definition at line 114 of file QGCMapPolygon.h.
|
inline |
Definition at line 113 of file QGCMapPolygon.h.
| void QGCMapPolygon::removeVertex | ( | int | vertexIndex | ) |
Definition at line 315 of file QGCMapPolygon.cc.
References pathChanged(), QmlObjectListModel::removeAt(), and selectVertex().
| void QGCMapPolygon::saveToJson | ( | QJsonObject & | json | ) |
Saves the polygon to the json object.
| json | Json object to save to |
Definition at line 197 of file QGCMapPolygon.cc.
References jsonPolygonKey, JsonHelper::saveGeoCoordinateArray(), and setDirty().
Referenced by StructureScanComplexItem::save(), and QGCFencePolygon::saveToJson().
|
inline |
Definition at line 110 of file QGCMapPolygon.h.
|
signal |
Referenced by selectVertex().
| void QGCMapPolygon::selectVertex | ( | int | index | ) |
Definition at line 648 of file QGCMapPolygon.cc.
References count(), and selectedVertexChanged().
Referenced by removeVertex(), and splitPolygonSegment().
| void QGCMapPolygon::setCenter | ( | QGeoCoordinate | newCenter | ) |
Definition at line 364 of file QGCMapPolygon.cc.
References adjustVertex(), centerChanged(), count(), and pathChanged().
Referenced by SurveyComplexItem::setCenterCoordinate().
| void QGCMapPolygon::setCenterDrag | ( | bool | centerDrag | ) |
Definition at line 405 of file QGCMapPolygon.cc.
References centerDrag(), and centerDragChanged().
| void QGCMapPolygon::setDirty | ( | bool | dirty | ) |
Definition at line 113 of file QGCMapPolygon.cc.
References dirty(), dirtyChanged(), and QmlObjectListModel::setDirty().
Referenced by adjustVertex(), loadFromJson(), operator=(), saveToJson(), GeoFenceController::setDirty(), TransectStyleComplexItem::setDirty(), setPath(), and setPath().
| void QGCMapPolygon::setInteractive | ( | bool | interactive | ) |
Definition at line 413 of file QGCMapPolygon.cc.
References interactive(), and interactiveChanged().
| void QGCMapPolygon::setPath | ( | const QList< QGeoCoordinate > & | path | ) |
Definition at line 171 of file QGCMapPolygon.cc.
References QmlObjectListModel::append(), QmlObjectListModel::clearAndDeleteContents(), path(), pathChanged(), and setDirty().
Referenced by StructureScanComplexItem::setCoordinate(), and TransectStyleComplexItem::setCoordinate().
| void QGCMapPolygon::setPath | ( | const QVariantList & | path | ) |
Definition at line 184 of file QGCMapPolygon.cc.
References QmlObjectListModel::append(), QmlObjectListModel::clearAndDeleteContents(), path(), pathChanged(), and setDirty().
| void QGCMapPolygon::setShowAltColor | ( | bool | showAltColor | ) |
Definition at line 641 of file QGCMapPolygon.cc.
References showAltColor(), and showAltColorChanged().
| void QGCMapPolygon::setTraceMode | ( | bool | traceMode | ) |
Definition at line 633 of file QGCMapPolygon.cc.
References traceMode(), and traceModeChanged().
|
inline |
Definition at line 109 of file QGCMapPolygon.h.
Referenced by setShowAltColor().
|
signal |
Referenced by setShowAltColor().
| void QGCMapPolygon::splitPolygonSegment | ( | int | vertexIndex | ) |
Splits the segment comprised of vertextIndex -> vertexIndex + 1.
Definition at line 244 of file QGCMapPolygon.cc.
References appendVertex(), QmlObjectListModel::insert(), pathChanged(), and selectVertex().
|
inline |
Definition at line 108 of file QGCMapPolygon.h.
Referenced by setTraceMode().
|
signal |
| void QGCMapPolygon::verifyClockwiseWinding | ( | void | ) |
Adjust polygon winding order to be clockwise (if needed)
Definition at line 551 of file QGCMapPolygon.cc.
References appendVertices(), beginReset(), and endReset().
| QGeoCoordinate QGCMapPolygon::vertexCoordinate | ( | int | vertex | ) | const |
Returns the QGeoCoordinate for the vertex specified.
Definition at line 421 of file QGCMapPolygon.cc.
Referenced by StructureScanComplexItem::appendMissionItems(), StructureScanComplexItem::coordinate(), nedPolygon(), and offset().
|
staticconstexpr |
Definition at line 125 of file QGCMapPolygon.h.
Referenced by StructureScanComplexItem::load(), loadFromJson(), and saveToJson().