Stellarium 0.12.3
Main Page
Namespaces
Classes
Coding Style
Scripting
Plugins
Renderer
File Structure
File List
File Members
scripting
ScreenImageMgr.hpp
1
/*
2
* Stellarium
3
* This file Copyright (C) 2008 Matthew Gates
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18
*/
19
20
#ifndef _SCREENIMAGEMGR_HPP_
21
#define _SCREENIMAGEMGR_HPP_
22
23
24
#include "StelModule.hpp"
25
#include "VecMath.hpp"
26
27
#include <QMap>
28
#include <QString>
29
#include <QStringList>
30
#include <QSize>
31
32
class
StelCore
;
33
class
QGraphicsPixmapItem;
34
class
QTimeLine;
35
class
QGraphicsItemAnimation;
36
37
// base class for different image types
38
class
ScreenImage
:
public
QObject
39
{
40
Q_OBJECT
41
42
public
:
52
ScreenImage
(
const
QString& filename,
float
x,
float
y,
bool
show=
false
,
float
scale=1.,
float
alpha=1.,
float
fadeDuration=1.);
53
virtual
~
ScreenImage
();
54
57
virtual
bool
draw
(
const
StelCore
* core);
59
virtual
void
update
(
double
deltaTime);
61
virtual
void
setFadeDuration
(
float
duration);
64
virtual
void
setFlagShow
(
bool
b);
66
virtual
bool
getFlagShow
(
void
);
69
virtual
void
setAlpha
(
float
a);
74
virtual
void
setXY
(
float
x,
float
y,
float
duration=0.);
79
virtual
void
addXY
(
float
x,
float
y,
float
duration=0.);
80
virtual
int
imageHeight(
void
);
81
virtual
int
imageWidth(
void
);
82
83
protected
:
84
QGraphicsPixmapItem* tex;
85
QTimeLine* moveTimer;
86
QTimeLine* fadeTimer;
87
QGraphicsItemAnimation* anim;
88
89
private
slots:
90
void
setOpacity(qreal alpha);
91
92
private
:
93
float
maxAlpha;
94
95
};
96
103
class
ScreenImageMgr
:
public
StelModule
104
{
105
Q_OBJECT
106
107
public
:
109
ScreenImageMgr
();
110
virtual
~
ScreenImageMgr
();
111
113
// Methods defined in the StelModule class
114
virtual
void
init
();
115
virtual
void
draw
(
StelCore
* core,
class
StelRenderer
* renderer);
117
virtual
void
update
(
double
deltaTime);
119
virtual
double
getCallOrder
(
StelModuleActionName
actionName)
const
;
120
121
public
slots:
132
void
createScreenImage
(
const
QString&
id
,
133
const
QString& filename,
134
float
x,
135
float
y,
136
float
scale=1.,
137
bool
visible=
true
,
138
float
alpha=1.,
139
float
fadeDuration=1.);
140
143
bool
getShowImage
(
const
QString&
id
);
146
int
getImageWidth
(
const
QString&
id
);
147
int
getImageHeight(
const
QString&
id
);
148
void
showImage(
const
QString&
id
,
bool
show);
152
void
setImageAlpha
(
const
QString&
id
,
float
alpha);
158
void
setImageXY
(
const
QString&
id
,
float
x,
float
y,
float
duration=0.);
161
void
deleteImage
(
const
QString&
id
);
163
void
deleteAllImages
(
void
);
165
QStringList
getAllImageIDs
(
void
);
166
167
private
:
168
QMap<QString, ScreenImage*> allScreenImages;
169
};
170
171
#endif // _SCREENIMAGEMGR_HPP_
Generated on Sat Aug 10 2013 17:12:44 for Stellarium by
1.8.3.1