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

#include <QGCMapPolyline.h>

Inheritance diagram for QGCMapPolyline:
Collaboration diagram for QGCMapPolyline:

Signals

void countChanged (int count)
void pathChanged (void)
void dragPathChanged (void)
void dirtyChanged (bool dirty)
void cleared (void)
void interactiveChanged (bool interactive)
void vertexDragChanged (bool vertexDrag)
void isValidChanged (void)
void isEmptyChanged (void)
void traceModeChanged (bool traceMode)
void selectedVertexChanged (int index)

Public Member Functions

 QGCMapPolyline (QObject *parent=nullptr)
 QGCMapPolyline (const QGCMapPolyline &other, QObject *parent=nullptr)
 ~QGCMapPolyline () override
const QGCMapPolyline & operator= (const QGCMapPolyline &other)
Q_INVOKABLE void clear (void)
Q_INVOKABLE void appendVertex (const QGeoCoordinate &coordinate)
Q_INVOKABLE void removeVertex (int vertexIndex)
Q_INVOKABLE void appendVertices (const QList< QGeoCoordinate > &coordinates)
Q_INVOKABLE void adjustVertex (int vertexIndex, const QGeoCoordinate coordinate)
Q_INVOKABLE void splitSegment (int vertexIndex)
 Splits the line segment comprised of vertexIndex -> vertexIndex + 1.
QList< QGeoCoordinate > offsetPolyline (double distance)
Q_INVOKABLE bool loadKMLOrSHPFile (const QString &file)
Q_INVOKABLE void beginReset (void)
Q_INVOKABLE void endReset (void)
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.
void saveToJson (QJsonObject &json)
bool loadFromJson (const QJsonObject &json, bool required, QString &errorString)
QList< QPointF > nedPolyline (void)
 Convert polyline to NED and return (D is ignored).
double length (void) const
 Returns the length of the polyline in meters.
int count (void) const
bool dirty (void) const
void setDirty (bool dirty)
bool interactive (void) const
bool vertexDrag (void) const
QVariantList path (void) const
bool isValid (void) const
bool empty (void) const
bool traceMode (void) const
int selectedVertex () const
QmlObjectListModel * qmlPathModel (void)
QmlObjectListModel & pathModel (void)
void setPath (const QList< QGeoCoordinate > &path)
void setPath (const QVariantList &path)
void setInteractive (bool interactive)
void setVertexDrag (bool vertexDrag)
void setTraceMode (bool traceMode)
void selectVertex (int index)

Static Public Attributes

static constexpr const char * jsonPolylineKey = "polyline"

Detailed Description

Definition at line 9 of file QGCMapPolyline.h.

Constructor & Destructor Documentation

◆ QGCMapPolyline() [1/2]

QGCMapPolyline::QGCMapPolyline ( QObject * parent = nullptr)

Definition at line 17 of file QGCMapPolyline.cc.

References QGCMapPolyline().

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

◆ QGCMapPolyline() [2/2]

QGCMapPolyline::QGCMapPolyline ( const QGCMapPolyline & other,
QObject * parent = nullptr )

Definition at line 25 of file QGCMapPolyline.cc.

References QGCMapPolyline().

◆ ~QGCMapPolyline()

QGCMapPolyline::~QGCMapPolyline ( )
override

Definition at line 35 of file QGCMapPolyline.cc.

References pathChanged(), and qgcApp.

Member Function Documentation

◆ adjustVertex()

void QGCMapPolyline::adjustVertex ( int vertexIndex,
const QGeoCoordinate coordinate )

Adjust the value for the specified coordinate

Parameters
vertexIndexPolygon point index to modify (0-based)
coordinateNew coordinate for point

Definition at line 78 of file QGCMapPolyline.cc.

References dragPathChanged(), pathChanged(), and setDirty().

◆ appendVertex()

void QGCMapPolyline::appendVertex ( const QGeoCoordinate & coordinate)

Definition at line 236 of file QGCMapPolyline.cc.

References pathChanged().

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

◆ appendVertices()

void QGCMapPolyline::appendVertices ( const QList< QGeoCoordinate > & coordinates)

Definition at line 386 of file QGCMapPolyline.cc.

References beginReset(), endReset(), and pathChanged().

Referenced by loadKMLOrSHPFile().

◆ beginReset()

void QGCMapPolyline::beginReset ( void )

Definition at line 402 of file QGCMapPolyline.cc.

Referenced by appendVertices(), loadKMLOrSHPFile(), setPath(), and setPath().

◆ clear()

void QGCMapPolyline::clear ( void )

Definition at line 66 of file QGCMapPolyline.cc.

References cleared(), pathChanged(), and setDirty().

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

◆ cleared

void QGCMapPolyline::cleared ( void )
signal

Referenced by clear().

◆ coordinateList()

QList< QGeoCoordinate > QGCMapPolyline::coordinateList ( void ) const

Returns the path in a list of QGeoCoordinate's format.

Definition at line 202 of file QGCMapPolyline.cc.

◆ count()

int QGCMapPolyline::count ( void ) const
inline

Definition at line 81 of file QGCMapPolyline.h.

Referenced by countChanged(), nedPolyline(), selectedVertexChanged(), and selectVertex().

◆ countChanged

void QGCMapPolyline::countChanged ( int count)
signal

◆ dirty()

bool QGCMapPolyline::dirty ( void ) const
inline

Definition at line 82 of file QGCMapPolyline.h.

Referenced by dirtyChanged(), selectedVertexChanged(), and setDirty().

◆ dirtyChanged

void QGCMapPolyline::dirtyChanged ( bool dirty)
signal

◆ dragPathChanged

void QGCMapPolyline::dragPathChanged ( void )
signal

Referenced by adjustVertex().

◆ empty()

bool QGCMapPolyline::empty ( void ) const
inline

Definition at line 88 of file QGCMapPolyline.h.

◆ endReset()

void QGCMapPolyline::endReset ( void )

Definition at line 407 of file QGCMapPolyline.cc.

Referenced by appendVertices(), loadKMLOrSHPFile(), setPath(), and setPath().

◆ interactive()

bool QGCMapPolyline::interactive ( void ) const
inline

Definition at line 84 of file QGCMapPolyline.h.

Referenced by interactiveChanged(), and setInteractive().

◆ interactiveChanged

void QGCMapPolyline::interactiveChanged ( bool interactive)
signal

References interactive().

Referenced by setInteractive().

◆ isEmptyChanged

void QGCMapPolyline::isEmptyChanged ( void )
signal

◆ isValid()

bool QGCMapPolyline::isValid ( void ) const
inline

Definition at line 87 of file QGCMapPolyline.h.

◆ isValidChanged

void QGCMapPolyline::isValidChanged ( void )
signal

◆ length()

double QGCMapPolyline::length ( void ) const

Returns the length of the polyline in meters.

Definition at line 373 of file QGCMapPolyline.cc.

References length().

Referenced by length().

◆ loadFromJson()

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

Load a polyline 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 175 of file QGCMapPolyline.cc.

References clear(), jsonPolylineKey, GeoJsonHelper::loadGeoCoordinateArray(), pathChanged(), setDirty(), and JsonParsing::validateRequiredKeys().

◆ loadKMLOrSHPFile()

bool QGCMapPolyline::loadKMLOrSHPFile ( const QString & file)

Loads a polyline from a KML/SHP file

Returns
true: success

Definition at line 338 of file QGCMapPolyline.cc.

References appendVertices(), beginReset(), clear(), endReset(), ShapeFileHelper::loadPolylinesFromFile(), and QGC::showAppMessage().

◆ nedPolyline()

QList< QPointF > QGCMapPolyline::nedPolyline ( void )

Convert polyline to NED and return (D is ignored).

Definition at line 297 of file QGCMapPolyline.cc.

References QGCGeo::convertGeoToNed(), count(), nedPolyline(), and vertexCoordinate().

Referenced by nedPolyline(), and offsetPolyline().

◆ offsetPolyline()

QList< QGeoCoordinate > QGCMapPolyline::offsetPolyline ( double distance)

Offsets the current polyline edges by the specified distance in meters

Returns
Offset set of vertices

Definition at line 320 of file QGCMapPolyline.cc.

References QGCGeo::convertNedToGeo(), nedPolyline(), QGCPlanarGeometry::offsetPolyline(), and vertexCoordinate().

◆ operator=()

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

Definition at line 40 of file QGCMapPolyline.cc.

References appendVertex(), clear(), path(), QGCMapPolyline(), and setDirty().

◆ path()

QVariantList QGCMapPolyline::path ( void ) const
inline

Definition at line 86 of file QGCMapPolyline.h.

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

◆ pathChanged

◆ pathModel()

QmlObjectListModel & QGCMapPolyline::pathModel ( void )
inline

Definition at line 93 of file QGCMapPolyline.h.

◆ qmlPathModel()

QmlObjectListModel * QGCMapPolyline::qmlPathModel ( void )
inline

Definition at line 92 of file QGCMapPolyline.h.

◆ removeVertex()

void QGCMapPolyline::removeVertex ( int vertexIndex)

Definition at line 243 of file QGCMapPolyline.cc.

References pathChanged(), and selectVertex().

◆ saveToJson()

void QGCMapPolyline::saveToJson ( QJsonObject & json)

Saves the polyline to the json object.

Parameters
jsonJson object to save to

Definition at line 166 of file QGCMapPolyline.cc.

References jsonPolylineKey, GeoJsonHelper::saveGeoCoordinateArray(), and setDirty().

◆ selectedVertex()

int QGCMapPolyline::selectedVertex ( ) const
inline

Definition at line 90 of file QGCMapPolyline.h.

◆ selectedVertexChanged

void QGCMapPolyline::selectedVertexChanged ( int index)
signal

References count(), and dirty().

Referenced by selectVertex().

◆ selectVertex()

void QGCMapPolyline::selectVertex ( int index)

Definition at line 420 of file QGCMapPolyline.cc.

References count(), and selectedVertexChanged().

Referenced by removeVertex().

◆ setDirty()

void QGCMapPolyline::setDirty ( bool dirty)

Definition at line 100 of file QGCMapPolyline.cc.

References dirty(), and dirtyChanged().

Referenced by adjustVertex(), clear(), loadFromJson(), operator=(), saveToJson(), setPath(), and setPath().

◆ setInteractive()

void QGCMapPolyline::setInteractive ( bool interactive)

Definition at line 267 of file QGCMapPolyline.cc.

References interactive(), and interactiveChanged().

◆ setPath() [1/2]

void QGCMapPolyline::setPath ( const QList< QGeoCoordinate > & path)

Definition at line 135 of file QGCMapPolyline.cc.

References beginReset(), endReset(), path(), and setDirty().

◆ setPath() [2/2]

void QGCMapPolyline::setPath ( const QVariantList & path)

Definition at line 151 of file QGCMapPolyline.cc.

References beginReset(), endReset(), path(), and setDirty().

◆ setTraceMode()

void QGCMapPolyline::setTraceMode ( bool traceMode)

Definition at line 412 of file QGCMapPolyline.cc.

References traceMode(), and traceModeChanged().

◆ setVertexDrag()

void QGCMapPolyline::setVertexDrag ( bool vertexDrag)

Definition at line 275 of file QGCMapPolyline.cc.

References pathChanged(), vertexDrag(), and vertexDragChanged().

◆ splitSegment()

void QGCMapPolyline::splitSegment ( int vertexIndex)

Splits the line segment comprised of vertexIndex -> vertexIndex + 1.

Definition at line 213 of file QGCMapPolyline.cc.

References appendVertex(), and pathChanged().

◆ traceMode()

bool QGCMapPolyline::traceMode ( void ) const
inline

Definition at line 89 of file QGCMapPolyline.h.

Referenced by setTraceMode(), and traceModeChanged().

◆ traceModeChanged

void QGCMapPolyline::traceModeChanged ( bool traceMode)
signal

◆ vertexCoordinate()

QGeoCoordinate QGCMapPolyline::vertexCoordinate ( int vertex) const

Returns the QGeoCoordinate for the vertex specified.

Definition at line 287 of file QGCMapPolyline.cc.

Referenced by nedPolyline(), and offsetPolyline().

◆ vertexDrag()

bool QGCMapPolyline::vertexDrag ( void ) const
inline

Definition at line 85 of file QGCMapPolyline.h.

Referenced by setVertexDrag(), and vertexDragChanged().

◆ vertexDragChanged

void QGCMapPolyline::vertexDragChanged ( bool vertexDrag)
signal

References vertexDrag().

Referenced by setVertexDrag().

Member Data Documentation

◆ jsonPolylineKey

const char* QGCMapPolyline::jsonPolylineKey = "polyline"
staticconstexpr

Definition at line 102 of file QGCMapPolyline.h.

Referenced by loadFromJson(), and saveToJson().


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