File indexing completed on 2025-03-09 03:57:15
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2009-12-08 0007 * Description : Marble-backend for geolocation interface 0008 * 0009 * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2009-2011 by Michael G. Hansen <mike at mghansen dot de> 0011 * SPDX-FileCopyrightText: 2014 by Justus Schwartz <justus at gmx dot li> 0012 * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * 0015 * ============================================================ */ 0016 0017 #ifndef DIGIKAM_BACKEND_MARBLE_H 0018 #define DIGIKAM_BACKEND_MARBLE_H 0019 0020 // Local includes 0021 0022 #include "mapbackend.h" 0023 #include "trackmanager.h" 0024 #include "digikam_export.h" 0025 0026 /// @cond false 0027 namespace Marble 0028 { 0029 class GeoPainter; 0030 } 0031 /// @endcond 0032 0033 namespace Digikam 0034 { 0035 0036 class DIGIKAM_EXPORT BackendMarble : public MapBackend 0037 { 0038 Q_OBJECT 0039 0040 public: 0041 0042 explicit BackendMarble(const QExplicitlySharedDataPointer<GeoIfaceSharedData>& sharedData, 0043 QObject* const parent = nullptr); 0044 ~BackendMarble() override; 0045 0046 QString backendName() const override; 0047 QString backendHumanName() const override; 0048 QWidget* mapWidget() override; 0049 void releaseWidget(GeoIfaceInternalWidgetInfo* const info) override; 0050 void mapWidgetDocked(const bool state) override; 0051 0052 GeoCoordinates getCenter() const override; 0053 void setCenter(const GeoCoordinates& coordinate) override; 0054 0055 bool isReady() const override; 0056 0057 void zoomIn() override; 0058 void zoomOut() override; 0059 0060 void saveSettingsToGroup(KConfigGroup* const group) override; 0061 void readSettingsFromGroup(const KConfigGroup* const group) override; 0062 0063 void addActionsToConfigurationMenu(QMenu* const configurationMenu) override; 0064 0065 void updateMarkers() override; 0066 void updateClusters() override; 0067 0068 QString getMapTheme() const; 0069 void setMapTheme(const QString& newMapTheme); 0070 0071 QString getProjection() const; 0072 void setProjection(const QString& newProjection); 0073 0074 bool screenCoordinates(const GeoCoordinates& coordinates, 0075 QPoint* const point) override; 0076 bool geoCoordinates(const QPoint& point, 0077 GeoCoordinates* const coordinates) const override; 0078 QSize mapSize() const override; 0079 0080 void setZoom(const QString& newZoom) override; 0081 QString getZoom() const override; 0082 0083 int getMarkerModelLevel() override; 0084 GeoCoordinates::PairList getNormalizedBounds() override; 0085 /* 0086 virtual void updateDragDropMarker(const QPoint& pos, 0087 const GeoIfaceDragData* const dragData); 0088 virtual void updateDragDropMarkerPosition(const QPoint& pos); 0089 */ 0090 void updateActionAvailability() override; 0091 0092 void marbleCustomPaint(Marble::GeoPainter* painter); 0093 void setShowCompass(const bool state); 0094 void setShowScaleBar(const bool state); 0095 void setShowNavigation(const bool state); 0096 void setShowOverviewMap(const bool state); 0097 0098 void regionSelectionChanged() override; 0099 void mouseModeChanged() override; 0100 0101 void centerOn(const Marble::GeoDataLatLonBox& box, 0102 const bool useSaneZoomLevel) override; 0103 void setActive(const bool state) override; 0104 0105 void reload() override; 0106 0107 public Q_SLOTS: 0108 0109 void slotClustersNeedUpdating() override; 0110 void slotThumbnailAvailableForIndex(const QVariant& index, 0111 const QPixmap& pixmap) override; 0112 void slotUngroupedModelChanged(const int index); 0113 void slotTrackManagerChanged() override; 0114 0115 protected: 0116 0117 bool eventFilter(QObject* object, QEvent* event) override; 0118 void createActions(); 0119 bool findSnapPoint(const QPoint& actualPoint, 0120 QPoint* const snapPoint, 0121 GeoCoordinates* const snapCoordinates, 0122 QPair<int, QModelIndex>* const snapTargetIndex); 0123 void GeoPainter_drawPixmapAtCoordinates(Marble::GeoPainter* const painter, 0124 const QPixmap& pixmap, 0125 const GeoCoordinates& coordinates, 0126 const QPoint& basePoint); 0127 void drawSearchRectangle(Marble::GeoPainter* const painter, 0128 const GeoCoordinates::Pair& searchRectangle, 0129 const bool isOldRectangle); 0130 void applyCacheToWidget(); 0131 0132 static void deleteInfoFunction(GeoIfaceInternalWidgetInfo* const info); 0133 0134 protected Q_SLOTS: 0135 0136 void slotMapThemeActionTriggered(QAction* action); 0137 void slotProjectionActionTriggered(QAction* action); 0138 void slotFloatSettingsTriggered(QAction* action); 0139 void slotMarbleZoomChanged(); 0140 void slotTracksChanged(const QList<TrackManager::TrackChanges>& trackChanges); 0141 void slotScheduleUpdate(); 0142 0143 private: 0144 0145 class Private; 0146 Private* const d; 0147 }; 0148 0149 } // namespace Digikam 0150 0151 #endif // DIGIKAM_BACKEND_MARBLE_H