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-01 0007 * Description : Google-Maps-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_GOOGLE_MAPS_H 0018 #define DIGIKAM_BACKEND_GOOGLE_MAPS_H 0019 0020 // Local includes 0021 0022 #include "mapbackend.h" 0023 #include "trackmanager.h" 0024 #include "digikam_export.h" 0025 0026 namespace Digikam 0027 { 0028 0029 class DIGIKAM_EXPORT BackendGoogleMaps : public MapBackend 0030 { 0031 Q_OBJECT 0032 0033 public: 0034 0035 explicit BackendGoogleMaps(const QExplicitlySharedDataPointer<GeoIfaceSharedData>& sharedData, 0036 QObject* const parent = nullptr); 0037 ~BackendGoogleMaps() override; 0038 0039 QString backendName() const override; 0040 QString backendHumanName() const override; 0041 QWidget* mapWidget() override; 0042 void releaseWidget(GeoIfaceInternalWidgetInfo* const info) override; 0043 void mapWidgetDocked(const bool state) override; 0044 0045 GeoCoordinates getCenter() const override; 0046 void setCenter(const GeoCoordinates& coordinate) override; 0047 0048 bool isReady() const override; 0049 0050 void zoomIn() override; 0051 void zoomOut() override; 0052 0053 void saveSettingsToGroup(KConfigGroup* const group) override; 0054 void readSettingsFromGroup(const KConfigGroup* const group) override; 0055 0056 void addActionsToConfigurationMenu(QMenu* const configurationMenu) override; 0057 0058 void updateMarkers() override; 0059 void updateClusters() override; 0060 0061 bool screenCoordinates(const GeoCoordinates& coordinates, QPoint* const point) override; 0062 bool geoCoordinates(const QPoint& point, GeoCoordinates* const coordinates) const override; 0063 QSize mapSize() const override; 0064 0065 void setZoom(const QString& newZoom) override; 0066 QString getZoom() const override; 0067 0068 int getMarkerModelLevel() override; 0069 GeoCoordinates::PairList getNormalizedBounds() override; 0070 /* 0071 virtual void updateDragDropMarker(const QPoint& pos, 0072 const GeoIfaceDragData* const dragData); 0073 virtual void updateDragDropMarkerPosition(const QPoint& pos); 0074 */ 0075 void updateActionAvailability() override; 0076 0077 QString getMapType() const; 0078 void setMapType(const QString& newMapType); 0079 void setShowMapTypeControl(const bool state); 0080 void setShowScaleControl(const bool state); 0081 void setShowNavigationControl(const bool state); 0082 0083 void regionSelectionChanged() override; 0084 void mouseModeChanged() override; 0085 0086 void setActive(const bool state) override; 0087 0088 #ifdef HAVE_GEOLOCATION 0089 0090 void centerOn(const Marble::GeoDataLatLonBox& latLonBox, const bool useSaneZoomLevel) override; 0091 0092 #endif 0093 0094 void reload() override; 0095 0096 public Q_SLOTS: 0097 0098 void slotClustersNeedUpdating() override; 0099 void slotThumbnailAvailableForIndex(const QVariant& index, const QPixmap& pixmap) override; 0100 void slotUngroupedModelChanged(const int mindex); 0101 0102 protected: 0103 0104 bool eventFilter(QObject* object, QEvent* event) override; 0105 void createActions(); 0106 void setClusterPixmap(const int clusterId, 0107 const QPoint& centerPoint, 0108 const QPixmap& clusterPixmap); 0109 void setMarkerPixmap(const int modelId, 0110 const int markerId, 0111 const QPoint& centerPoint, 0112 const QPixmap& markerPixmap); 0113 void setMarkerPixmap(const int modelId, 0114 const int markerId, 0115 const QPoint& centerPoint, 0116 const QSize& iconSize, 0117 const QUrl& iconUrl); 0118 void storeTrackChanges(const TrackManager::TrackChanges trackChanges); 0119 0120 private Q_SLOTS: 0121 0122 void slotHTMLInitialized(); 0123 void slotSetCenterTimer(); 0124 void slotMessageEvent(const QString& message); 0125 void slotMapTypeActionTriggered(QAction* action); 0126 void slotHTMLEvents(const QStringList& eventStrings); 0127 void slotFloatSettingsTriggered(QAction* action); 0128 void slotSelectionHasBeenMade(const Digikam::GeoCoordinates::Pair& searchCoordinates); 0129 void slotTrackManagerChanged() override; 0130 void slotTracksChanged(const QList<TrackManager::TrackChanges>& trackChanges); 0131 void slotTrackVisibilityChanged(const bool newState); 0132 0133 private: 0134 0135 void updateZoomMinMaxCache(); 0136 static void deleteInfoFunction(GeoIfaceInternalWidgetInfo* const info); 0137 void addPointsToTrack(const quint64 trackId, 0138 TrackManager::TrackPoint::List const& track, 0139 const int firstPoint, 0140 const int nPoints); 0141 0142 private: 0143 0144 class Private; 0145 Private* const d; 0146 }; 0147 0148 } // namespace Digikam 0149 0150 #endif // DIGIKAM_BACKEND_GOOGLE_MAPS_H