TaskGraphicsItem.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/TaskGraphicsItem.h
22 
23  \brief A GraphicItem to represents a Task Process Builder item.
24 */
25 
26 #ifndef __TERRALIB_PROCESS_QT_INTERNAL_TASKGRAPHICSITEM_H
27 #define __TERRALIB_PROCESS_QT_INTERNAL_TASKGRAPHICSITEM_H
28 
29 #include "../../Config.h"
30 
31 // TerraLib
32 #include "AbstractGraphicsItem.h"
33 #include "../capabilities/TaskGraphicalCapabilities.h"
34 
35 // STL
36 #include <memory>
37 
38 namespace te
39 {
40  namespace process
41  {
42  namespace qt
43  {
44  class ConnectorGraphicsItem;
45 
46  class ProcessManager;
47 
48  /*!
49  \class TaskGraphicsItem
50 
51  \brief A GraphicItem to represents a Task Process Builder item.
52 
53  */
55  {
56  public:
57 
58  /*! \brief Default constructor. */
59  TaskGraphicsItem(ProcessManager* manager, const std::string& taskId);
60 
61  /*! \brief Virtual destructor. */
63 
64  /*! \brief Function used to reset the task id. */
65  void resetTaskId(const std::string& newTaskId);
66 
67  /*! \brief Function used to get the task id. */
68  const std::string getTaskId() const;
69 
70  /*! \brief Function used to add a new connector item to this task. */
72 
73  protected:
74 
75  /*!
76  \brief Virtual function used to notify when user clicks over a hotpoint.
77 
78  \param hotpoint Pointer to the hotpoint pressed.
79  */
80  virtual void hotPointPressed(HotPointGraphicsItem* hotpoint);
81 
82  protected:
83 
84  /*!
85  \brief Virtual function that defines the outer bounds of the item as a rectangle.
86 
87  \return QRectF for this item.
88  */
89  virtual QRectF boundingRect() const;
90 
91  /*!
92  \brief Function used to draw the process item.
93 
94  \param painter Qt Painter used to draw the process item.
95 
96  \param option Qt style options used to draw the process item.
97  */
98  virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr);
99 
100  /*!
101  \brief Virtual function to reimplement qt event.
102  */
103  virtual void dragEnterEvent(QGraphicsSceneDragDropEvent* event) override;
104 
105  /*!
106  \brief Virtual function to reimplement qt event.
107  */
108  virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event) override;
109 
110  /*!
111  \brief Virtual function to reimplement qt event.
112  */
113  virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) override;
114 
115  /*!
116  \brief Virtual function to reimplement qt event.
117  */
118  virtual void dropEvent(QGraphicsSceneDragDropEvent* event) override;
119 
120 
121  protected:
122 
124 
125  std::string m_taskId; //!< Task id that represents this item.
126 
127  std::vector<ConnectorGraphicsItem*> m_connectors; //!< All connectors that is linked with this task.
128 
129  std::unique_ptr<TaskGraphicalCapabilities> m_taskGraphicalCapabilities;
130  };
131  }
132  }
133 }
134 
135 #endif // __TERRALIB_PROCESS_QT_INTERNAL_TASKGRAPHICSITEM_H
An Abstract graphicItem to represents a process Builder item.
A GraphicItem to represents connector between two Tasks parameters (hot points).
A GraphicItem to represents Task parameters as hot point.
A QObject class to handle with process management.
A GraphicItem to represents a Task Process Builder item.
virtual void hotPointPressed(HotPointGraphicsItem *hotpoint)
Virtual function used to notify when user clicks over a hotpoint.
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override
Virtual function to reimplement qt event.
TaskGraphicsItem(ProcessManager *manager, const std::string &taskId)
Default constructor.
~TaskGraphicsItem()
Virtual destructor.
std::vector< ConnectorGraphicsItem * > m_connectors
All connectors that is linked with this task.
virtual QRectF boundingRect() const
Virtual function that defines the outer bounds of the item as a rectangle.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr)
Function used to draw the process item.
std::string m_taskId
Task id that represents this item.
void resetTaskId(const std::string &newTaskId)
Function used to reset the task id.
void addConnector(ConnectorGraphicsItem *connector)
Function used to add a new connector item to this task.
const std::string getTaskId() const
Function used to get the task id.
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event) override
Virtual function to reimplement qt event.
virtual void dropEvent(QGraphicsSceneDragDropEvent *event) override
Virtual function to reimplement qt event.
std::unique_ptr< TaskGraphicalCapabilities > m_taskGraphicalCapabilities
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) override
Virtual function to reimplement qt event.
TerraLib.
#define TEPROCESSEXPORT
Definition: Config.h:47