libosmscout 1.1.1
Loading...
Searching...
No Matches
PlaneMapRenderer.h
Go to the documentation of this file.
1#ifndef OSMSCOUT_CLIENT_QT_PLANEMAPRENDERER_H
2#define OSMSCOUT_CLIENT_QT_PLANEMAPRENDERER_H
3
4/*
5 OSMScout - a Qt backend for libosmscout and libosmscout-map
6 Copyright (C) 2010 Tim Teulings
7 Copyright (C) 2017 Lukas Karas
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <QObject>
25#include <QSettings>
26#include <QElapsedTimer>
27#include <QTimer>
28
30
31#include <osmscoutclient/DBThread.h>
32
34
36
37namespace osmscout {
38
40 Q_OBJECT
41
42private:
43 double canvasOverrun; // scale of rendered canvas, relative to screen dimensions
45
46 mutable QMutex lastRequestMutex;
47 MapViewStruct lastRequest;
48
49 DBLoadJob *loadJob;
50
51 QElapsedTimer lastRendering;
52 QTimer pendingRenderingTimer;
53
54 QImage *currentImage;
55 size_t currentWidth;
56 size_t currentHeight;
57 osmscout::GeoCoord currentCoord;
58 double currentAngle; // radians
59 osmscout::Magnification currentMagnification;
60 size_t currentEpoch{0};
61
62 mutable QMutex finishedMutex; // mutex protecting access to finished* variables
63 // to avoid deadlock, we should not acquire global mutex when holding finishedMutex
64 // reverse order is possible
65 QImage *finishedImage;
66 size_t finishedEpoch{0};
67 osmscout::GeoCoord finishedCoord;
68 double finishedAngle;
69 osmscout::Magnification finishedMagnification;
70 osmscout::FillStyleRef finishedUnknownFillStyle;
71
77 size_t epoch{0};
78
79signals:
80 void TriggerMapRenderingSignal(const MapViewStruct& request, size_t requestEpoch);
82
83public slots:
84 virtual void Initialize();
85 virtual void InvalidateVisualCache();
86 virtual void onDatabaseLoaded(osmscout::GeoBox boundingBox);
87
88 void DrawMap();
89 void HandleTileStatusChanged(QString dbPath,const osmscout::TileRef tile);
90 void onLoadJobFinished(QMap<QString,QMap<osmscout::TileKey,osmscout::TileRef>>);
91 void TriggerMapRendering(const MapViewStruct& request, size_t requestEpoch);
94
95public:
97 SettingsRef settings,
98 DBThreadRef dbThread,
99 QString iconDirectory);
100
102
109 virtual bool RenderMap(QPainter& painter,
110 const MapViewStruct& request);
111
112private:
113 double computeScale(const osmscout::MercatorProjection &previousProjection,
114 const osmscout::MercatorProjection &currentProjection);
115};
116
117}
118
119#endif /* OSMSCOUT_CLIENT_QT_PLANEMAPRENDERER_H */
#define OSMSCOUT_CLIENT_QT_API
Definition ClientQtImportExport.h:45
Definition DBLoadJob.h:47
QThread * thread
Definition MapRenderer.h:89
MapRenderer(QThread *thread, SettingsRef settings, DBThreadRef dbThread, QString iconDirectory)
QString iconDirectory
Definition MapRenderer.h:104
SettingsRef settings
Definition MapRenderer.h:90
DBThreadRef dbThread
Definition MapRenderer.h:91
Definition MercatorProjection.h:40
virtual void onStylesheetFilenameChanged()
virtual void onDatabaseLoaded(osmscout::GeoBox boundingBox)
PlaneMapRenderer(QThread *thread, SettingsRef settings, DBThreadRef dbThread, QString iconDirectory)
void onLoadJobFinished(QMap< QString, QMap< osmscout::TileKey, osmscout::TileRef > >)
void HandleTileStatusChanged(QString dbPath, const osmscout::TileRef tile)
void TriggerMapRenderingSignal(const MapViewStruct &request, size_t requestEpoch)
virtual bool RenderMap(QPainter &painter, const MapViewStruct &request)
virtual void InvalidateVisualCache()
void TriggerMapRendering(const MapViewStruct &request, size_t requestEpoch)
std::shared_ptr< Tile > TileRef
Definition DataTileCache.h:443
Definition Area.h:39
std::shared_ptr< FillStyle > FillStyleRef
Definition Styles.h:356