libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout-client-qt
include
osmscoutclientqt
IconAnimation.h
Go to the documentation of this file.
1
#ifndef OSMSCOUT_CLIENT_QT_ICONANIMATION_H
2
#define OSMSCOUT_CLIENT_QT_ICONANIMATION_H
3
4
/*
5
OSMScout - a Qt backend for libosmscout and libosmscout-map
6
Copyright (C) 2022 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/ClientQtImportExport.h
>
24
25
#include <
osmscout/projection/Projection.h
>
26
27
#include <
osmscoutclientqt/IconLookup.h
>
28
29
#include <QObject>
30
#include <QTimer>
31
#include <QPainter>
32
#include <QElapsedTimer>
33
34
namespace
osmscout
{
35
36
class
OSMSCOUT_CLIENT_QT_API
IconAnimation
:
public
QObject
37
{
38
Q_OBJECT
39
private
:
40
static
constexpr
int
animationDuration = 200;
41
QTimer timer;
42
43
enum class
State {
44
FadeIn,
45
Full,
46
FadeOut
47
};
48
49
struct
Animation {
50
MapIcon
icon;
51
double
size;
52
double
startSize;
53
State state;
54
QElapsedTimer duration;
55
56
double
MaxSize()
const
57
{
58
return
icon.
image
.width();
59
}
60
61
double
MinSize()
const
62
{
63
return
icon.
dimensions
.width();
64
}
65
};
66
67
std::vector<Animation> icons;
68
69
public
slots:
70
void
tick
();
71
72
signals:
73
void
update
();
74
75
public
:
76
IconAnimation
();
77
~IconAnimation
()
override
=
default
;
78
79
void
activate
(
const
MapIcon
&icon);
80
void
deactivateAll
();
81
void
paint
(QPainter *painter,
const
MercatorProjection
&projection);
82
};
83
84
}
85
86
#endif
// OSMSCOUT_CLIENT_QT_ICONANIMATION_H
ClientQtImportExport.h
OSMSCOUT_CLIENT_QT_API
#define OSMSCOUT_CLIENT_QT_API
Definition
ClientQtImportExport.h:45
IconLookup.h
Projection.h
osmscout::IconAnimation::update
void update()
osmscout::IconAnimation::deactivateAll
void deactivateAll()
osmscout::IconAnimation::activate
void activate(const MapIcon &icon)
osmscout::IconAnimation::IconAnimation
IconAnimation()
osmscout::IconAnimation::paint
void paint(QPainter *painter, const MercatorProjection &projection)
osmscout::IconAnimation::~IconAnimation
~IconAnimation() override=default
osmscout::IconAnimation::tick
void tick()
osmscout::MercatorProjection
Definition
MercatorProjection.h:40
osmscout
Definition
Area.h:39
osmscout::MapIcon
Definition
IconLookup.h:43
osmscout::MapIcon::dimensions
QRectF dimensions
Definition
IconLookup.h:45
osmscout::MapIcon::image
QImage image
Definition
IconLookup.h:60
Generated by
1.17.0