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 { class Grouping; }
53 
54  namespace se
55  {
56  class Rule;
57  class Style;
58  }
59 
60  namespace qt
61  {
62  namespace widgets
63  {
64  // Forward declarations
65  class ColorCatalogWidget;
66 
67  /*!
68  \class GroupingWidget
69 
70  \brief A widget used to build a grouping.
71 
72  \sa
73  */
74  class TEQTWIDGETSEXPORT GroupingWidget : public QWidget
75  {
76  Q_OBJECT
77 
78  public:
79 
80  /** @name Initializer Methods
81  * Methods related to instantiation and destruction.
82  */
83  //@{
84 
85  /*! \brief Constructs a basic fill widget which is a child of parent, with widget flags set to f. */
86  GroupingWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
87 
88  /*! \brief Destructor. */
90 
91  //@}
92 
93  public:
94 
95  void setLayers(te::map::AbstractLayerPtr selectedLayer, std::vector<te::map::AbstractLayerPtr> allLayers);
96 
97  std::unique_ptr<te::map::Grouping> getGrouping();
98 
99  void updateStyle();
100 
101  protected:
102 
103  /*! \brief Internal method to initialize the widget (e.g.: color, combos, icons, etc.) */
104  void initialize();
105 
106  /*! \brief Updates the widget form based on internal fill element. */
107  void updateUi(bool loadColorBar = false);
108 
110 
111  void setGrouping();
112 
113  void setGrouping(te::map::Grouping* grouping, te::se::Style* style);
114 
115  void getDataAsDouble(std::vector<double>& vec, const std::string& attrName, const int& dataType, int& nullValues);
116 
117  void getLinkedDataAsDouble(std::vector<double>& vec, const std::string& attrName, const int& dataType, int& nullValues);
118 
119  void getDataAsString(std::vector<std::string>& vec, const std::string& attrName, int& nullValues);
120 
121  void getLinkedDataAsString(std::vector<std::string>& vec, const std::string& attrName, int& nullValues);
122 
124 
126 
128 
129  void buildSymbolizer(std::string meanTitle = "");
130 
132 
133  void saveLegend(const std::string& path);
134 
135  public slots:
136 
138 
139  void onTypeComboBoxActivated(int idx);
140 
141  void onAttrComboBoxActivated(int idx);
142 
144 
145  void onTableWidgetItemChanged(QTableWidgetItem* item);
146 
147  void onTableWidgetItemDoubleClicked(QTableWidgetItem* item);
148 
150 
151  signals:
152 
154 
155 
156  private:
157 
158  std::unique_ptr<Ui::GroupingWidgetForm> m_ui; //!< Widget form.
159 
160  te::color::ColorBar* m_cb; //!< Terralib color bar objetc
161  te::map::AbstractLayerPtr m_layer; //!< TerraLib layer auto ptr
162  te::qt::widgets::ColorCatalogWidget* m_colorBar; //!< Widget used to pick a color.
163  std::vector<te::se::Rule*> m_rules; //!< Grouping items
164  te::se::Style* m_style; //!< Current style from input layer.
165 
166  bool m_manual;
167  };
168 
169  } // end namespace widgets
170  } // end namespace qt
171 } // end namespace te
172 
173 #endif // __TERRALIB_QT_WIDGETS_SE_INTERNAL_GROUPINGWIDGET_H
te::qt::widgets::GroupingWidget::buildSymbolizer
void buildSymbolizer(std::string meanTitle="")
te::qt::widgets::GroupingWidget::m_cb
te::color::ColorBar * m_cb
Terralib color bar objetc.
Definition: GroupingWidget.h:160
te::qt::widgets::GroupingWidget::onApplyPushButtonClicked
void onApplyPushButtonClicked()
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::qt::widgets::GroupingWidget::createDoubleNullGroupingItem
void createDoubleNullGroupingItem(int count)
te::map::AbstractLayerPtr
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
Definition: AbstractLayer.h:626
te::qt::widgets::GroupingWidget::setGrouping
void setGrouping(te::map::Grouping *grouping, te::se::Style *style)
te::qt::widgets::GroupingWidget::m_ui
std::unique_ptr< Ui::GroupingWidgetForm > m_ui
Widget form.
Definition: GroupingWidget.h:158
te::color::loadColorBar
TECOLOREXPORT te::color::ColorSchemeCatalog * loadColorBar(const std::string &jsonfile, const std::string &catalogName)
This file contains utility functions for color bar.
te::qt::widgets::GroupingWidget::getGeometryType
int getGeometryType()
te::qt::widgets::GroupingWidget::onTableWidgetItemChanged
void onTableWidgetItemChanged(QTableWidgetItem *item)
TEQTWIDGETSEXPORT
#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::GroupingWidget::createStringNullGroupingItem
void createStringNullGroupingItem(int count)
te::qt::widgets::GroupingWidget::m_colorBar
te::qt::widgets::ColorCatalogWidget * m_colorBar
Widget used to pick a color.
Definition: GroupingWidget.h:162
te::qt::widgets::GroupingWidget::onImportPushButtonClicked
void onImportPushButtonClicked()
te::qt::widgets::GroupingWidget::onColorBarChanged
void onColorBarChanged()
te::qt::widgets::ColorCatalogWidget
...
Definition: ColorCatalogWidget.h:59
Ui
Definition: ConfigInputAddressDialog.h:44
te::map::Grouping
This class contains the parameters needed for grouping the values of a Property.
Definition: Grouping.h:58
te::qt::widgets::GroupingWidget::updateStyle
void updateStyle()
te::qt::widgets::GroupingWidget::~GroupingWidget
~GroupingWidget()
Destructor.
te::qt::widgets::GroupingWidget::m_layer
te::map::AbstractLayerPtr m_layer
TerraLib layer auto ptr.
Definition: GroupingWidget.h:161
te::qt::widgets::GroupingWidget::setLayers
void setLayers(te::map::AbstractLayerPtr selectedLayer, std::vector< te::map::AbstractLayerPtr > allLayers)
te::qt::widgets::GroupingWidget::getGrouping
std::unique_ptr< te::map::Grouping > getGrouping()
slots
#define slots
Definition: VirtualMachine.h:48
te::qt::widgets::GroupingWidget::m_style
te::se::Style * m_style
Current style from input layer.
Definition: GroupingWidget.h:164
te::qt::widgets::GroupingWidget::GroupingWidget
GroupingWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a basic fill widget which is a child of parent, with widget flags set to f.
te::qt::widgets::GroupingWidget::setDataSetType
void setDataSetType()
te::qt::widgets::GroupingWidget::getLinkedDataAsString
void getLinkedDataAsString(std::vector< std::string > &vec, const std::string &attrName, int &nullValues)
te::qt::widgets::GroupingWidget::getLinkedDataAsDouble
void getLinkedDataAsDouble(std::vector< double > &vec, const std::string &attrName, const int &dataType, int &nullValues)
te::color::ColorBar
It models the concept of color bar.
Definition: ColorBar.h:50
te::qt::widgets::GroupingWidget::m_manual
bool m_manual
Definition: GroupingWidget.h:166
te::qt::widgets::GroupingWidget::m_rules
std::vector< te::se::Rule * > m_rules
Grouping items.
Definition: GroupingWidget.h:163
te::se::Style
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
Definition: Style.h:66
te::qt::widgets::GroupingWidget::setGrouping
void setGrouping()
te::qt::widgets::GroupingWidget::onAttrComboBoxActivated
void onAttrComboBoxActivated(int idx)
te::qt::widgets::GroupingWidget::saveLegend
void saveLegend(const std::string &path)
te::qt::widgets::GroupingWidget::initialize
void initialize()
Internal method to initialize the widget (e.g.: color, combos, icons, etc.)
te::qt::widgets::GroupingWidget::updateUi
void updateUi(bool loadColorBar=false)
Updates the widget form based on internal fill element.
te::qt::widgets::GroupingWidget
A widget used to build a grouping.
Definition: GroupingWidget.h:75
te::qt::widgets::GroupingWidget::getDataAsDouble
void getDataAsDouble(std::vector< double > &vec, const std::string &attrName, const int &dataType, int &nullValues)
te::qt::widgets::GroupingWidget::applyPushButtonClicked
void applyPushButtonClicked()
te::qt::widgets::GroupingWidget::onTableWidgetItemDoubleClicked
void onTableWidgetItemDoubleClicked(QTableWidgetItem *item)
te::qt::widgets::GroupingWidget::getDataAsString
void getDataAsString(std::vector< std::string > &vec, const std::string &attrName, int &nullValues)
te::qt::widgets::GroupingWidget::listAttributes
void listAttributes()
te::qt::widgets::GroupingWidget::onTypeComboBoxActivated
void onTypeComboBoxActivated(int idx)