File indexing completed on 2024-05-12 03:50:41
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2010 Dennis Nienhüser <nienhueser@kde.org> 0004 // 0005 0006 #ifndef MARBLE_ROUTINGPOINT_H 0007 #define MARBLE_ROUTINGPOINT_H 0008 0009 #include "marble_export.h" 0010 0011 #include <QtGlobal> 0012 0013 class QTextStream; 0014 0015 namespace Marble 0016 { 0017 0018 /** 0019 * There are many Point classes, but this is mine. 0020 */ 0021 class MARBLE_EXPORT RoutingPoint 0022 { 0023 public: 0024 explicit RoutingPoint( qreal lon = 0.0, qreal lat = 0.0 ); 0025 0026 /** Longitude of the point */ 0027 qreal lon() const; 0028 0029 /** Latitude of the point */ 0030 qreal lat() const; 0031 0032 /** 0033 * Calculates the bearing of the line defined by this point 0034 * and the given other point. 0035 * Code based on https://www.movable-type.co.uk/scripts/latlong.html 0036 */ 0037 qreal bearing( const RoutingPoint &other ) const; 0038 0039 /** 0040 * Calculates the distance in meter between this point and the 0041 * given other point. 0042 * Code based on https://www.movable-type.co.uk/scripts/latlong.html 0043 */ 0044 qreal distance( const RoutingPoint &other ) const; 0045 0046 private: 0047 qreal m_lon; 0048 0049 qreal m_lonRad; 0050 0051 qreal m_lat; 0052 0053 qreal m_latRad; 0054 }; 0055 0056 QTextStream& operator<<( QTextStream& stream, const RoutingPoint &i ); 0057 0058 } // namespace Marble 0059 0060 #endif // MARBLE_ROUTINGPOINT_H