All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GroupingWidget.h
Go to the documentation of this file.
1 /* Copyright (C) 2011-2012 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/GroupingWidget.h
22 
23  \brief A widget used to build a grouping.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_SE_INTERNAL_GROUPINGWIDGET_H
27 #define __TERRALIB_QT_WIDGETS_SE_INTERNAL_GROUPINGWIDGET_H
28 
29 // TerraLib
30 #include "../../../maptools/AbstractLayer.h"
31 #include "../Config.h"
32 
33 // STL
34 #include <memory>
35 
36 // QT
37 #include <QtGui/QTableWidgetItem>
38 #include <QtGui/QWidget>
39 
40 // Forward declaraion
41 namespace Ui { class GroupingWidgetForm; }
42 
43 namespace te
44 {
45 // Forward declarations
46  namespace color { class ColorBar; }
47 
48  namespace da { class DataSetType; }
49 
50  namespace map
51  {
52  class Grouping;
53  class GroupingItem;
54  }
55 
56  namespace qt
57  {
58  namespace widgets
59  {
60 // Forward declarations
61  namespace colorbar
62  {
63  class ColorBar;
64  }
65 
66  /*!
67  \class GroupingWidget
68 
69  \brief A widget used to build a grouping.
70 
71  \sa
72  */
73  class TEQTWIDGETSEXPORT GroupingWidget : public QWidget
74  {
75  Q_OBJECT
76 
77  public:
78 
79  /** @name Initializer Methods
80  * Methods related to instantiation and destruction.
81  */
82  //@{
83 
84  /*! \brief Constructs a basic fill widget which is a child of parent, with widget flags set to f. */
85  GroupingWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
86 
87  /*! \brief Destructor. */
88  ~GroupingWidget();
89 
90  //@}
91 
92  public:
93 
94  void setLayer(te::map::AbstractLayerPtr layer);
95 
96  std::auto_ptr<te::map::Grouping> getGrouping();
97 
98 
99  protected:
100 
101  /*! \brief Internal method to initialize the widget (e.g.: color, combos, icons, etc.) */
102  void initialize();
103 
104  /*! \brief Updates the widget form based on internal fill element. */
105  void updateUi();
106 
107  void setDataSetType();
108 
109  void setGrouping();
110 
111  void getDataAsDouble(std::vector<double>& vec, const std::string& attrName, const int& dataType, int& nullValues);
112 
113  void getDataAsString(std::vector<std::string>& vec, const std::string& attrName, int& nullValues);
114 
115  void createDoubleNullGroupingItem(int count);
116 
117  void createStringNullGroupingItem(int count);
118 
119  int getGeometryType();
120 
121  void buildSymbolizer(std::string meanTitle = "");
122 
123  void listAttributes();
124 
125 
126  public slots:
127 
128  void onApplyPushButtonClicked();
129 
130  void onTypeComboBoxActivated(int idx);
131 
132  void onAttrComboBoxActivated(int idx);
133 
134  void onColorBarChanged();
135 
136  void onTableWidgetItemChanged(QTableWidgetItem* item);
137 
138  signals:
139 
140  void applyPushButtonClicked();
141 
142 
143  private:
144 
145  std::auto_ptr<Ui::GroupingWidgetForm> m_ui; //!< Widget form.
146 
147  te::color::ColorBar* m_cb; //!< Terralib color bar objetc
148  te::map::AbstractLayerPtr m_layer; //!< TerraLib layer auto ptr
149  te::qt::widgets::colorbar::ColorBar* m_colorBar; //!< Widget used to pick a color.
150  std::vector<te::map::GroupingItem*> m_legend; //!< Grouping items
151 
152  bool m_manual;
153 
154  };
155 
156  } // end namespace widgets
157  } // end namespace qt
158 } // end namespace te
159 
160 #endif // __TERRALIB_QT_WIDGETS_SE_INTERNAL_GROUPINGWIDGET_H
It models the concept of color bar.
Definition: ColorBar.h:49
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:101
te::qt::widgets::colorbar::ColorBar * m_colorBar
Widget used to pick a color.
std::vector< te::map::GroupingItem * > m_legend
Grouping items.
It QWidget implementation of color bar.
Definition: ColorBar.h:67
std::auto_ptr< Ui::GroupingWidgetForm > m_ui
Widget form.
te::map::AbstractLayerPtr m_layer
TerraLib layer auto ptr.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
te::color::ColorBar * m_cb
Terralib color bar objetc.
A widget used to build a grouping.