libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout-client-qt
include
osmscoutclientqt
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
29
#include <
osmscoutmap/DataTileCache.h
>
30
31
#include <osmscoutclient/DBThread.h>
32
33
#include <
osmscoutclientqt/MapRenderer.h
>
34
35
#include <
osmscoutclientqt/ClientQtImportExport.h
>
36
37
namespace
osmscout
{
38
39
class
OSMSCOUT_CLIENT_QT_API
PlaneMapRenderer
:
public
MapRenderer
{
40
Q_OBJECT
41
42
private
:
43
double
canvasOverrun;
// scale of rendered canvas, relative to screen dimensions
44
osmscout::MercatorProjection
projection;
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
79
signals:
80
void
TriggerMapRenderingSignal
(
const
MapViewStruct& request,
size_t
requestEpoch);
81
void
TriggerInitialRendering
();
82
83
public
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);
92
void
HandleInitialRenderingRequest
();
93
virtual
void
onStylesheetFilenameChanged
();
94
95
public
:
96
PlaneMapRenderer
(QThread *
thread
,
97
SettingsRef
settings
,
98
DBThreadRef
dbThread
,
99
QString
iconDirectory
);
100
101
virtual
~PlaneMapRenderer
();
102
109
virtual
bool
RenderMap
(QPainter& painter,
110
const
MapViewStruct& request);
111
112
private
:
113
double
computeScale(
const
osmscout::MercatorProjection
&previousProjection,
114
const
osmscout::MercatorProjection
¤tProjection);
115
};
116
117
}
118
119
#endif
/* OSMSCOUT_CLIENT_QT_PLANEMAPRENDERER_H */
ClientQtImportExport.h
OSMSCOUT_CLIENT_QT_API
#define OSMSCOUT_CLIENT_QT_API
Definition
ClientQtImportExport.h:45
DataTileCache.h
MapRenderer.h
osmscout::DBLoadJob
Definition
DBLoadJob.h:47
osmscout::MapRenderer::thread
QThread * thread
Definition
MapRenderer.h:89
osmscout::MapRenderer::MapRenderer
MapRenderer(QThread *thread, SettingsRef settings, DBThreadRef dbThread, QString iconDirectory)
osmscout::MapRenderer::iconDirectory
QString iconDirectory
Definition
MapRenderer.h:104
osmscout::MapRenderer::settings
SettingsRef settings
Definition
MapRenderer.h:90
osmscout::MapRenderer::dbThread
DBThreadRef dbThread
Definition
MapRenderer.h:91
osmscout::MercatorProjection
Definition
MercatorProjection.h:40
osmscout::PlaneMapRenderer::onStylesheetFilenameChanged
virtual void onStylesheetFilenameChanged()
osmscout::PlaneMapRenderer::onDatabaseLoaded
virtual void onDatabaseLoaded(osmscout::GeoBox boundingBox)
osmscout::PlaneMapRenderer::PlaneMapRenderer
PlaneMapRenderer(QThread *thread, SettingsRef settings, DBThreadRef dbThread, QString iconDirectory)
osmscout::PlaneMapRenderer::onLoadJobFinished
void onLoadJobFinished(QMap< QString, QMap< osmscout::TileKey, osmscout::TileRef > >)
osmscout::PlaneMapRenderer::Initialize
virtual void Initialize()
osmscout::PlaneMapRenderer::HandleInitialRenderingRequest
void HandleInitialRenderingRequest()
osmscout::PlaneMapRenderer::TriggerInitialRendering
void TriggerInitialRendering()
osmscout::PlaneMapRenderer::HandleTileStatusChanged
void HandleTileStatusChanged(QString dbPath, const osmscout::TileRef tile)
osmscout::PlaneMapRenderer::DrawMap
void DrawMap()
osmscout::PlaneMapRenderer::TriggerMapRenderingSignal
void TriggerMapRenderingSignal(const MapViewStruct &request, size_t requestEpoch)
osmscout::PlaneMapRenderer::RenderMap
virtual bool RenderMap(QPainter &painter, const MapViewStruct &request)
osmscout::PlaneMapRenderer::InvalidateVisualCache
virtual void InvalidateVisualCache()
osmscout::PlaneMapRenderer::TriggerMapRendering
void TriggerMapRendering(const MapViewStruct &request, size_t requestEpoch)
osmscout::PlaneMapRenderer::~PlaneMapRenderer
virtual ~PlaneMapRenderer()
osmscout::TileRef
std::shared_ptr< Tile > TileRef
Definition
DataTileCache.h:443
osmscout
Definition
Area.h:39
osmscout::FillStyleRef
std::shared_ptr< FillStyle > FillStyleRef
Definition
Styles.h:356
Generated by
1.17.0