Marble

Coordinate.h
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2011 Dennis Nienhüser <[email protected]>
9 //
10 
11 #ifndef MARBLE_DECLARATIVE_COORDINATE_H
12 #define MARBLE_DECLARATIVE_COORDINATE_H
13 
14 #include "GeoDataCoordinates.h"
15 #include <QObject>
16 #include <QtQml>
17 
23 class Coordinate : public QObject
24 {
25  Q_OBJECT
26 
27  Q_PROPERTY( qreal longitude READ longitude WRITE setLongitude NOTIFY longitudeChanged )
28  Q_PROPERTY( qreal latitude READ latitude WRITE setLatitude NOTIFY latitudeChanged )
29  Q_PROPERTY( qreal altitude READ altitude WRITE setAltitude NOTIFY altitudeChanged )
30 
31 public:
33  explicit Coordinate( qreal lon = 0.0, qreal lat = 0.0, qreal altitude = 0.0, QObject *parent = nullptr );
35 
37  qreal longitude() const;
38 
40  void setLongitude( qreal lon );
41 
43  qreal latitude() const;
44 
46  void setLatitude( qreal lat );
47 
49  qreal altitude() const;
50 
52  void setAltitude( qreal alt );
53 
56 
58  void setCoordinates( const Marble::GeoDataCoordinates &coordinates );
59 
61  Q_INVOKABLE qreal distance( qreal longitude, qreal latitude ) const;
62 
64  Q_INVOKABLE qreal bearing( qreal longitude, qreal latitude ) const;
65 
66  bool operator == ( const Coordinate &other ) const;
67 
68  bool operator != ( const Coordinate &other ) const;
69 
70 Q_SIGNALS:
71  void longitudeChanged();
72  void latitudeChanged();
73  void altitudeChanged();
74 
75 private:
76  Marble::GeoDataCoordinates m_coordinate;
77 };
78 
79 QML_DECLARE_TYPE( Coordinate )
80 
81 #endif // MARBLE_DECLARATIVE_COORDINATE_H
A 3d point representation.
Coordinate(qreal lon=0.0, qreal lat=0.0, qreal altitude=0.0, QObject *parent=nullptr)
Constructor.
Definition: Coordinate.cpp:19
qreal longitude() const
Provides access to the longitude (degree) of the coordinate.
Q_SIGNALSQ_SIGNALS
Represents a coordinate with the properties of a name and coordinates.
Definition: Coordinate.h:23
qreal altitude() const
Provides access to the altitude (meters) of the coordinate.
Q_OBJECTQ_OBJECT
Q_INVOKABLE qreal distance(qreal longitude, qreal latitude) const
Distance (in meter) to the given coordinate.
Definition: Coordinate.cpp:75
void setCoordinates(const Marble::GeoDataCoordinates &coordinates)
Change all coordinates at once.
Definition: Coordinate.cpp:70
Q_PROPERTY(...)
Marble::GeoDataCoordinates coordinates() const
Change the altitude of the coordinate.
Definition: Coordinate.cpp:65
void setLatitude(qreal lat)
Change the latitude of the coordinate.
Definition: Coordinate.cpp:48
Q_INVOKABLEQ_INVOKABLE
void setAltitude(qreal alt)
Change the altitude of the coordinate.
Definition: Coordinate.cpp:59
void setLongitude(qreal lon)
Change the longitude of the coordinate.
Definition: Coordinate.cpp:37
QObject * parent() const const
Q_INVOKABLE qreal bearing(qreal longitude, qreal latitude) const
Bearing (in degree) to the given coordinate.
Definition: Coordinate.cpp:82
qreal latitude() const
Provides access to the latitude (degree) of the coordinate.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Jul 9 2020 23:18:42 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.