TrajectoryItem.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/TrajectoryItem.h
22 
23  \brief This file defines a class for a Trajectory Item.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_SLIDER_INTERNAL_TRAJECTORY_ITEM_H
27 #define __TERRALIB_QT_WIDGETS_SLIDER_INTERNAL_TRAJECTORY_ITEM_H
28 
29 // TerraLib
30 #include "AnimationItem.h"
31 #include "../Config.h"
32 #include "../../../geometry.h"
33 #include "../../../datatype.h"
34 
35 // Qt
36 #include <QtCore/QAbstractAnimation>
37 #include <QtCore/QVector>
38 
39 namespace te
40 {
41  namespace dt
42  {
43  class DateTimeInstant;
44  class TimePeriod;
45  }
46 
47  namespace qt
48  {
49  namespace widgets
50  {
51  class MapDisplay;
52  class Animation;
53 
54  /*!
55  \class This class lets to make trajectory animation on the map display.
56  */
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 Trajectory Icon Item.
67  \param title The icon item title.
68  \param id The trajectory layer id.
69  \param display Where the icon item is displayed.
70  \param file The icon file.
71  \param size icon size.
72  */
73  TrajectoryItem(const QString& title, const QString& id, te::qt::widgets::MapDisplay* display, const QString& file, const QSize& size);
74 
75  /*!
76  \brief Destructor
77  It destructs a Trajectory Icon Item.
78  */
79  virtual ~TrajectoryItem();
80 
81  /*!
82  \brief Paint a piece of trajectory trail.
83  */
84  void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*);
85 
86  /*!
87  \brief It transform coodinates to map display projection coodinates.
88  \param vec Coordinates in native projection.
89  */
90  void transformToDisplayProjection(QVector<QPointF>& vec);
91 
92  /*!
93  \brief Draw the trajectory long trail.
94  It draws the beginning until the current time.
95  The beginning depends on the direction (forward or backward).
96  */
97  void draw();
98 
99  /*!
100  \brief Draw a piece of tracktrajectory trail.
101  It draws from the previous time to the current time.
102 
103  \paran curTime The trajectory current time.
104  */
105  void drawForward(const unsigned int& curTime);
106 
107  /*!
108  \brief erase a piece of tracktrajectory trail.
109 
110  \paran curTime The trajectory current time.
111  */
112  void erase(const unsigned int& curTime);
113 
114  /*!
115  \brief draw tracktrajectory icon.
116 
117  \paran painter Painter.
118  */
119  void drawIcon(QPainter* painter);
120 
121  public:
122  QString m_iconFile; //!< file that generated the pixmap
123  QSize m_iconSize; //!< icon size
124  bool m_doIconRotate; //!< do automatic icon rotate
125  bool m_drawTrail; //!< flag to draw trail
126  QColor m_forwardColor; //!< The forward trail color.
127  QColor m_backwardColor; //!< The backward trail color.
128  int m_lineWidth; //!< The route/trail line width in pixels.
129  bool m_erasePerfectly; //!< flag to erase trajectory piece perfectly (default = false).
130  QPointF m_posOld; //!< Auxiliar point
131  QString m_layerId; //!< trajectory layer Id
132  };
133  } // end namespace widgets
134  } // end namespace qt
135 } // end namespace te
136 
137 #endif // __TERRALIB_QT_WIDGETS_SLIDER_INTERNAL_TRAJECTORY_ITEM_H
bool m_doIconRotate
do automatic icon rotate
A widget to control the display of a set of layers.
Definition: MapDisplay.h:69
QString m_iconFile
file that generated the pixmap
QColor m_backwardColor
The backward trail color.
This file defines a class for a Animation Item.
URI C++ Library.
QColor m_forwardColor
The forward trail color.
int m_lineWidth
The route/trail line width in pixels.
bool m_erasePerfectly
flag to erase trajectory piece perfectly (default = false).
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
An abstract class for Animation Item.
Definition: AnimationItem.h:64
QString m_layerId
trajectory layer Id
QPointF m_posOld
Auxiliar point.
bool m_drawTrail
flag to draw trail