File indexing completed on 2024-07-14 07:22:54

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2008 Torsten Rahn <tackat@kde.org>
0004 //
0005 
0006 #ifndef MARBLEOVERVIEWMAP_H
0007 #define MARBLEOVERVIEWMAP_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, public DialogConfigurationInterface
0033 {
0034     Q_OBJECT
0035     Q_PLUGIN_METADATA(IID "org.kde.marble.OverviewMap")
0036     Q_INTERFACES( Marble::RenderPluginInterface )
0037     Q_INTERFACES( Marble::DialogConfigurationInterface )
0038     MARBLE_PLUGIN( OverviewMap )
0039     
0040  public:
0041     OverviewMap();
0042     explicit OverviewMap( const MarbleModel *marbleModel );
0043     ~OverviewMap() override;
0044 
0045     QStringList backendTypes() const override;
0046 
0047     QString name() const override;
0048 
0049     QString guiString() const override;
0050 
0051     QString nameId() const override;
0052 
0053     QString version() const override;
0054 
0055     QString description() const override;
0056 
0057     QString copyrightYears() const override;
0058 
0059     QVector<PluginAuthor> pluginAuthors() const override;
0060 
0061     QIcon icon () const override;
0062 
0063     QDialog *configDialog() override;
0064 
0065     void initialize () override;
0066 
0067     bool isInitialized () const override;
0068 
0069     void setProjection( const ViewportParams *viewport ) override;
0070 
0071     void paintContent( QPainter *painter ) override;
0072 
0073     /**
0074      * @return: The settings of the item.
0075      */
0076     QHash<QString,QVariant> settings() const override;
0077 
0078     /**
0079      * Set the settings of the item.
0080      */
0081     void setSettings( const QHash<QString,QVariant> &settings ) override;
0082 
0083  public Q_SLOTS:
0084     void readSettings();
0085     void writeSettings();
0086     void updateSettings();
0087 
0088  protected:
0089     bool eventFilter( QObject *object, QEvent *e ) override;
0090 
0091  private:
0092     void changeBackground( const QString& target );
0093     QSvgWidget *currentWidget() const;
0094     void setCurrentWidget( QSvgWidget *widget );
0095     void loadPlanetMaps();
0096     void loadMapSuggestions();
0097 
0098     QString m_target;
0099     QSvgRenderer   m_svgobj;
0100     QHash<QString, QSvgWidget *> m_svgWidgets;
0101     QHash<QString, QString> m_svgPaths;
0102     QStringList    m_planetID;
0103     QPixmap        m_worldmap;
0104     QHash<QString,QVariant> m_settings;
0105     QColor m_posColor;
0106     QSizeF m_defaultSize;
0107 
0108     Ui::OverviewMapConfigWidget *ui_configWidget;
0109     QDialog *m_configDialog;
0110 
0111     GeoDataLatLonAltBox m_latLonAltBox;
0112     qreal m_centerLat;
0113     qreal m_centerLon;
0114     bool m_mapChanged;
0115 
0116  private Q_SLOTS:
0117     void chooseCustomMap();
0118     void synchronizeSpinboxes();
0119     void showCurrentPlanetPreview() const;
0120     void choosePositionIndicatorColor();
0121     void useMapSuggestion( int index );
0122 };
0123 
0124 }
0125 
0126 #endif