QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCFencePolygon Class Reference

The QGCFencePolygon class provides a polygon used by GeoFence support. More...

#include <QGCFencePolygon.h>

+ Inheritance diagram for QGCFencePolygon:
+ Collaboration diagram for QGCFencePolygon:

Signals

void inclusionChanged (bool inclusion)
 
- Signals inherited from QGCMapPolygon
void countChanged (int count)
 
void pathChanged (void)
 
void dragPathChanged (void)
 
void dirtyChanged (bool dirty)
 
void cleared (void)
 
void centerChanged (QGeoCoordinate center)
 
void dragCenterChanged (QGeoCoordinate center)
 
void centerDragChanged (bool centerDrag)
 
void vertexDragChanged (bool vertexDrag)
 
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

 QGCFencePolygon (bool inclusion, QObject *parent=nullptr)
 
 QGCFencePolygon (const QGCFencePolygon &other, QObject *parent=nullptr)
 
const QGCFencePolygonoperator= (const QGCFencePolygon &other)
 
void saveToJson (QJsonObject &json)
 
bool loadFromJson (const QJsonObject &json, bool required, QString &errorString)
 
bool inclusion (void) const
 
void setInclusion (bool inclusion)
 
- Public Member Functions inherited from QGCMapPolygon
 QGCMapPolygon (QObject *parent=nullptr)
 
 QGCMapPolygon (const QGCMapPolygon &other, QObject *parent=nullptr)
 
 ~QGCMapPolygon () override
 
const QGCMapPolygonoperator= (const QGCMapPolygon &other)
 
Q_INVOKABLE void clear (void)
 
Q_INVOKABLE void appendVertex (const QGeoCoordinate &coordinate)
 
Q_INVOKABLE void removeVertex (int vertexIndex)
 
Q_INVOKABLE void appendVertices (const QVariantList &varCoords)
 
void appendVertices (const QList< QGeoCoordinate > &coordinates)
 
Q_INVOKABLE void adjustVertex (int vertexIndex, const QGeoCoordinate coordinate)
 
Q_INVOKABLE void splitPolygonSegment (int vertexIndex)
 Splits the segment comprised of vertextIndex -> vertexIndex + 1.
 
Q_INVOKABLE bool containsCoordinate (const QGeoCoordinate &coordinate) const
 Returns true if the specified coordinate is within the polygon.
 
Q_INVOKABLE void offset (double distance)
 Offsets the current polygon edges by the specified distance in meters.
 
Q_INVOKABLE bool loadKMLOrSHPFile (const QString &file)
 
QList< QGeoCoordinate > coordinateList (void) const
 Returns the path in a list of QGeoCoordinate's format.
 
Q_INVOKABLE QGeoCoordinate vertexCoordinate (int vertex) const
 Returns the QGeoCoordinate for the vertex specified.
 
Q_INVOKABLE void verifyClockwiseWinding (void)
 Adjust polygon winding order to be clockwise (if needed)
 
Q_INVOKABLE void beginReset (void)
 
Q_INVOKABLE 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 vertexDrag (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
 
QmlObjectListModelqmlPathModel (void)
 
QmlObjectListModelpathModel (void)
 
void setPath (const QList< QGeoCoordinate > &path)
 
void setPath (const QVariantList &path)
 
void setCenter (QGeoCoordinate newCenter)
 
void setCenterDrag (bool centerDrag)
 
void setVertexDrag (bool vertexDrag)
 
void setInteractive (bool interactive)
 
void setTraceMode (bool traceMode)
 
void setShowAltColor (bool showAltColor)
 
void selectVertex (int index)
 

Additional Inherited Members

- Static Public Attributes inherited from QGCMapPolygon
static constexpr const char * jsonPolygonKey = "polygon"
 

Detailed Description

The QGCFencePolygon class provides a polygon used by GeoFence support.

Definition at line 7 of file QGCFencePolygon.h.

Constructor & Destructor Documentation

◆ QGCFencePolygon() [1/2]

QGCFencePolygon::QGCFencePolygon ( bool  inclusion,
QObject *  parent = nullptr 
)

Definition at line 4 of file QGCFencePolygon.cc.

◆ QGCFencePolygon() [2/2]

QGCFencePolygon::QGCFencePolygon ( const QGCFencePolygon other,
QObject *  parent = nullptr 
)

Definition at line 11 of file QGCFencePolygon.cc.

Member Function Documentation

◆ inclusion()

bool QGCFencePolygon::inclusion ( void  ) const
inline

Definition at line 32 of file QGCFencePolygon.h.

Referenced by GeoFenceManager::sendToVehicle(), and setInclusion().

◆ inclusionChanged

void QGCFencePolygon::inclusionChanged ( bool  inclusion)
signal

Referenced by setInclusion().

◆ loadFromJson()

bool QGCFencePolygon::loadFromJson ( const QJsonObject &  json,
bool  required,
QString &  errorString 
)

Load a QGCFencePolygon from json

Parameters
jsonJson object to load from
requiredtrue: no polygon in object will generate error
errorStringError string if return is false
Returns
true: success, false: failure (errorString set)

Definition at line 44 of file QGCFencePolygon.cc.

References errorString, JsonParsing::jsonVersionKey, QGCMapPolygon::loadFromJson(), setInclusion(), and JsonParsing::validateKeys().

Referenced by GeoFenceController::load().

◆ operator=()

const QGCFencePolygon & QGCFencePolygon::operator= ( const QGCFencePolygon other)

Definition at line 23 of file QGCFencePolygon.cc.

References QGCMapPolygon::operator=(), and setInclusion().

◆ saveToJson()

void QGCFencePolygon::saveToJson ( QJsonObject &  json)

Saves the QGCFencePolygon to the json object.

Parameters
jsonJson object to save to

Definition at line 37 of file QGCFencePolygon.cc.

References JsonParsing::jsonVersionKey, and QGCMapPolygon::saveToJson().

Referenced by GeoFenceController::save().

◆ setInclusion()

void QGCFencePolygon::setInclusion ( bool  inclusion)

Definition at line 70 of file QGCFencePolygon.cc.

References inclusion(), and inclusionChanged().

Referenced by loadFromJson(), and operator=().


The documentation for this class was generated from the following files: