Enroute Flight Navigation
A navigation app for VFR pilots
GeoMaps::Waypoint Class Reference

Waypoint, such as an airfield, a navaid station or a reporting point. More...

#include <Waypoint.h>

Public Member Functions

 Waypoint ()
 Constructs an invalid way point.
 Waypoint (const QGeoCoordinate &coordinate, const QString &name={})
 Constructs a waypoint from a coordinate.
 Waypoint (const QJsonObject &geoJSONObject)
 Constructs a waypoint from a GeoJSON object.
auto category () const -> QString
 Getter method for property with same name.
auto coordinate () const -> QGeoCoordinate
 Getter function for property with the same name.
auto extendedName () const -> QString
 Getter function for property with the same name.
auto ICAOCode () const -> QString
 Getter method for property with same name.
auto icon () const -> QString
 Getter method for property with the same name.
auto isValid () const -> bool
 Getter method for property with same name.
auto name () const -> QString
 Getter method for property with same name.
auto notes () const -> QString
 Getter method for property with same name.
auto shortName () const -> QString
 Getter method for property with same name.
auto tabularDescription () const -> QList< QString >
 Getter method for property with the same name.
auto twoLineTitle () const -> QString
 Getter function for property with the same name.
auto type () const -> QString
 Getter method for property with same name.
auto variation () const -> Units::Angle
 Get variation.
void setCoordinate (const QGeoCoordinate &newCoordinate)
 Set coordinate.
void setName (const QString &newName)
 Set name.
void setNotes (const QString &newNotes)
 Set notes.
Q_INVOKABLE bool operator== (const GeoMaps::Waypoint &other) const =default
 Comparison.
Q_INVOKABLE bool operator!= (const GeoMaps::Waypoint &other) const =default
 Comparison.
Q_INVOKABLE GeoMaps::Waypoint copy () const
 Deep copy.
Q_INVOKABLE bool isNear (const GeoMaps::Waypoint &other) const
 Check if other waypoint is geographically near *this.
QJsonObject toJSON () const
 Serialization to GeoJSON object.
void toGPX (QXmlStreamWriter &stream) const
 Serialization to GPX object.

Properties

QString category
 Category of the waypoint.
QGeoCoordinate coordinate
 Coordinate of the waypoint.
QString extendedName
 Extended name of the waypoint.
QString ICAOCode
 ICAO Code of the waypoint.
QString icon
 Suggested icon for use in GUI.
QString name
 Name of the waypoint.
QString notes
 Notes attached to the waypoint.
QString shortName
 Short name of the waypoint.
QString twoLineTitle
 Two-line description of the waypoint name, for use in GUI.
QString type
 Type of the waypoint.
Units::Angle variation
 Magnetic variation at the waypoint.

Friends

size_t qHash (const GeoMaps::Waypoint &waypoint)
 qHash

Detailed Description

Waypoint, such as an airfield, a navaid station or a reporting point.

This class represents a waypoint. The properties stored in this class correspond to the feature of the GeoJSON files that are used in Enroute, as described here.

Definition at line 42 of file Waypoint.h.

Constructor & Destructor Documentation

◆ Waypoint() [1/3]

GeoMaps::Waypoint::Waypoint ( )

Constructs an invalid way point.

This default constructor creates a waypoint with the following properties

  • category is set to "WP"
  • name is set to "Waypoint"
  • type is set to "WP"

The coordinate is invalid.

◆ Waypoint() [2/3]

GeoMaps::Waypoint::Waypoint ( const QGeoCoordinate & coordinate,
const QString & name = {} )

Constructs a waypoint from a coordinate.

  • category is set to "WP"
  • name is set to the "Waypoint" or to the name given in the argument
  • type is set to "WP"
Parameters
coordinateGeographical position of the waypoint
nameName of the waypoint

◆ Waypoint() [3/3]

GeoMaps::Waypoint::Waypoint ( const QJsonObject & geoJSONObject)
explicit

Constructs a waypoint from a GeoJSON object.

This method constructs a Waypoint from a GeoJSON description. The GeoJSON file specification is found here.

Parameters
geoJSONObjectGeoJSON Object that describes the waypoint

Member Function Documentation

◆ category()

auto GeoMaps::Waypoint::category ( ) const -> QString
inlinenodiscard

Getter method for property with same name.

Returns
Property category

Definition at line 195 of file Waypoint.h.

◆ coordinate()

auto GeoMaps::Waypoint::coordinate ( ) const -> QGeoCoordinate
inlinenodiscard

Getter function for property with the same name.

Returns
Property coordinate

Definition at line 204 of file Waypoint.h.

◆ copy()

Q_INVOKABLE GeoMaps::Waypoint GeoMaps::Waypoint::copy ( ) const
inlinenodiscard

Deep copy.

This method exists for the benefit of QML, where deep copies are hard to produce.

Returns
Copy of the present waypoint.

Definition at line 352 of file Waypoint.h.

◆ extendedName()

auto GeoMaps::Waypoint::extendedName ( ) const -> QString
nodiscard

Getter function for property with the same name.

Returns
Property extendedName

◆ ICAOCode()

auto GeoMaps::Waypoint::ICAOCode ( ) const -> QString
inlinenodiscard

Getter method for property with same name.

Returns
Property ICAOCode

Definition at line 219 of file Waypoint.h.

◆ icon()

auto GeoMaps::Waypoint::icon ( ) const -> QString
nodiscard

Getter method for property with the same name.

Returns
Property icon

◆ isNear()

Q_INVOKABLE bool GeoMaps::Waypoint::isNear ( const GeoMaps::Waypoint & other) const
nodiscard

Check if other waypoint is geographically near *this.

Parameters
otherOther waypoint
Returns
True if both waypoints are valid and if the distance between them is less than 2km

◆ isValid()

auto GeoMaps::Waypoint::isValid ( ) const -> bool
nodiscard

Getter method for property with same name.

Returns
Property isValid

◆ name()

auto GeoMaps::Waypoint::name ( ) const -> QString
inlinenodiscard

Getter method for property with same name.

Returns
Property name

Definition at line 240 of file Waypoint.h.

◆ notes()

auto GeoMaps::Waypoint::notes ( ) const -> QString
inlinenodiscard

Getter method for property with same name.

Returns
Property notes

Definition at line 249 of file Waypoint.h.

◆ operator!=()

Q_INVOKABLE bool GeoMaps::Waypoint::operator!= ( const GeoMaps::Waypoint & other) const
nodiscarddefault

Comparison.

Parameters
otherWaypoint to compare with
Returns
Result of comparison

◆ operator==()

Q_INVOKABLE bool GeoMaps::Waypoint::operator== ( const GeoMaps::Waypoint & other) const
nodiscarddefault

Comparison.

Parameters
otherWaypoint to compare with
Returns
Result of comparison

◆ setCoordinate()

void GeoMaps::Waypoint::setCoordinate ( const QGeoCoordinate & newCoordinate)
inline

Set coordinate.

Parameters
newCoordinateNew coordinate of the waypoint

Definition at line 302 of file Waypoint.h.

◆ setName()

void GeoMaps::Waypoint::setName ( const QString & newName)
inline

Set name.

Parameters
newNameNew name of the waypoint

Definition at line 311 of file Waypoint.h.

◆ setNotes()

void GeoMaps::Waypoint::setNotes ( const QString & newNotes)
inline

Set notes.

Parameters
newNotesNew notes attached to the waypoint

Definition at line 320 of file Waypoint.h.

◆ shortName()

auto GeoMaps::Waypoint::shortName ( ) const -> QString
inlinenodiscard

Getter method for property with same name.

Returns
Property shortName

Definition at line 258 of file Waypoint.h.

◆ tabularDescription()

auto GeoMaps::Waypoint::tabularDescription ( ) const -> QList< QString >
nodiscard

Getter method for property with the same name.

Returns
Property tabularDescription

◆ toGPX()

void GeoMaps::Waypoint::toGPX ( QXmlStreamWriter & stream) const

Serialization to GPX object.

This method serialises the waypoint as a GPX object and writes the object to an XmlStream. If the waypoint is invalid, this method does nothing.

Parameters
streamXmlStream that the waypoint is written to, as a wpt element

◆ toJSON()

QJsonObject GeoMaps::Waypoint::toJSON ( ) const
nodiscard

Serialization to GeoJSON object.

This method serialises the waypoint as a GeoJSON object. The object conforms to the specification outlined here. The waypoint can be restored with the obvious constructor

Returns
QJsonObject describing the waypoint

◆ twoLineTitle()

auto GeoMaps::Waypoint::twoLineTitle ( ) const -> QString
nodiscard

Getter function for property with the same name.

Returns
Property twoLineTitle

◆ type()

auto GeoMaps::Waypoint::type ( ) const -> QString
inlinenodiscard

Getter method for property with same name.

Returns
Property type

Definition at line 282 of file Waypoint.h.

◆ variation()

auto GeoMaps::Waypoint::variation ( ) const -> Units::Angle
nodiscard

Get variation.

Returns
The variation, or NaN if not available.

◆ qHash

size_t qHash ( const GeoMaps::Waypoint & waypoint)
friend

qHash

Parameters
waypointWaypoint
Returns
Hash value

Property Documentation

◆ category

QString GeoMaps::Waypoint::category
read

Category of the waypoint.

This property holds the category of the waypoint. For a list of possible values and explanations, see the GeoJSON file specification here.

Definition at line 95 of file Waypoint.h.

◆ coordinate

QGeoCoordinate GeoMaps::Waypoint::coordinate
readwrite

Coordinate of the waypoint.

This property holds the category of the waypoint. The coordinate might include the elevation.

Definition at line 102 of file Waypoint.h.

◆ extendedName

QString GeoMaps::Waypoint::extendedName
read

Extended name of the waypoint.

This property holds an extended name string of the form "Karlsruhe (DVOR-DME)"

Definition at line 109 of file Waypoint.h.

◆ ICAOCode

QString GeoMaps::Waypoint::ICAOCode
read

ICAO Code of the waypoint.

This property holds the four-letter ICAO code of the waypoint, or an empty string if no ICAO code exists.

Definition at line 116 of file Waypoint.h.

◆ icon

QString GeoMaps::Waypoint::icon
read

Suggested icon for use in GUI.

This property holds the URL of an icon, suitable for the representation of the waypoint in the GUI.

Definition at line 123 of file Waypoint.h.

◆ name

QString GeoMaps::Waypoint::name
readwrite

Name of the waypoint.

This property holds the name of the waypoint.

Definition at line 137 of file Waypoint.h.

◆ notes

QString GeoMaps::Waypoint::notes
readwrite

Notes attached to the waypoint.

This property holds notes attached to the waypoint.

Definition at line 143 of file Waypoint.h.

◆ shortName

QString GeoMaps::Waypoint::shortName
read

Short name of the waypoint.

This property holds the ICAO code if it exists, or else the name of the waypoint.

Definition at line 150 of file Waypoint.h.

◆ twoLineTitle

QString GeoMaps::Waypoint::twoLineTitle
read

Two-line description of the waypoint name, for use in GUI.

This property holds a one-line or two-line description of the waypoint. Depending on available data, this is a string of the form "<strong>LFKA</strong><br><font size='2'>ALBERTVILLE</font>" or simply "KIRCHZARTEN"

Definition at line 170 of file Waypoint.h.

◆ type

QString GeoMaps::Waypoint::type
read

Type of the waypoint.

This property holds the type of the waypoint. For a list of possible values and explanations, see the GeoJSON file specification here.

Definition at line 178 of file Waypoint.h.

◆ variation

Units::Angle GeoMaps::Waypoint::variation
read

Magnetic variation at the waypoint.

This property holds the magnetic variation at the waypoint as a number.

Definition at line 184 of file Waypoint.h.


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