GroupingWidget.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/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 #ifndef Q_MOC_RUN
31 #include "../../../maptools/AbstractLayer.h"
32 #endif
33 #include "../Config.h"
34 
35 // STL
36 #include <memory>
37 
38 // QT
39 #include <QTableWidgetItem>
40 #include <QWidget>
41 
42 // Forward declaraion
43 namespace Ui { class GroupingWidgetForm; }
44 
45 namespace te
46 {
47 // Forward declarations
48  namespace color { class ColorBar; }
49 
50  namespace da { class DataSetType; }
51 
52  namespace map
53  {
54  class Grouping;
55  class GroupingItem;
56  }
57 
58  namespace qt
59  {
60  namespace widgets
61  {
62  // Forward declarations
63  class ColorCatalogWidget;
64 
65  /*!
66  \class GroupingWidget
67 
68  \brief A widget used to build a grouping.
69 
70  \sa
71  */
72  class TEQTWIDGETSEXPORT GroupingWidget : public QWidget
73  {
74  Q_OBJECT
75 
76  public:
77 
78  /** @name Initializer Methods
79  * Methods related to instantiation and destruction.
80  */
81  //@{
82 
83  /*! \brief Constructs a basic fill widget which is a child of parent, with widget flags set to f. */
84  GroupingWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
85 
86  /*! \brief Destructor. */
87  ~GroupingWidget();
88 
89  //@}
90 
91  public:
92 
93  void setLayers(te::map::AbstractLayerPtr selectedLayer, std::vector<te::map::AbstractLayerPtr> allLayers);
94 
95  std::auto_ptr<te::map::Grouping> getGrouping();
96 
97  protected:
98 
99  /*! \brief Internal method to initialize the widget (e.g.: color, combos, icons, etc.) */
100  void initialize();
101 
102  /*! \brief Updates the widget form based on internal fill element. */
103  void updateUi(bool loadColorBar = false);
104 
105  void setDataSetType();
106 
107  void setGrouping();
108 
109  void setGrouping(te::map::Grouping* grouping);
110 
111  void getDataAsDouble(std::vector<double>& vec, const std::string& attrName, const int& dataType, int& nullValues);
112 
113  void getLinkedDataAsDouble(std::vector<double>& vec, const std::string& attrName, const int& dataType, int& nullValues);
114 
115  void getDataAsString(std::vector<std::string>& vec, const std::string& attrName, int& nullValues);
116 
117  void getLinkedDataAsString(std::vector<std::string>& vec, const std::string& attrName, int& nullValues);
118 
119  void createDoubleNullGroupingItem(int count);
120 
121  void createStringNullGroupingItem(int count);
122 
123  int getGeometryType();
124 
125  void buildSymbolizer(std::string meanTitle = "");
126 
127  void listAttributes();
128 
129  public slots:
130 
131  void onApplyPushButtonClicked();
132 
133  void onTypeComboBoxActivated(int idx);
134 
135  void onAttrComboBoxActivated(int idx);
136 
137  void onColorBarChanged();
138 
139  void onTableWidgetItemChanged(QTableWidgetItem* item);
140 
141  void onTableWidgetItemDoubleClicked(QTableWidgetItem* item);
142 
143  void onImportPushButtonClicked();
144 
145  signals:
146 
147  void applyPushButtonClicked();
148 
149 
150  private:
151 
152  std::auto_ptr<Ui::GroupingWidgetForm> m_ui; //!< Widget form.
153 
154  te::color::ColorBar* m_cb; //!< Terralib color bar objetc
155  te::map::AbstractLayerPtr m_layer; //!< TerraLib layer auto ptr
156  te::qt::widgets::ColorCatalogWidget* m_colorBar; //!< Widget used to pick a color.
157  std::vector<te::map::GroupingItem*> m_legend; //!< Grouping items
158 
159  bool m_manual;
160 
161  };
162 
163  } // end namespace widgets
164  } // end namespace qt
165 } // end namespace te
166 
167 #endif // __TERRALIB_QT_WIDGETS_SE_INTERNAL_GROUPINGWIDGET_H
std::vector< te::map::GroupingItem * > m_legend
Grouping items.
This class contains the parameters needed for grouping the values of a Property.
Definition: Grouping.h:59
std::auto_ptr< Ui::GroupingWidgetForm > m_ui
Widget form.
A widget used to build a grouping.
URI C++ Library.
te::map::AbstractLayerPtr m_layer
TerraLib layer auto ptr.
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:63
te::qt::widgets::ColorCatalogWidget * m_colorBar
Widget used to pick a color.
te::color::ColorBar * m_cb
Terralib color bar objetc.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr