digiKam
backendmarble.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2009-12-08
7  * Description : Marble-backend for geolocation interface
8  *
9  * Copyright (C) 2010-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2009-2011 by Michael G. Hansen <mike at mghansen dot de>
11  * Copyright (C) 2014 by Justus Schwartz <justus at gmx dot li>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_BACKEND_MARBLE_H
27 #define DIGIKAM_BACKEND_MARBLE_H
28 
29 // Local includes
30 
31 #include "mapbackend.h"
32 #include "trackmanager.h"
33 #include "digikam_export.h"
34 
36 namespace Marble
37 {
38  class GeoPainter;
39 }
41 
42 namespace Digikam
43 {
44 
45 class DIGIKAM_EXPORT BackendMarble : public MapBackend
46 {
47  Q_OBJECT
48 
49 public:
50 
51  explicit BackendMarble(const QExplicitlySharedDataPointer<GeoIfaceSharedData>& sharedData,
52  QObject* const parent = nullptr);
53  ~BackendMarble() override;
54 
55  QString backendName() const override;
56  QString backendHumanName() const override;
57  QWidget* mapWidget() override;
58  void releaseWidget(GeoIfaceInternalWidgetInfo* const info) override;
59  void mapWidgetDocked(const bool state) override;
60 
61  GeoCoordinates getCenter() const override;
62  void setCenter(const GeoCoordinates& coordinate) override;
63 
64  bool isReady() const override;
65 
66  void zoomIn() override;
67  void zoomOut() override;
68 
69  void saveSettingsToGroup(KConfigGroup* const group) override;
70  void readSettingsFromGroup(const KConfigGroup* const group) override;
71 
72  void addActionsToConfigurationMenu(QMenu* const configurationMenu) override;
73 
74  void updateMarkers() override;
75  void updateClusters() override;
76 
77  QString getMapTheme() const;
78  void setMapTheme(const QString& newMapTheme);
79 
80  QString getProjection() const;
81  void setProjection(const QString& newProjection);
82 
83  bool screenCoordinates(const GeoCoordinates& coordinates,
84  QPoint* const point) override;
85  bool geoCoordinates(const QPoint& point,
86  GeoCoordinates* const coordinates) const override;
87  QSize mapSize() const override;
88 
89  void setZoom(const QString& newZoom) override;
90  QString getZoom() const override;
91 
92  int getMarkerModelLevel() override;
93  GeoCoordinates::PairList getNormalizedBounds() override;
94 /*
95  virtual void updateDragDropMarker(const QPoint& pos,
96  const GeoIfaceDragData* const dragData);
97  virtual void updateDragDropMarkerPosition(const QPoint& pos);
98 */
99  void updateActionAvailability() override;
100 
101  void marbleCustomPaint(Marble::GeoPainter* painter);
102  void setShowCompass(const bool state);
103  void setShowScaleBar(const bool state);
104  void setShowNavigation(const bool state);
105  void setShowOverviewMap(const bool state);
106 
107  void regionSelectionChanged() override;
108  void mouseModeChanged() override;
109 
110  void centerOn(const Marble::GeoDataLatLonBox& box,
111  const bool useSaneZoomLevel) override;
112  void setActive(const bool state) override;
113 
114 public Q_SLOTS:
115 
116  void slotClustersNeedUpdating() override;
117  void slotThumbnailAvailableForIndex(const QVariant& index,
118  const QPixmap& pixmap) override;
119  void slotUngroupedModelChanged(const int index);
120  void slotTrackManagerChanged() override;
121 
122 protected:
123 
124  bool eventFilter(QObject* object, QEvent* event) override;
125  void createActions();
126  bool findSnapPoint(const QPoint& actualPoint,
127  QPoint* const snapPoint,
128  GeoCoordinates* const snapCoordinates,
129  QPair<int, QModelIndex>* const snapTargetIndex);
130  void GeoPainter_drawPixmapAtCoordinates(Marble::GeoPainter* const painter,
131  const QPixmap& pixmap,
132  const GeoCoordinates& coordinates,
133  const QPoint& basePoint);
134  void drawSearchRectangle(Marble::GeoPainter* const painter,
135  const GeoCoordinates::Pair& searchRectangle,
136  const bool isOldRectangle);
137  void applyCacheToWidget();
138 
139  static void deleteInfoFunction(GeoIfaceInternalWidgetInfo* const info);
140 
141 protected Q_SLOTS:
142 
143  void slotMapThemeActionTriggered(QAction* action);
144  void slotProjectionActionTriggered(QAction* action);
145  void slotFloatSettingsTriggered(QAction* action);
146  void slotMarbleZoomChanged();
147  void slotTracksChanged(const QList<TrackManager::TrackChanges>& trackChanges);
148  void slotScheduleUpdate();
149 
150 private:
151 
152  class Private;
153  Private* const d;
154 };
155 
156 } // namespace Digikam
157 
158 #endif // DIGIKAM_BACKEND_MARBLE_H
Definition: backendmarble.h:46
Definition: geocoordinates.h:49
QPair< GeoCoordinates, GeoCoordinates > Pair
Definition: geocoordinates.h:64
Class to hold information about map widgets stored in the GeoIfaceGlobalObject.
Definition: geoifacecommon.h:61
Definition: mapbackend.h:52
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43