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 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

 QGCFencePolygon (bool inclusion, QObject *parent=nullptr)
 
 QGCFencePolygon (const QGCFencePolygon &other, QObject *parent=nullptr)
 
const QGCFencePolygonoperator= (const QGCFencePolygon &other)
 
bool inclusion READ inclusion WRITE setInclusion NOTIFY inclusionChanged 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)
 
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
 
QmlObjectListModelqmlPathModel (void)
 
QmlObjectListModelpathModel (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)
 

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 6 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 31 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, JsonHelper::jsonVersionKey, QGCMapPolygon::loadFromJson(), setInclusion(), and JsonHelper::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 JsonHelper::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: