File indexing completed on 2025-01-05 03:59:26
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2008 Torsten Rahn <tackat@kde.org> 0004 // 0005 0006 #ifndef MARBLE_OVERVIEW_MAP_H 0007 #define MARBLE_OVERVIEW_MAP_H 0008 0009 #include <QHash> 0010 #include <QColor> 0011 #include <QPixmap> 0012 #include <QSvgWidget> 0013 #include <QSvgRenderer> 0014 0015 #include "GeoDataLatLonAltBox.h" 0016 #include "AbstractFloatItem.h" 0017 #include "DialogConfigurationInterface.h" 0018 0019 namespace Ui 0020 { 0021 class OverviewMapConfigWidget; 0022 } 0023 0024 namespace Marble 0025 { 0026 0027 /** 0028 * @short The class that creates an overview map. 0029 * 0030 */ 0031 0032 class OverviewMap : public AbstractFloatItem, 0033 public DialogConfigurationInterface 0034 { 0035 Q_OBJECT 0036 Q_PLUGIN_METADATA(IID "org.kde.marble.OverviewMap") 0037 Q_INTERFACES( Marble::RenderPluginInterface ) 0038 Q_INTERFACES( Marble::DialogConfigurationInterface ) 0039 MARBLE_PLUGIN( OverviewMap ) 0040 0041 public: 0042 0043 OverviewMap(); 0044 explicit OverviewMap( const MarbleModel *marbleModel ); 0045 ~OverviewMap() override; 0046 0047 QStringList backendTypes() const override; 0048 0049 QString name() const override; 0050 0051 QString guiString() const override; 0052 0053 QString nameId() const override; 0054 0055 QString version() const override; 0056 0057 QString description() const override; 0058 0059 QString copyrightYears() const override; 0060 0061 QVector<PluginAuthor> pluginAuthors() const override; 0062 0063 QIcon icon () const override; 0064 0065 QDialog *configDialog() override; 0066 0067 void initialize () override; 0068 0069 bool isInitialized () const override; 0070 0071 void setProjection( const ViewportParams *viewport ) override; 0072 0073 void paintContent( QPainter *painter ) override; 0074 0075 /** 0076 * @return: The settings of the item. 0077 */ 0078 QHash<QString,QVariant> settings() const override; 0079 0080 /** 0081 * Set the settings of the item. 0082 */ 0083 void setSettings( const QHash<QString,QVariant> &settings ) override; 0084 0085 public Q_SLOTS: 0086 0087 void readSettings(); 0088 void writeSettings(); 0089 void updateSettings(); 0090 0091 protected: 0092 0093 bool eventFilter( QObject *object, QEvent *e ) override; 0094 0095 private: 0096 0097 void changeBackground( const QString& target ); 0098 QSvgWidget *currentWidget() const; 0099 void setCurrentWidget( QSvgWidget *widget ); 0100 void loadPlanetMaps(); 0101 void loadMapSuggestions(); 0102 0103 QString m_target; 0104 QSvgRenderer m_svgobj; 0105 QHash<QString, QSvgWidget *> m_svgWidgets; 0106 QHash<QString, QString> m_svgPaths; 0107 QStringList m_planetID; 0108 QPixmap m_worldmap; 0109 QHash<QString,QVariant> m_settings; 0110 QColor m_posColor; 0111 QSizeF m_defaultSize; 0112 0113 Ui::OverviewMapConfigWidget *ui_configWidget; 0114 QDialog *m_configDialog; 0115 0116 GeoDataLatLonAltBox m_latLonAltBox; 0117 qreal m_centerLat; 0118 qreal m_centerLon; 0119 bool m_mapChanged; 0120 0121 private Q_SLOTS: 0122 0123 void chooseCustomMap(); 0124 void synchronizeSpinboxes(); 0125 void showCurrentPlanetPreview() const; 0126 void choosePositionIndicatorColor(); 0127 void useMapSuggestion( int index ); 0128 }; 0129 0130 } // namespace Marble 0131 0132 #endif // MARBLE_OVERVIEW_MAP_H