AbstractGraphicWidget.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/se/AbstractGraphicWidget.h
22 
23  \brief Abstract class that represents a widget that can be used to build a graphic element.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_SE_INTERNAL_ABSTRACTGRAPHICWIDGET_H
27 #define __TERRALIB_QT_WIDGETS_SE_INTERNAL_ABSTRACTGRAPHICWIDGET_H
28 
29 // TerraLib
30 #include "../Config.h"
31 
32 // Qt
33 #include <QWidget>
34 
35 namespace te
36 {
37 // Forward declarations
38  namespace se
39  {
40  class Graphic;
41  }
42 
43  namespace qt
44  {
45  namespace widgets
46  {
47  /*!
48  \class AbstractGraphicWidget
49 
50  \brief Abstract class that represents a widget that can be used to build a graphic element.
51 
52  \sa ExternalGraphicWidget, GlyphGraphicWidget, WellKnownGraphicWidget
53  */
55  {
56  Q_OBJECT
57 
58  public:
59 
60  /** @name Initializer Methods
61  * Methods related to instantiation and destruction.
62  */
63  //@{
64 
65  /*! \brief Constructs a graphic widget which is a child of parent, with widget flags set to f. */
66  AbstractGraphicWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
67 
68  /*! \brief Destructor. */
69  virtual ~AbstractGraphicWidget();
70 
71  //@}
72 
73  public:
74 
75  /*!
76  \brief Gets the configured graphic element.
77 
78  \return The configured graphic element.
79 
80  \note The caller will take the ownership of the returned graphic.
81  */
82  te::se::Graphic* getGraphic() const;
83 
84  /*!
85  \brief Sets a graphic element to this widget.
86 
87  \param graphic A valid graphic element.
88 
89  \return It return true if the widget can deal with the given graphic. Otherwise, it returns false.
90 
91  \note The widget will NOT take the ownership of the given graphic.
92  \note The widget form will be update based on given graphic parameters.
93  */
94  virtual bool setGraphic(const te::se::Graphic* graphic) = 0;
95 
96  /*! \brief Pure virtual method that should return a "user friendly" string that informs the graphic type that can be built by the widget. */
97  virtual QString getGraphicType() const = 0;
98 
99  /*! \brief Pure virtual method that should return a QIcon that represents the graphic. i.e. a simple preview. */
100  virtual QIcon getGraphicIcon(const QSize& size) const = 0;
101 
102  protected slots:
103 
104  void setGraphicSize(const QString& size);
105 
106  void setGraphicAngle(const QString& angle);
107 
108  void setGraphicOpacity(int value);
109 
110  void setGraphicDisplacement(const QString& dx, const QString& dy);
111 
112  void setGraphicAnchorPoint(const QString& ax, const QString& ay);
113 
114  signals:
115 
116  /*! This signal is emitted when the internal graphic element is changed. */
117  void graphicChanged();
118 
119  protected:
120 
121  te::se::Graphic* m_graphic; //!< Graphic element that will be configured by this widget.
122  };
123 
124  } // end namespace widgets
125  } // end namespace qt
126 } // end namespace te
127 
128 #endif // __TERRALIB_QT_WIDGETS_SE_INTERNAL_ABSTRACTGRAPHICWIDGET_H
te::se::Graphic * m_graphic
Graphic element that will be configured by this widget.
A Graphic is a graphic symbol with an inherent shape, color(s), and possibly size.
Definition: Graphic.h:66
URI C++ Library.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
Abstract class that represents a widget that can be used to build a graphic element.