File indexing completed on 2024-05-05 12:06:51
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2010 Siddharth Srivastava <akssps011@gmail.com> 0004 // 0005 0006 #ifndef MARBLE_AUTONAVIGATION_H 0007 #define MARBLE_AUTONAVIGATION_H 0008 0009 #include "marble_export.h" 0010 #include "MarbleGlobal.h" 0011 0012 #include <QObject> 0013 0014 namespace Marble 0015 { 0016 0017 class GeoDataCoordinates; 0018 class MarbleModel; 0019 class ViewportParams; 0020 0021 class MARBLE_EXPORT AutoNavigation : public QObject 0022 { 0023 Q_OBJECT 0024 0025 public: 0026 0027 /** 0028 * @brief Constructor 0029 * @param widget the marble widget. It cannot be null. 0030 * @param parent optional parent object 0031 */ 0032 explicit AutoNavigation( MarbleModel *model, const ViewportParams *viewport, QObject *parent = nullptr ); 0033 0034 /** Destructor */ 0035 ~AutoNavigation() override; 0036 0037 /** 0038 * An enum type 0039 * Represents which recentering method is selected 0040 */ 0041 enum CenterMode { 0042 DontRecenter = 0, 0043 AlwaysRecenter = 1, /**< Enum Value AlwaysRecenter. Recenter always to the map center */ 0044 RecenterOnBorder = 2 /**< Enum Value RecenterOnBorder. Recenter when reaching map border */ 0045 }; 0046 0047 /** 0048 * @brief For Auto Centering adjustment of map in Navigation Mode 0049 * @param recenterMode toggles among the recenteing method chosen 0050 * @see CenterMode 0051 */ 0052 void setRecenter( CenterMode recenterMode ); 0053 0054 /** 0055 * @brief For Auto Zooming adjustment of map in Navigation Mode 0056 * @param activate true to enable auto zooming 0057 */ 0058 void setAutoZoom( bool activate ); 0059 0060 AutoNavigation::CenterMode recenterMode() const; 0061 0062 bool autoZoom() const; 0063 0064 public Q_SLOTS: 0065 0066 /** 0067 * @brief For adjusting the gps location (recentering) or map(autozooming) 0068 * @param position current gps location 0069 * @param speed of the gps device 0070 */ 0071 void adjust( const GeoDataCoordinates &position, qreal speed ); 0072 0073 /** 0074 * Temporarily inhibits auto-centering and auto-zooming 0075 */ 0076 void inhibitAutoAdjustments(); 0077 0078 Q_SIGNALS: 0079 /** 0080 * signal emitted when auto center is turned on (Always re-center, re-center when required ) or off(Disabled) 0081 * @param recenterMode the mode for re-centering selected 0082 */ 0083 void recenterModeChanged( AutoNavigation::CenterMode mode ); 0084 0085 /** 0086 * signal emitted when auto zoom is toggled 0087 */ 0088 void autoZoomToggled( bool enabled ); 0089 0090 void zoomIn( FlyToMode ); 0091 0092 void zoomOut( FlyToMode ); 0093 0094 void centerOn( const GeoDataCoordinates &position, bool animated ); 0095 0096 private: 0097 class Private; 0098 Private * const d; 0099 }; 0100 } //namespace marble 0101 0102 #endif // MARBLE_AUTONAVIGATION_H