All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 #include "../../../geometry.h"
32 #include "../../../datatype.h"
33 // Qt
34 #include <QGraphicsPixmapItem>
35 #include <QAbstractAnimation>
36 
37 namespace te
38 {
39  namespace dt
40  {
41  class DateTimeInstant;
42  class TimePeriod;
43  }
44 
45  namespace qt
46  {
47  namespace widgets
48  {
49  class MapDisplay;
50  class Animation;
51 
52  /*!
53  \class AnimationItem
54 
55  \brief This class is a dialog for the Pixmap Item.
56  */
57  class TEQTWIDGETSEXPORT AnimationItem : public QObject, public QGraphicsPixmapItem
58  {
59  Q_OBJECT
60  Q_PROPERTY(QPointF pos READ pos WRITE setPos)
61 
62  public:
63 
64  /*!
65  \brief Constructor
66  It constructs a Animation Item.
67  \param title The Animation Item title.
68  \param display Where the Animation Item is displayed.
69  */
70  AnimationItem(const QString& title, te::qt::widgets::MapDisplay* display);
71 
72  /*!
73  \brief Destructor
74  It destructs a Animation Item.
75  */
76  virtual ~AnimationItem();
77 
78  /*!
79  \brief It sets the internal matrix.
80  */
81  void setMatrix();
82 
83  /*!
84  \brief It returns the Animation Item position in device coordinate.
85  \return Position in device coordinate.
86  */
87  QPoint getPosInDeviceCoordinate();
88 
89  /*!
90  \brief Paint a Animation Item.
91  */
92  virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) = 0;
93 
94  /*!
95  \brief Sets the Animation Item duration.
96  \param duration The Animation Item duration.
97  */
98  void setDuration(const unsigned int& duration);
99 
100  /*!
101  \brief Gets the Animation Item duration.
102  \return The Animation Item duration.
103  */
104  unsigned int getDuration();
105 
106  /*!
107  \brief Sets the Animation Item direction.
108  \param direction The Animation Item direction.
109  */
110  void setDirection(const QAbstractAnimation::Direction& direction);
111 
112  /*!
113  \brief Gets the Animation Item direction.
114  \return The Animation Item direction.
115  */
116  QAbstractAnimation::Direction getDirection();
117 
118  /*!
119  \brief If draw item.
120  */
121  virtual void draw() = 0;
122 
123  /*!
124  \brief Create Animation Item making reprojection if necessary.
125  */
126  virtual void createAnimationDataInDisplayProjection();
127 
128  /*!
129  \brief It draws a piece of tracktrajectory trail or draws the current pixmap item.
130 
131  \paran curTime The Animation Item current time.
132  */
133  virtual void drawForward(const unsigned int& curTime) = 0;
134 
135  /*!
136  \brief It erases a piece of tracktrajectory trail or draws the current pixmap item.
137 
138  \paran curTime The Animation Item current time.
139  */
140  virtual void erase(const unsigned int& curTime) = 0;
141 
142  public:
143  QString m_title; //!< The icon item title.
144  te::qt::widgets::MapDisplay* m_display; //!< Indicates where the icon item is displayed.
145  int m_SRID; //!< The input route srid.
146  QPointF m_pos; //!< The icon position.
147  QVector<te::dt::TimeInstant> m_time; //!< The input time.
148  QVector<te::dt::TimeInstant> m_animationTime; //!< The animation time. It contains only the portions to be animated.
149  te::gm::LineString* m_route; //!< The input path in world coordenates.
150  QVector<QPointF> m_animationRoute; //!< The path coordenates in map display projection. It contains only the portions to be animated.
151  QMatrix m_matrix; //!< The display transformation matrix.
152  bool m_automaticPan; //!< True if automatic pan over this item.
153  double m_panFactor; //!< the range is between 0.05 and 0.5
154  unsigned int m_curTimeDuration; //!< Current time (ms). Its value is between 0 and the total duration.
155  double m_norInitialTime; //!< Normalized initial time (between 0 and 1).
156  double m_norFinalTime; //!< Normalized final time (between 0 and 1).
157  Animation* m_animation; //!< The animation this item.
158  unsigned int m_duration; //!< The duration this item.
159  QAbstractAnimation::Direction m_direction; //!< The direction
160  int m_opacity; //!< Opacity.
161  };
162  } // end namespace widgets
163  } // end namespace qt
164 } // end namespace te
165 
166 #endif // __TERRALIB_QT_WIDGETS_SLIDER_INTERNAL_ANIMATION_ITEM_H
QPointF m_pos
The icon position.
double m_norInitialTime
Normalized initial time (between 0 and 1).
bool m_automaticPan
True if automatic pan over this item.
A widget to control the display of a set of layers.
Definition: MapDisplay.h:66
te::qt::widgets::MapDisplay * m_display
Indicates where the icon item is displayed.
Animation * m_animation
The animation this item.
double m_norFinalTime
Normalized final time (between 0 and 1).
LineString is a curve with linear interpolation between points.
Definition: LineString.h:62
QAbstractAnimation::Direction m_direction
The direction.
unsigned int m_curTimeDuration
Current time (ms). Its value is between 0 and the total duration.
QString m_title
The icon item title.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:66
This class is a dialog for the Pixmap Item.
Definition: AnimationItem.h:57
QVector< te::dt::TimeInstant > m_animationTime
The animation time. It contains only the portions to be animated.
double m_panFactor
the range is between 0.05 and 0.5
te::gm::LineString * m_route
The input path in world coordenates.
QMatrix m_matrix
The display transformation matrix.
QVector< QPointF > m_animationRoute
The path coordenates in map display projection. It contains only the portions to be animated...
int m_SRID
The input route srid.
unsigned int m_duration
The duration this item.
QVector< te::dt::TimeInstant > m_time
The input time.