Loading...
Searching...
No Matches
AnimationItem.h
Go to the documentation of this file.
1/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 TerraLib 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 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19
20/*!
21 \file terralib/qt/widgets/st/AnimationItem.h
22
23 \brief This file defines a class for a Animation Item.
24*/
25
26#ifndef __TERRALIB_QT_WIDGETS_SLIDER_INTERNAL_ANIMATION_ITEM_H
27#define __TERRALIB_QT_WIDGETS_SLIDER_INTERNAL_ANIMATION_ITEM_H
28
29// TerraLib
30#include "../Config.h"
31#ifndef Q_MOC_RUN
32#include "../../../geometry.h"
33#include "../../../datatype.h"
34#endif
35
36// Qt
37#include <QGraphicsPixmapItem>
38#include <QAbstractAnimation>
39
40namespace te
41{
42 namespace dt
43 {
44 class DateTimeInstant;
45 class TimePeriod;
46 }
47
48 namespace qt
49 {
50 namespace widgets
51 {
52 class MapDisplay;
53 class Animation;
54
55 /*!
56 \class AnimationItem
57
58 \brief An abstract class for Animation Item.
59
60 It is the base class that stores data of time and route.
61
62 \sa ImageItem, TrajectoryItem
63 */
64 class TEQTWIDGETSEXPORT AnimationItem : public QObject, public QGraphicsPixmapItem
65 {
66 Q_OBJECT
67 Q_PROPERTY(QPointF pos READ pos WRITE setPos)
68
69 public:
70
71 /*!
72 \brief Constructor
73 It constructs a Animation Item.
74 \param title The Animation Item title.
75 \param display Where the Animation Item is displayed.
76 */
77 AnimationItem(const QString& title, te::qt::widgets::MapDisplay* display);
78
79 /*!
80 \brief Destructor
81 It destructs a Animation Item.
82 */
83 virtual ~AnimationItem();
84
85 /*!
86 \brief It returns the Animation Item position in device coordinate.
87 \return Position in device coordinate.
88 */
90
91 /*!
92 \brief Paint a Animation Item.
93 */
94 virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) = 0;
95
96 /*!
97 \brief Sets the Animation Item duration.
98 \param duration The Animation Item duration.
99 */
100 void setDuration(const unsigned int& duration);
101
102 /*!
103 \brief Gets the Animation Item duration.
104 \return The Animation Item duration.
105 */
106 unsigned int getDuration();
107
108 /*!
109 \brief Sets the Animation Item direction.
110 \param direction The Animation Item direction.
111 */
112 void setDirection(const QAbstractAnimation::Direction& direction);
113
114 /*!
115 \brief Gets the Animation Item direction.
116 \return The Animation Item direction.
117 */
118 QAbstractAnimation::Direction getDirection();
119
120 /*!
121 \brief If draw item.
122 */
123 virtual void draw() = 0;
124
125 /*!
126 \brief Adjust data for a given time animation period.
127 */
129
130 /*!
131 \brief It draws a piece of tracktrajectory trail or draws the current pixmap item.
132
133 \paran curTime The Animation Item current time.
134 */
135 virtual void drawForward(const unsigned int& curTime) = 0;
136
137 /*!
138 \brief It erases a piece of tracktrajectory trail or draws the current pixmap item.
139
140 \paran curTime The Animation Item current time.
141 */
142 virtual void erase(const unsigned int& curTime) = 0;
143
144 public:
145 QString m_title; //!< The icon item title.
146 te::qt::widgets::MapDisplay* m_display; //!< Indicates where the icon item is displayed.
147 int m_SRID; //!< The input route srid.
148 QPointF m_pos; //!< The icon position.
149 QVector<te::dt::TimeInstant> m_time; //!< The input time.
150 QVector<te::dt::TimeInstant> m_animationTime; //!< The animation time. It contains only the portions to be animated.
151 te::gm::LineString* m_route; //!< The input path in world coordenates.
152 QVector<QPointF> m_animationRoute; //!< It contains only the portions to be animated.
153 QMatrix m_matrix; //!< The display transformation matrix.
154 bool m_automaticPan; //!< True if automatic pan over this item.
155 double m_panFactor; //!< the range is between 0.002 and 0.5
156 unsigned int m_curTimeDuration; //!< Current time (ms). Its value is between 0 and the total duration.
157 double m_norInitialTime; //!< Normalized initial time (between 0 and 1).
158 double m_norFinalTime; //!< Normalized final time (between 0 and 1).
159 Animation* m_animation; //!< The animation this item.
160 unsigned int m_duration; //!< The duration this item.
161 QAbstractAnimation::Direction m_direction; //!< The direction
162 int m_opacity; //!< Opacity.
163 };
164 } // end namespace widgets
165 } // end namespace qt
166} // end namespace te
167
168#endif // __TERRALIB_QT_WIDGETS_SLIDER_INTERNAL_ANIMATION_ITEM_H
LineString is a curve with linear interpolation between points.
Definition: LineString.h:65
An abstract class for Animation Item.
Definition: AnimationItem.h:65
AnimationItem(const QString &title, te::qt::widgets::MapDisplay *display)
Constructor It constructs a Animation Item.
virtual void erase(const unsigned int &curTime)=0
It erases a piece of tracktrajectory trail or draws the current pixmap item.
unsigned int m_curTimeDuration
Current time (ms). Its value is between 0 and the total duration.
double m_norInitialTime
Normalized initial time (between 0 and 1).
QString m_title
The icon item title.
te::qt::widgets::MapDisplay * m_display
Indicates where the icon item is displayed.
virtual void drawForward(const unsigned int &curTime)=0
It draws a piece of tracktrajectory trail or draws the current pixmap item.
double m_panFactor
the range is between 0.002 and 0.5
QVector< QPointF > m_animationRoute
It contains only the portions to be animated.
int m_SRID
The input route srid.
te::gm::LineString * m_route
The input path in world coordenates.
void setDuration(const unsigned int &duration)
Sets the Animation Item duration.
virtual ~AnimationItem()
Destructor It destructs a Animation Item.
double m_norFinalTime
Normalized final time (between 0 and 1).
virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)=0
Paint a Animation Item.
unsigned int getDuration()
Gets the Animation Item duration.
bool m_automaticPan
True if automatic pan over this item.
QPoint getPosInDeviceCoordinate()
It returns the Animation Item position in device coordinate.
QAbstractAnimation::Direction m_direction
The direction.
QVector< te::dt::TimeInstant > m_animationTime
The animation time. It contains only the portions to be animated.
void setDirection(const QAbstractAnimation::Direction &direction)
Sets the Animation Item direction.
Animation * m_animation
The animation this item.
QAbstractAnimation::Direction getDirection()
Gets the Animation Item direction.
QPointF m_pos
The icon position.
QMatrix m_matrix
The display transformation matrix.
QVector< te::dt::TimeInstant > m_time
The input time.
virtual void adjustDataToAnimationTemporalExtent()
Adjust data for a given time animation period.
virtual void draw()=0
If draw item.
unsigned int m_duration
The duration this item.
A widget to control the display of a set of layers.
Definition: MapDisplay.h:72
TerraLib.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63