libosmscout 1.1.1
Loading...
Searching...
No Matches
IconLookup.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_CLIENT_QT_ICONLOOKUP_H
2#define OSMSCOUT_CLIENT_QT_ICONLOOKUP_H
3
4/*
5 OSMScout - a Qt backend for libosmscout and libosmscout-map
6 Copyright (C) 2022 Lukas Karas
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
24
25#include <osmscoutclient/DBThread.h>
26
30
31#include <QObject>
32#include <QSettings>
33#include <QMutex>
34#include <QPoint>
35#include <QRectF>
36#include <QImage>
37
38namespace osmscout {
39
45 QRectF dimensions;
46 GeoCoord coord;
49 QString databasePath;
50 ObjectFileRef objectRef;
51 int poiId;
52 QString type;
53 QString name;
54 QString altName;
55 QString ref;
56 QString operatorName;
57 QString phone;
58 QString website;
59 QString openingHours;
60 QImage image;
61};
62
66class OSMSCOUT_CLIENT_QT_API IconLookup : public QObject {
67 Q_OBJECT
68private:
69 static constexpr int iconImageUpscale=3;
70 static constexpr double tapSize=4;
71 QThread *thread;
72 DBThreadRef dbThread;
73 DBLoadJob *loadJob;
75 std::map<int,OverlayObjectRef> overlayObjects;
76 MapParameter drawParameter;
77 QPoint lookupCoord;
78 std::vector<MapIcon> findIcons;
79
80public slots:
81 void onIconRequest(const MapViewStruct &view,
82 const QPoint &coord,
83 const std::map<int,OverlayObjectRef> &overlayObjects);
84 void onDatabaseLoaded(QString dbPath,QList<osmscout::TileRef> tiles);
85 void onLoadJobFinished(QMap<QString,QMap<osmscout::TileKey,osmscout::TileRef>> tiles);
86
87public:
88signals:
89 void iconRequested(const MapViewStruct &view,
90 const QPoint &coord,
91 const std::map<int,OverlayObjectRef> &overlayObjects);
92
93 void iconFound(QPoint lookupCoord, MapIcon icon);
94 void iconNotFound(QPoint lookupCoord);
95
96public:
97 IconLookup(QThread *thread, DBThreadRef dbThread, QString iconDirectory);
98 ~IconLookup() override;
99
100 void RequestIcon(const MapViewStruct &view,
101 const QPoint &coord,
102 const std::map<int,OverlayObjectRef> &overlayObjects);
103
104private:
105 void lookupIcons(const QString &databasePath,
106 osmscout::MapData &data,
107 const TypeConfigRef &typeConfig,
108 const StyleConfigRef &styleConfig);
109};
110
114using IconLookupRef = std::shared_ptr<IconLookup> ;
115
116}
117#endif //OSMSCOUT_CLIENT_QT_ICONLOOKUP_H
#define OSMSCOUT_CLIENT_QT_API
Definition ClientQtImportExport.h:45
Definition DBLoadJob.h:47
void iconRequested(const MapViewStruct &view, const QPoint &coord, const std::map< int, OverlayObjectRef > &overlayObjects)
void onDatabaseLoaded(QString dbPath, QList< osmscout::TileRef > tiles)
IconLookup(QThread *thread, DBThreadRef dbThread, QString iconDirectory)
void RequestIcon(const MapViewStruct &view, const QPoint &coord, const std::map< int, OverlayObjectRef > &overlayObjects)
void iconFound(QPoint lookupCoord, MapIcon icon)
void iconNotFound(QPoint lookupCoord)
~IconLookup() override
void onIconRequest(const MapViewStruct &view, const QPoint &coord, const std::map< int, OverlayObjectRef > &overlayObjects)
void onLoadJobFinished(QMap< QString, QMap< osmscout::TileKey, osmscout::TileRef > > tiles)
Definition MercatorProjection.h:40
std::shared_ptr< IconLookup > IconLookupRef
Definition IconLookup.h:114
std::shared_ptr< TypeConfig > TypeConfigRef
Definition TypeConfig.h:1396
Definition Area.h:39
std::shared_ptr< StyleConfig > StyleConfigRef
Definition StyleConfig.h:859
std::shared_ptr< IconStyle > IconStyleRef
Definition Styles.h:987
Definition IconLookup.h:43
QString website
Definition IconLookup.h:58
QString ref
Definition IconLookup.h:55
GeoCoord coord
Definition IconLookup.h:46
double distanceSquare
Definition IconLookup.h:47
QRectF dimensions
Definition IconLookup.h:45
QString operatorName
Definition IconLookup.h:56
IconStyleRef iconStyle
Definition IconLookup.h:48
QString phone
Definition IconLookup.h:57
QString name
Definition IconLookup.h:53
ObjectFileRef objectRef
Definition IconLookup.h:50
QString altName
Definition IconLookup.h:54
QString databasePath
Definition IconLookup.h:49
int poiId
Definition IconLookup.h:51
QString type
Definition IconLookup.h:52
QString openingHours
Definition IconLookup.h:59
QImage image
Definition IconLookup.h:60
QPoint screenCoord
Definition IconLookup.h:44