HotPointGraphicsItem.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/process/qt/HotPointGraphicsItem.h
22 
23  \brief A GraphicItem to represents Task parameters as hot point.
24 */
25 
26 #ifndef __TERRALIB_PROCESS_QT_INTERNAL_HOTPOINTGRAPHICSITEM_H
27 #define __TERRALIB_PROCESS_QT_INTERNAL_HOTPOINTGRAPHICSITEM_H
28 
29 #include "../../Config.h"
30 
31 // Qt Includes
32 #include <QColor>
33 #include <QGraphicsObject>
34 #include <QPointF>
35 
36 namespace te
37 {
38  namespace process
39  {
40  namespace qt
41  {
42  /*!
43  \class HotPointGraphicsItem
44 
45  \brief A GraphicItem to represents Task parameters as hot point.
46 
47  */
48  class TEPROCESSEXPORT HotPointGraphicsItem : public QGraphicsObject
49  {
50  public:
51 
52  /*! \brief Default constructor. */
53  HotPointGraphicsItem(const QPointF& position, const std::size_t& index, const std::string& taskId);
54 
55  /*! \brief Virtual destructor. */
57 
58  public:
59 
60  /*!
61  \brief Function used to get the position of this hotpoint
62 
63  \return A hotpoint position inside the TaskGraphicsItem.
64  */
65  QPointF getHotPointPos();
66 
67  /*!
68  \brief Virtual function that defines the outer bounds of the item as a rectangle.
69 
70  \return QRectF for this item.
71  */
72  virtual QRectF boundingRect() const;
73 
74  /*!
75  \brief Function used to draw the process item.
76 
77  \param painter Qt Painter used to draw the process item.
78 
79  \param option Qt style options used to draw the process item.
80  */
81  virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr);
82 
83  /*!
84  \brief Function used to define the color used to draw the hotpoint.
85 
86  \param color Qt color value.
87  */
88  void setHotPointColor(QColor color);
89 
90  /*!
91  \brief Function used to get the param index from task associated to this hotpoint
92 
93  \return The m_index attribute value
94  */
95  std::size_t getHotPointIndex() const;
96 
97  protected:
98 
99  QPointF m_pos; //!< Position that represents this hot point.
100 
101  std::size_t m_index; //!< Parameter index from task.
102 
103  std::string m_taskId; //!< Task id for this hot point parameter.
104 
105  QColor m_color; //!< Color used to draw this hotpoint.
106  };
107  }
108  }
109 }
110 
111 #endif // __TERRALIB_PROCESS_QT_INTERNAL_HOTPOINTGRAPHICSITEM_H
A GraphicItem to represents Task parameters as hot point.
virtual QRectF boundingRect() const
Virtual function that defines the outer bounds of the item as a rectangle.
HotPointGraphicsItem(const QPointF &position, const std::size_t &index, const std::string &taskId)
Default constructor.
std::size_t m_index
Parameter index from task.
QPointF m_pos
Position that represents this hot point.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr)
Function used to draw the process item.
QColor m_color
Color used to draw this hotpoint.
void setHotPointColor(QColor color)
Function used to define the color used to draw the hotpoint.
std::string m_taskId
Task id for this hot point parameter.
QPointF getHotPointPos()
Function used to get the position of this hotpoint.
std::size_t getHotPointIndex() const
Function used to get the param index from task associated to this hotpoint.
~HotPointGraphicsItem()
Virtual destructor.
TerraLib.
#define TEPROCESSEXPORT
Definition: Config.h:47