ConnectorGraphicsItem.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/ConnectorGraphicsItem.h
22 
23  \brief A GraphicItem to represents connector between two Tasks parameters (hot points).
24 */
25 
26 #ifndef __TERRALIB_PROCESS_QT_INTERNAL_CONNECTORGRAPHICSITEM_H
27 #define __TERRALIB_PROCESS_QT_INTERNAL_CONNECTORGRAPHICSITEM_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  class HotPointGraphicsItem;
43  class TaskGraphicsItem;
44 
45  /*!
46  \class ConnectorGraphicsItem
47 
48  \brief A GraphicItem to represents connector between two Tasks parameters (hot points).
49 
50  */
51  class TEPROCESSEXPORT ConnectorGraphicsItem : public QGraphicsObject
52  {
53  public:
54 
55  /*!
56  \brief Default constructor.
57 
58  \param taskFrom QGraophicsItem that represents FROM task
59 
60  \param hotPointFrom QGraphicsItem that represents FROM hotpoint
61 
62  \param taskTo QGraophicsItem that represents TO task
63 
64  \param hotPointTo QGraphicsItem that represents TO hotpoint
65  */
66  ConnectorGraphicsItem(const std::string& connectorId, TaskGraphicsItem* taskFrom, HotPointGraphicsItem* hotPointFrom, TaskGraphicsItem* taskTo, HotPointGraphicsItem* hotPointTo);
67 
68  /*! \brief Virtual destructor. */
70 
71  /*! \brief Get function to access connector internal pointer. */
72  const std::string getConnectorId() const;
73 
74  /*! \brief Get function to notify that the connector was removed. */
75  void removed();
76 
77  public:
78 
79  /*!
80  \brief Virtual function that defines the outer bounds of the item as a rectangle.
81 
82  \return QRectF for this item.
83  */
84  virtual QRectF boundingRect() const;
85 
86  /*!
87  \brief Function used to draw the process item.
88 
89  \param painter Qt Painter used to draw the process item.
90 
91  \param option Qt style options used to draw the process item.
92  */
93  virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr);
94 
95  protected:
96 
97  /*!
98  \brief Function used to get the hot points position in scene coordinate and create a QPainterPath
99 
100  \return a valid QPainterPath if connector hotpoints was defined
101  */
102  QPainterPath getConnectorPainterPath() const;
103 
104  QPainterPath getConnectorArrowPainterPath() const;
105 
106  protected:
107 
108  std::string m_connectorId; //!< TerraLib connector object id
109 
110  TaskGraphicsItem* m_taskFrom; //!< QGraphicsItem that represents FROM Task
111  HotPointGraphicsItem* m_hotPointFrom; //!< QGraphicsItem that represents FROM HotPoint
112 
113  TaskGraphicsItem* m_taskTo; //!< QGraphicsItem that represents TO Task
114  HotPointGraphicsItem* m_hotPointTo; //!< QGraphicsItem that represents TO HotPoint
115  };
116  }
117  }
118 }
119 
120 #endif // __TERRALIB_PROCESS_QT_INTERNAL_CONNECTORGRAPHICSITEM_H
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::process::qt::ConnectorGraphicsItem::paint
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr)
Function used to draw the process item.
te::process::qt::ConnectorGraphicsItem::m_taskFrom
TaskGraphicsItem * m_taskFrom
QGraphicsItem that represents FROM Task.
Definition: ConnectorGraphicsItem.h:110
te::process::qt::ConnectorGraphicsItem::m_connectorId
std::string m_connectorId
TerraLib connector object id.
Definition: ConnectorGraphicsItem.h:108
te::process::qt::TaskGraphicsItem
A GraphicItem to represents a Task Process Builder item.
Definition: TaskGraphicsItem.h:55
te::process::qt::ConnectorGraphicsItem
A GraphicItem to represents connector between two Tasks parameters (hot points).
Definition: ConnectorGraphicsItem.h:52
te::process::qt::ConnectorGraphicsItem::~ConnectorGraphicsItem
~ConnectorGraphicsItem()
Virtual destructor.
te::process::qt::ConnectorGraphicsItem::removed
void removed()
Get function to notify that the connector was removed.
te::process::qt::ConnectorGraphicsItem::getConnectorId
const std::string getConnectorId() const
Get function to access connector internal pointer.
te::process::qt::ConnectorGraphicsItem::m_hotPointFrom
HotPointGraphicsItem * m_hotPointFrom
QGraphicsItem that represents FROM HotPoint.
Definition: ConnectorGraphicsItem.h:111
te::process::qt::ConnectorGraphicsItem::ConnectorGraphicsItem
ConnectorGraphicsItem(const std::string &connectorId, TaskGraphicsItem *taskFrom, HotPointGraphicsItem *hotPointFrom, TaskGraphicsItem *taskTo, HotPointGraphicsItem *hotPointTo)
Default constructor.
te::process::qt::ConnectorGraphicsItem::getConnectorArrowPainterPath
QPainterPath getConnectorArrowPainterPath() const
te::process::qt::HotPointGraphicsItem
A GraphicItem to represents Task parameters as hot point.
Definition: HotPointGraphicsItem.h:49
TEPROCESSEXPORT
#define TEPROCESSEXPORT
Definition: Config.h:47
te::process::qt::ConnectorGraphicsItem::m_taskTo
TaskGraphicsItem * m_taskTo
QGraphicsItem that represents TO Task.
Definition: ConnectorGraphicsItem.h:113
te::process::qt::ConnectorGraphicsItem::m_hotPointTo
HotPointGraphicsItem * m_hotPointTo
QGraphicsItem that represents TO HotPoint.
Definition: ConnectorGraphicsItem.h:114
te::process::qt::ConnectorGraphicsItem::getConnectorPainterPath
QPainterPath getConnectorPainterPath() const
Function used to get the hot points position in scene coordinate and create a QPainterPath.
te::process::qt::ConnectorGraphicsItem::boundingRect
virtual QRectF boundingRect() const
Virtual function that defines the outer bounds of the item as a rectangle.