ColorMapWidget.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/ColorMapWidget.h
22 
23  \brief A widget used to build
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_SE_INTERNAL_COLORMAPWIDGET_H
27 #define __TERRALIB_QT_WIDGETS_SE_INTERNAL_COLORMAPWIDGET_H
28 
29 // TerraLib
30 #include "../../../maptools/AbstractLayer.h"
31 #include "../../../se/Enums.h"
32 #include "../Config.h"
33 
34 // Qt
35 #include <QTableWidgetItem>
36 #include <QWidget>
37 
38 // STL
39 #include <memory>
40 #include <string>
41 #include <vector>
42 
43 // Forward declaraion
44 namespace Ui { class ColorMapWidgetForm; }
45 
46 namespace te
47 {
48 // Forward declarations
49  namespace color
50  {
51  class ColorBar;
52  }
53 
54  namespace se
55  {
56  class ColorMap;
57  }
58 
59  namespace rst
60  {
61  class Raster;
62  }
63 
64  namespace qt
65  {
66  namespace widgets
67  {
68  // Forward declarations
69  class ColorCatalogWidget;
70 
71  /*!
72  \class ColorMapWidget
73 
74  \brief A dialog used to build a ColorMap element.
75  */
76  class TEQTWIDGETSEXPORT ColorMapWidget : public QWidget
77  {
78  Q_OBJECT
79 
80  public:
81 
82  /** @name Initializer Methods
83  * Methods related to instantiation and destruction.
84  */
85  //@{
86 
87  /*! \brief Constructs a ShadedReliefWidget dialog which is a child of parent, with widget flags set to f. */
88  ColorMapWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
89 
90  /*! \brief Destructor. */
91  ~ColorMapWidget();
92 
93  //@}
94 
95  public:
96 
97  void setRaster(te::rst::Raster* r);
98 
99  void setColorMap(te::se::ColorMap* cm);
100 
101  void setLayers(te::map::AbstractLayerPtr selectedLayer, std::vector<te::map::AbstractLayerPtr> allLayers);
102 
103  te::se::ColorMap* getColorMap();
104 
105  std::string getCurrentBand();
106 
107  protected:
108 
109  /*! \brief Internal method to initialize the widget (e.g.: color, combos, icons, etc.) */
110  void initialize();
111 
112  /*! \brief Updates the widget form based on internal fill element. */
113  void updateUi(bool loadColorBar = false);
114 
115  void buildCategorizationMap();
116 
117  void buildInterpolationMap();
118 
119  void buildRecodingMap();
120 
121  std::vector<std::string> getValues();
122 
123  void updateTableHeader(te::se::ColorMapTransformationType type);
124 
125  protected slots:
126 
127  void onApplyPushButtonClicked();
128 
129  void onBandSelected(QString value);
130 
131  void onTransformComboBoxCurrentIndexChanged(int index);
132 
133  void onTableWidgetItemDoubleClicked(QTableWidgetItem* item);
134 
135  void onImportPushButtonClicked();
136 
137  signals:
138 
139  void applyPushButtonClicked();
140 
141  private:
142 
143  std::auto_ptr<Ui::ColorMapWidgetForm> m_ui; //!< Dialog form.
144  te::qt::widgets::ColorCatalogWidget* m_colorBar; //!< Widget used to pick a color.
145  te::se::ColorMap* m_cm; //!< SE Color Map element.
146  te::color::ColorBar* m_cb; //!< Terralib color bar objetc
147 
148  te::rst::Raster* m_raster; //!< TerraLib raster object
149 
150  };
151 
152  } // end namespace widgets
153  } // end namespace qt
154 } // end namespace te
155 
156 #endif // __TERRALIB_QT_WIDGETS_SE_INTERNAL_COLORMAPWIDGET_H
A dialog used to build a ColorMap element.
An abstract class for raster data strucutures.
Definition: Raster.h:71
URI C++ Library.
ColorMapTransformationType
Allowed color transformations type.
Definition: Enums.h:53
te::se::ColorMap * m_cm
SE Color Map element.
te::qt::widgets::ColorCatalogWidget * m_colorBar
Widget used to pick a color.
te::color::ColorBar * m_cb
Terralib color bar objetc.
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
std::auto_ptr< Ui::ColorMapWidgetForm > m_ui
Dialog form.
te::rst::Raster * m_raster
TerraLib raster object.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
A ColorMap defines either the colors of a pallette-type raster source or the mapping of numeric pixel...
Definition: ColorMap.h:61