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
te::qt::widgets::AnimationItem
An abstract class for Animation Item.
Definition: AnimationItem.h:65
te::qt::widgets::TrajectoryItem::m_erasePerfectly
bool m_erasePerfectly
flag to erase trajectory piece perfectly (default = false).
Definition: TrajectoryItem.h:129
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::qt::widgets::MapDisplay
A widget to control the display of a set of layers.
Definition: MapDisplay.h:72
te::qt::widgets::TrajectoryItem::draw
void draw()
Draw the trajectory long trail. It draws the beginning until the current time. The beginning depends ...
te::qt::widgets::TrajectoryItem::m_lineWidth
int m_lineWidth
The route/trail line width in pixels.
Definition: TrajectoryItem.h:128
te::qt::widgets::TrajectoryItem::m_backwardColor
QColor m_backwardColor
The backward trail color.
Definition: TrajectoryItem.h:127
TEQTWIDGETSEXPORT
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
te::qt::widgets::TrajectoryItem::m_doIconRotate
bool m_doIconRotate
do automatic icon rotate
Definition: TrajectoryItem.h:124
te::qt::widgets::TrajectoryItem::m_iconFile
QString m_iconFile
file that generated the pixmap
Definition: TrajectoryItem.h:122
te::qt::widgets::TrajectoryItem::paint
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)
Paint a piece of trajectory trail.
te::qt::widgets::TrajectoryItem
Definition: TrajectoryItem.h:58
te::qt::widgets::TrajectoryItem::~TrajectoryItem
virtual ~TrajectoryItem()
Destructor It destructs a Trajectory Icon Item.
AnimationItem.h
This file defines a class for a Animation Item.
te::qt::widgets::TrajectoryItem::drawForward
void drawForward(const unsigned int &curTime)
Draw a piece of tracktrajectory trail. It draws from the previous time to the current time.
te::qt::widgets::TrajectoryItem::drawIcon
void drawIcon(QPainter *painter)
draw tracktrajectory icon.
te::qt::widgets::TrajectoryItem::m_posOld
QPointF m_posOld
Auxiliar point.
Definition: TrajectoryItem.h:130
te::qt::widgets::TrajectoryItem::m_drawTrail
bool m_drawTrail
flag to draw trail
Definition: TrajectoryItem.h:125
te::qt::widgets::TrajectoryItem::m_layerId
QString m_layerId
trajectory layer Id
Definition: TrajectoryItem.h:131
te::qt::widgets::TrajectoryItem::m_forwardColor
QColor m_forwardColor
The forward trail color.
Definition: TrajectoryItem.h:126
te::qt::widgets::TrajectoryItem::erase
void erase(const unsigned int &curTime)
erase a piece of tracktrajectory trail.
te::qt::widgets::TrajectoryItem::m_iconSize
QSize m_iconSize
icon size
Definition: TrajectoryItem.h:123
te::qt::widgets::TrajectoryItem::transformToDisplayProjection
void transformToDisplayProjection(QVector< QPointF > &vec)
It transform coodinates to map display projection coodinates.
te::qt::widgets::TrajectoryItem::TrajectoryItem
TrajectoryItem(const QString &title, const QString &id, te::qt::widgets::MapDisplay *display, const QString &file, const QSize &size)
Constructor It constructs a Trajectory Icon Item.