digiKam
backendgooglemaps.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-01
7  * Description : Google-Maps-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_GOOGLE_MAPS_H
27 #define DIGIKAM_BACKEND_GOOGLE_MAPS_H
28 
29 // Local includes
30 
31 #include "mapbackend.h"
32 #include "trackmanager.h"
33 #include "digikam_export.h"
34 
35 namespace Digikam
36 {
37 
38 class DIGIKAM_EXPORT BackendGoogleMaps : public MapBackend
39 {
40  Q_OBJECT
41 
42 public:
43 
44  explicit BackendGoogleMaps(const QExplicitlySharedDataPointer<GeoIfaceSharedData>& sharedData,
45  QObject* const parent = nullptr);
46  ~BackendGoogleMaps() override;
47 
48  QString backendName() const override;
49  QString backendHumanName() const override;
50  QWidget* mapWidget() override;
51  void releaseWidget(GeoIfaceInternalWidgetInfo* const info) override;
52  void mapWidgetDocked(const bool state) override;
53 
54  GeoCoordinates getCenter() const override;
55  void setCenter(const GeoCoordinates& coordinate) override;
56 
57  bool isReady() const override;
58 
59  void zoomIn() override;
60  void zoomOut() override;
61 
62  void saveSettingsToGroup(KConfigGroup* const group) override;
63  void readSettingsFromGroup(const KConfigGroup* const group) override;
64 
65  void addActionsToConfigurationMenu(QMenu* const configurationMenu) override;
66 
67  void updateMarkers() override;
68  void updateClusters() override;
69 
70  bool screenCoordinates(const GeoCoordinates& coordinates, QPoint* const point) override;
71  bool geoCoordinates(const QPoint& point, GeoCoordinates* const coordinates) const override;
72  QSize mapSize() const override;
73 
74  void setZoom(const QString& newZoom) override;
75  QString getZoom() const override;
76 
77  int getMarkerModelLevel() override;
78  GeoCoordinates::PairList getNormalizedBounds() override;
79 /*
80  virtual void updateDragDropMarker(const QPoint& pos,
81  const GeoIfaceDragData* const dragData);
82  virtual void updateDragDropMarkerPosition(const QPoint& pos);
83 */
84  void updateActionAvailability() override;
85 
86  QString getMapType() const;
87  void setMapType(const QString& newMapType);
88  void setShowMapTypeControl(const bool state);
89  void setShowScaleControl(const bool state);
90  void setShowNavigationControl(const bool state);
91 
92  void regionSelectionChanged() override;
93  void mouseModeChanged() override;
94 
95  void centerOn(const Marble::GeoDataLatLonBox& latLonBox, const bool useSaneZoomLevel) override;
96  void setActive(const bool state) override;
97 
98 public Q_SLOTS:
99 
100  void slotClustersNeedUpdating() override;
101  void slotThumbnailAvailableForIndex(const QVariant& index, const QPixmap& pixmap) override;
102  void slotUngroupedModelChanged(const int mindex);
103 
104 protected:
105 
106  bool eventFilter(QObject* object, QEvent* event) override;
107  void createActions();
108  void setClusterPixmap(const int clusterId,
109  const QPoint& centerPoint,
110  const QPixmap& clusterPixmap);
111  void setMarkerPixmap(const int modelId,
112  const int markerId,
113  const QPoint& centerPoint,
114  const QPixmap& markerPixmap);
115  void setMarkerPixmap(const int modelId,
116  const int markerId,
117  const QPoint& centerPoint,
118  const QSize& iconSize,
119  const QUrl& iconUrl);
120  void storeTrackChanges(const TrackManager::TrackChanges trackChanges);
121 
122 private Q_SLOTS:
123 
124  void slotHTMLInitialized();
125  void slotSetCenterTimer();
126  void slotMapTypeActionTriggered(QAction* action);
127  void slotHTMLEvents(const QStringList& eventStrings);
128  void slotFloatSettingsTriggered(QAction* action);
129  void slotSelectionHasBeenMade(const Digikam::GeoCoordinates::Pair& searchCoordinates);
130  void slotTrackManagerChanged() override;
131  void slotTracksChanged(const QList<TrackManager::TrackChanges>& trackChanges);
132  void slotTrackVisibilityChanged(const bool newState);
133 
134 private:
135 
136  void updateZoomMinMaxCache();
137  static void deleteInfoFunction(GeoIfaceInternalWidgetInfo* const info);
138  void addPointsToTrack(const quint64 trackId,
139  TrackManager::TrackPoint::List const& track,
140  const int firstPoint,
141  const int nPoints);
142 
143 private:
144 
145  class Private;
146  Private* const d;
147 };
148 
149 } // namespace Digikam
150 
151 #endif // DIGIKAM_BACKEND_GOOGLE_MAPS_H
Definition: backendgooglemaps.h:39
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
QPair< Id, ChangeFlag > TrackChanges
Definition: trackmanager.h:63
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43