digiKam
gpsmarkertiler.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 : 2010-07-20
7  * Description : GPS search marker tiler
8  *
9  * Copyright (C) 2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  * Copyright (C) 2010 by Gabriel Voicu <ping dot gabi at gmail dot com>
11  * Copyright (C) 2010-2011 by Michael G. Hansen <mike at mghansen dot de>
12  * Copyright (C) 2015 by Mohamed_Anwer <m_dot_anwer at gmx dot com>
13  *
14  * This program is free software; you can redistribute it
15  * and/or modify it under the terms of the GNU General
16  * Public License as published by the Free Software Foundation;
17  * either version 2, or (at your option)
18  * any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * ============================================================ */
26 
27 #ifndef DIGIKAM_GPS_MARKER_TILER_H
28 #define DIGIKAM_GPS_MARKER_TILER_H
29 
30 // Qt includes
31 
32 #include <QByteArray>
33 #include <QMetaType>
34 #include <QItemSelectionModel>
35 
36 // Local includes
37 
38 #include "abstractmarkertiler.h"
39 #include "mapwidget.h"
40 #include "digikam_export.h"
41 #include "itemposition.h"
42 #include "coredbchangesets.h"
43 #include "itemlister.h"
44 #include "coredbaccess.h"
45 #include "coredb.h"
46 #include "iteminfo.h"
47 #include "thumbnailloadthread.h"
48 #include "thumbsdbaccess.h"
49 #include "thumbsdb.h"
50 #include "coredbwatch.h"
51 #include "coredbfields.h"
52 #include "itemalbummodel.h"
53 #include "itemfiltermodel.h"
54 
55 namespace Digikam
56 {
57 
58 class GPSItemInfo;
59 
61 {
62  Q_OBJECT
63 
64 public:
65 
66  class MyTile;
67 
68  explicit GPSMarkerTiler(QObject* const parent,
69  ItemFilterModel* const imageFilterModel,
70  QItemSelectionModel* const selectionModel);
71  ~GPSMarkerTiler() override;
72 
73  Tile* tileNew() override;
74  void prepareTiles(const GeoCoordinates& upperLeft, const GeoCoordinates& lowerRight, int level) override;
75  void regenerateTiles() override;
76  AbstractMarkerTiler::Tile* getTile(const TileIndex& tileIndex, const bool stopIfEmpty) override;
77  int getTileMarkerCount(const TileIndex& tileIndex) override;
78  int getTileSelectedCount(const TileIndex& tileIndex) override;
79 
80  QVariant getTileRepresentativeMarker(const TileIndex& tileIndex, const int sortKey) override;
81  QVariant bestRepresentativeIndexFromList(const QList<QVariant>& indices, const int sortKey) override;
82  QPixmap pixmapFromRepresentativeIndex(const QVariant& index, const QSize& size) override;
83  bool indicesEqual(const QVariant& a, const QVariant& b) const override;
84  GeoGroupState getTileGroupState(const TileIndex& tileIndex) override;
85  GeoGroupState getGlobalGroupState() override;
86 
87  void onIndicesClicked(const ClickInfo& clickInfo) override;
88 
89  void setActive(const bool state) override;
90 
93  void setPositiveFilterIsActive(const bool state);
94 
95 Q_SIGNALS:
96 
98 
99 public Q_SLOTS:
100 
101  void slotNewModelData(const QList<ItemInfo>& infoList);
102 
103 private Q_SLOTS:
104 
106  void slotMapImagesJobResult();
107  void slotMapImagesJobData(const QList<ItemListerRecord>& records);
108  void slotThumbnailLoaded(const LoadingDescription&, const QPixmap&);
109  void slotImageChange(const ImageChangeset& changeset);
110  void slotSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
111 
112 private:
113 
114  QList<qlonglong> getTileMarkerIds(const TileIndex& tileIndex);
115  GeoGroupState getImageState(const qlonglong imageId);
116  void removeMarkerFromTileAndChildren(const qlonglong imageId,
117  const TileIndex& markerTileIndex);
118  void addMarkerToTileAndChildren(const qlonglong imageId,
119  const TileIndex& markerTileIndex);
120 
121 private:
122 
123  class Private;
124  Private* const d;
125 };
126 
127 } // namespace Digikam
128 
129 #endif // DIGIKAM_GPS_MARKER_TILER_H
Definition: abstractmarkertiler.h:61
Definition: abstractmarkertiler.h:73
Definition: abstractmarkertiler.h:45
Marker model for storing data needed to display markers on the map. The data is retrieved from Digika...
Definition: gpsmarkertiler.h:61
void onIndicesClicked(const ClickInfo &clickInfo) override
these can be implemented if you want to react to actions in geolocation interface
Definition: gpsmarkertiler.cpp:798
GeoGroupState getTileGroupState(const TileIndex &tileIndex) override
Definition: gpsmarkertiler.cpp:488
void slotNewModelData(const QList< ItemInfo > &infoList)
Receives notifications from the album model about new items.
Definition: gpsmarkertiler.cpp:762
void regenerateTiles() override
Definition: gpsmarkertiler.cpp:151
AbstractMarkerTiler::Tile * getTile(const TileIndex &tileIndex, const bool stopIfEmpty) override
Returns a pointer to a tile.
Definition: gpsmarkertiler.cpp:276
void removeCurrentRegionSelection()
Definition: gpsmarkertiler.cpp:789
void setActive(const bool state) override
Sets the map active/inactive.
Definition: gpsmarkertiler.cpp:662
QVariant bestRepresentativeIndexFromList(const QList< QVariant > &indices, const int sortKey) override
This function finds the best representative marker from a group of markers. This is needed to display...
Definition: gpsmarkertiler.cpp:404
GPSMarkerTiler(QObject *const parent, ItemFilterModel *const imageFilterModel, QItemSelectionModel *const selectionModel)
Constructor.
Definition: gpsmarkertiler.cpp:117
int getTileSelectedCount(const TileIndex &tileIndex) override
Definition: gpsmarkertiler.cpp:346
QVariant getTileRepresentativeMarker(const TileIndex &tileIndex, const int sortKey) override
This function finds the best representative marker from a tile of markers.
Definition: gpsmarkertiler.cpp:359
GeoGroupState getGlobalGroupState() override
Definition: gpsmarkertiler.cpp:869
void prepareTiles(const GeoCoordinates &upperLeft, const GeoCoordinates &lowerRight, int level) override
Requests all images inside a given rectangle from the database.
Definition: gpsmarkertiler.cpp:166
void setRegionSelection(const GeoCoordinates::Pair &sel)
Definition: gpsmarkertiler.cpp:773
void setPositiveFilterIsActive(const bool state)
Definition: gpsmarkertiler.cpp:943
~GPSMarkerTiler() override
Destructor.
Definition: gpsmarkertiler.cpp:146
bool indicesEqual(const QVariant &a, const QVariant &b) const override
This function compares two marker indices.
Definition: gpsmarkertiler.cpp:472
Tile * tileNew() override
Definition: gpsmarkertiler.cpp:667
int getTileMarkerCount(const TileIndex &tileIndex) override
Definition: gpsmarkertiler.cpp:334
void signalModelFilteredImages(const QList< qlonglong > &imagesId)
QPixmap pixmapFromRepresentativeIndex(const QVariant &index, const QSize &size) override
This function retrieves the thumbnail for an index.
Definition: gpsmarkertiler.cpp:448
Definition: geocoordinates.h:49
QPair< GeoCoordinates, GeoCoordinates > Pair
Definition: geocoordinates.h:64
Definition: coredbchangesets.h:48
Definition: itemfiltermodel.h:125
Definition: loadingdescription.h:45
Definition: tileindex.h:45
Definition: datefolderview.cpp:43