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. */
94 
95  //@}
96 
97  public:
98 
100 
102 
103  void setLayers(te::map::AbstractLayerPtr selectedLayer, std::vector<te::map::AbstractLayerPtr> allLayers);
104 
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 
120 
122 
124 
125  std::vector<std::string> getValues();
126 
128 
129  std::vector<std::string> getRecodeValues();
130 
131  void saveLegend(const std::string& path);
132 
133  protected slots:
134 
136 
137  void onBandSelected(QString value);
138 
139  void onTypeSelected(QString value);
140 
142 
143  void onTableWidgetItemDoubleClicked(QTableWidgetItem* item);
144 
146 
148 
150 
151  signals:
152 
154 
155  private:
156 
157  std::unique_ptr<Ui::ColorMapWidgetForm> m_ui; //!< Dialog form.
158  te::qt::widgets::ColorCatalogWidget* m_colorBar; //!< Widget used to pick a color.
159  te::se::ColorMap* m_cm; //!< SE Color Map element.
160  te::color::ColorBar* m_cb; //!< Terralib color bar objetc
161 
162  te::rst::Raster* m_raster; //!< TerraLib raster object
163 
164  };
165 
166  } // end namespace widgets
167  } // end namespace qt
168 } // end namespace te
169 
170 #endif // __TERRALIB_QT_WIDGETS_SE_INTERNAL_COLORMAPWIDGET_H
It models the concept of color bar.
Definition: ColorBar.h:50
A dialog used to build a ColorMap element.
std::vector< std::string > getValues()
std::unique_ptr< Ui::ColorMapWidgetForm > m_ui
Dialog form.
void initialize()
Internal method to initialize the widget (e.g.: color, combos, icons, etc.)
te::color::ColorBar * m_cb
Terralib color bar objetc.
void setColorMap(te::se::ColorMap *cm)
void updateUi(bool loadColorBar=false)
Updates the widget form based on internal fill element.
te::se::ColorMap * m_cm
SE Color Map element.
void setRaster(te::rst::Raster *r)
void updateTableHeader(te::se::ColorMapTransformationType type)
te::se::ColorMap * getColorMap()
void setLayers(te::map::AbstractLayerPtr selectedLayer, std::vector< te::map::AbstractLayerPtr > allLayers)
std::vector< std::string > getRecodeValues()
ColorMapWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a ShadedReliefWidget dialog which is a child of parent, with widget flags set to f.
te::qt::widgets::ColorCatalogWidget * m_colorBar
Widget used to pick a color.
Ui::ColorMapWidgetForm * getForm()
void onTransformComboBoxCurrentIndexChanged(int index)
void onTypeSelected(QString value)
void onBandSelected(QString value)
void onTableWidgetItemDoubleClicked(QTableWidgetItem *item)
te::rst::Raster * m_raster
TerraLib raster object.
void saveLegend(const std::string &path)
An abstract class for raster data strucutures.
Definition: Raster.h:72
A ColorMap defines either the colors of a pallette-type raster source or the mapping of numeric pixel...
Definition: ColorMap.h:62
TECOLOREXPORT te::color::ColorSchemeCatalog * loadColorBar(const std::string &jsonfile, const std::string &catalogName)
This file contains utility functions for color bar.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
ColorMapTransformationType
Allowed color transformations type.
Definition: Enums.h:54
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