1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2010 Dennis Nienhüser <nienhueser@kde.org>
4 //
5 
6 #ifndef MARBLE_ROUTINGPOINT_H
7 #define MARBLE_ROUTINGPOINT_H
8 
9 #include "marble_export.h"
10 
11 #include <QtGlobal>
12 
13 class QTextStream;
14 
15 namespace Marble
16 {
17 
18 /**
19   * There are many Point classes, but this is mine.
20   */
21 class MARBLE_EXPORT RoutingPoint
22 {
23 public:
24     explicit RoutingPoint( qreal lon = 0.0, qreal lat = 0.0 );
25 
26     /** Longitude of the point */
27     qreal lon() const;
28 
29     /** Latitude of the point */
30     qreal lat() const;
31 
32     /**
33       * Calculates the bearing of the line defined by this point
34       * and the given other point.
35       * Code based on https://www.movable-type.co.uk/scripts/latlong.html
36       */
37     qreal bearing( const RoutingPoint &other ) const;
38 
39     /**
40       * Calculates the distance in meter between this point and the
41       * given other point.
42       * Code based on https://www.movable-type.co.uk/scripts/latlong.html
43       */
44     qreal distance( const RoutingPoint &other ) const;
45 
46 private:
47     qreal m_lon;
48 
49     qreal m_lonRad;
50 
51     qreal m_lat;
52 
53     qreal m_latRad;
54 };
55 
56 QTextStream& operator<<( QTextStream& stream, const RoutingPoint &i );
57 
58 } // namespace Marble
59 
60 #endif // MARBLE_ROUTINGPOINT_H
61