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