kDB: Knowledge DataBase
Loading...
Searching...
No Matches
ImagesMapView.h
1#pragma once
2
3#include <QGeoRectangle>
4#include <QImage>
5#include <QMutex>
6#include <QQuickItem>
7#include <QThreadPool>
8
9#include <kDBQuick/Forward.h>
10
11namespace kDBGISQuick
12{
13 class ImagesMapView : public QQuickItem
14 {
15 Q_PROPERTY(kDBQuick::Connection* connection READ connection WRITE setConnection NOTIFY
16 connectionChanged);
17 Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged);
18 Q_PROPERTY(
19 QGeoRectangle mapRectangle READ mapRectangle WRITE setMapRectangle NOTIFY mapRectangleChanged)
20 Q_OBJECT
21 public:
22 ImagesMapView(QQuickItem* _parent = nullptr);
23
24 kDBQuick::Connection* connection() const { return m_connection; }
25 void setConnection(kDBQuick::Connection* _connection)
26 {
27 m_connection = _connection;
28 emit(connectionChanged());
29 loadImages();
30 }
31 void setMapRectangle(const QGeoRectangle& shape)
32 {
33 m_mapRectangle = shape;
34 emit(mapRectangleChanged());
35 loadImages();
36 }
37 QGeoRectangle mapRectangle() const { return m_mapRectangle; }
38 QString source() const { return m_source; }
39 void setSource(const QString& _source)
40 {
41 m_source = _source;
42 emit(sourceChanged());
43 loadImages();
44 }
45 private:
46 void loadImages();
47 signals:
48 void mapRectangleChanged();
49 void connectionChanged();
50 void sourceChanged();
51 private:
52 QGeoRectangle m_mapRectangle;
53 QMutex m_imageCacheMutex;
54 struct ImageInfo
55 {
56 QImage image;
57 };
58 QHash<QString, ImageInfo> m_imageCache;
59 kDBQuick::Connection* m_connection = nullptr;
60 QThreadPool m_pool;
61 QString m_source;
62 };
63} // namespace kDBGISQuick
Definition Forward.h:10
Definition ImagesMapView.h:14
Definition Connection.h:14