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