Loading...
Searching...
No Matches
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
43namespace Ui { class GroupingWidgetForm; }
44
45namespace 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
100
101 protected:
102
103 /*! \brief Internal method to initialize the widget (e.g.: color, combos, icons, etc.) */
105
106 /*! \brief Updates the widget form based on internal fill element. */
107 void updateUi(bool loadColorBar = false);
108
110
112
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
140
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
167 };
168
169 } // end namespace widgets
170 } // end namespace qt
171} // end namespace te
172
173#endif // __TERRALIB_QT_WIDGETS_SE_INTERNAL_GROUPINGWIDGET_H
It models the concept of color bar.
Definition: ColorBar.h:50
This class contains the parameters needed for grouping the values of a Property.
Definition: Grouping.h:58
A widget used to build a grouping.
std::vector< te::se::Rule * > m_rules
Grouping items.
void getDataAsDouble(std::vector< double > &vec, const std::string &attrName, const int &dataType, int &nullValues)
void setGrouping(te::map::Grouping *grouping, te::se::Style *style)
void buildSymbolizer(std::string meanTitle="")
void onTableWidgetItemChanged(QTableWidgetItem *item)
te::qt::widgets::ColorCatalogWidget * m_colorBar
Widget used to pick a color.
std::unique_ptr< Ui::GroupingWidgetForm > m_ui
Widget form.
void initialize()
Internal method to initialize the widget (e.g.: color, combos, icons, etc.)
void createStringNullGroupingItem(int count)
void getDataAsString(std::vector< std::string > &vec, const std::string &attrName, int &nullValues)
te::se::Style * m_style
Current style from input layer.
void getLinkedDataAsDouble(std::vector< double > &vec, const std::string &attrName, const int &dataType, int &nullValues)
te::color::ColorBar * m_cb
Terralib color bar objetc.
void onTableWidgetItemDoubleClicked(QTableWidgetItem *item)
void getLinkedDataAsString(std::vector< std::string > &vec, const std::string &attrName, int &nullValues)
void saveLegend(const std::string &path)
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.
void setLayers(te::map::AbstractLayerPtr selectedLayer, std::vector< te::map::AbstractLayerPtr > allLayers)
te::map::AbstractLayerPtr m_layer
TerraLib layer auto ptr.
std::unique_ptr< te::map::Grouping > getGrouping()
void createDoubleNullGroupingItem(int count)
void updateUi(bool loadColorBar=false)
Updates the widget form based on internal fill element.
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
Definition: Style.h:66
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
TerraLib.
#define slots
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63