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 connectionChanged);
16 Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged);
17 Q_PROPERTY(QGeoRectangle mapRectangle READ mapRectangle WRITE setMapRectangle NOTIFY mapRectangleChanged)
18 Q_OBJECT
19 public:
20 ImagesMapView(QQuickItem* _parent = nullptr);
21
22 kDBQuick::Connection* connection() const { return m_connection; }
23 void setConnection(kDBQuick::Connection* _connection)
24 {
25 m_connection = _connection;
26 emit(connectionChanged());
27 loadImages();
28 }
29 void setMapRectangle(const QGeoRectangle &shape)
30 {
31 m_mapRectangle = shape;
32 emit(mapRectangleChanged());
33 loadImages();
34 }
35 QGeoRectangle mapRectangle() const { return m_mapRectangle; }
36 QString source() const { return m_source; }
37 void setSource(const QString& _source)
38 {
39 m_source = _source;
40 emit(sourceChanged());
41 loadImages();
42 }
43 private:
44 void loadImages();
45 signals:
46 void mapRectangleChanged();
47 void connectionChanged();
48 void sourceChanged();
49 private:
50 QGeoRectangle m_mapRectangle;
51 QMutex m_imageCacheMutex;
52 struct ImageInfo {
53 QImage image;
54 };
55 QHash<QString, ImageInfo> m_imageCache;
56 kDBQuick::Connection* m_connection = nullptr;
57 QThreadPool m_pool;
58 QString m_source;
59 };
60}
Definition Forward.h:10
Definition ImagesMapView.h:14
Definition Connection.h:12