libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout-client-qt
include
osmscoutclientqt
MapOverlay.h
Go to the documentation of this file.
1
#ifndef OSMSCOUT_CLIENT_QT_MAPOVERLAY_H
2
#define OSMSCOUT_CLIENT_QT_MAPOVERLAY_H
3
4
/*
5
OSMScout - a Qt backend for libosmscout and libosmscout-map
6
Copyright (C) 2017 Lukáš 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
23
#include <
osmscoutclientqt/InputHandler.h
>
24
25
#include <
osmscoutclientqt/ClientQtImportExport.h
>
26
27
#include <QQuickPaintedItem>
28
29
namespace
osmscout
{
30
34
class
OSMSCOUT_CLIENT_QT_API
MapOverlay
:
public
QQuickPaintedItem
35
{
36
Q_OBJECT
37
Q_PROPERTY(QObject *
view
READ
GetView
WRITE
SetMapView
)
38
39
protected
:
40
MapView
*
view
;
41
42
public
slots:
43
void
changeView
(
const
MapView
&
view
);
44
void
redraw
();
45
46
public
:
47
MapOverlay
(QQuickItem* parent = 0);
48
virtual
~MapOverlay
();
49
50
inline
void
SetMapView
(QObject *o)
51
{
52
MapView
*updated =
dynamic_cast<
MapView
*
>
(o);
53
if
(updated ==
nullptr
){
54
qWarning() <<
"Failed to cast "
<< o <<
" to MapView*."
;
55
return
;
56
}
57
58
bool
changed = *
view
!= *updated;
59
if
(changed){
60
changeView
(*updated);
61
}
62
}
63
64
inline
MapView
*
GetView
()
const
65
{
66
return
view
;
// We should be owner, parent is set http://doc.qt.io/qt-5/qqmlengine.html#objectOwnership
67
}
68
};
69
70
}
71
72
#endif
// OSMSCOUT_CLIENT_QT_MAPOVERLAY_H
ClientQtImportExport.h
OSMSCOUT_CLIENT_QT_API
#define OSMSCOUT_CLIENT_QT_API
Definition
ClientQtImportExport.h:45
InputHandler.h
osmscout::MapOverlay::GetView
MapView * GetView() const
Definition
MapOverlay.h:64
osmscout::MapOverlay::changeView
void changeView(const MapView &view)
osmscout::MapOverlay::SetMapView
void SetMapView(QObject *o)
Definition
MapOverlay.h:50
osmscout::MapOverlay::MapOverlay
MapOverlay(QQuickItem *parent=0)
osmscout::MapOverlay::~MapOverlay
virtual ~MapOverlay()
osmscout::MapOverlay::redraw
void redraw()
osmscout::MapOverlay::view
QObject * view
Definition
MapOverlay.h:37
osmscout::MapView
Definition
InputHandler.h:161
osmscout
Definition
Area.h:39
Generated by
1.17.0