RasterSymbolizerWidget.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/RasterSymbolizerWidget.h
22 
23  \brief A widget used to configure a Raster Symbolizer SE element.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_SE_INTERNAL_RASTERSYMBOLIZERWIDGET_H
27 #define __TERRALIB_QT_WIDGETS_SE_INTERNAL_RASTERSYMBOLIZERWIDGET_H
28 
29 // TerraLib
30 #include "../../../maptools/AbstractLayer.h"
31 #include "../../../maptools/RasterTransform.h"
32 #include "../../../rp/Contrast.h"
33 #include "../../../se.h"
34 #include "../Config.h"
35 
36 // Qt
37 #include <QWidget>
38 #include <QComboBox>
39 
40 // STL
41 #include <memory>
42 #include <string>
43 #include <vector>
44 #include <map>
45 
46 // Forward declaraion
47 namespace Ui { class RasterSymbolizerWidgetForm; }
48 
49 namespace te
50 {
51  // Forward declarations
52  namespace map
53  {
54  class RasterContrast;
55  }
56 
57  namespace se
58  {
59  class ContrastEnhancement;
60  class RasterSymbolizer;
61  class Symbolizer;
62  }
63 
64  namespace rst
65  {
66  class BandProperty;
67  }
68 
69 // Forward declarations
70  namespace qt
71  {
72  namespace widgets
73  {
74  // Forward declarations
75  class MapDisplay;
76  class HorizontalSliderWidget;
77  class RasterHistogramWidget;
78 
79  /*!
80  \class RasterSymbolizerWidget
81 
82  \brief A widget used to configure a Raster Symbolizer SE element.
83  */
85  {
86  Q_OBJECT
87 
88  public:
89 
90  /** @name Initializer Methods
91  * Methods related to instantiation and destruction.
92  */
93  //@{
94 
95  /*! \brief Constructs a RasterSymbolizerWidget dialog which is a child of parent, with widget flags set to f. */
96  RasterSymbolizerWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
97 
98  /*! \brief Destructor. */
100 
101  //@}
102 
103  void setRasterSymbolizer(te::se::RasterSymbolizer* rs);
104 
105  te::se::RasterSymbolizer* getRasterSymbolizer() { return m_symbolizer; }
106 
107  void setRasterContrast(te::map::RasterContrast* contrast);
108 
109  te::map::RasterContrast* getRasterContrast();
110 
111  void setLayer(te::map::AbstractLayer* layer);
112 
113  void setBandProperty(std::vector<te::rst::BandProperty*> bp);
114 
115  void setMapDisplay(te::qt::widgets::MapDisplay* display);
116 
117  protected:
118 
119  /*! \brief Internal method to initialize the widget (e.g.: color, combos, icons, etc.) */
120  void initialize();
121 
122  /*! \brief Updates the widget form based on internal mark element. */
123  void updateUi();
124 
125  void setComboBoxText(QComboBox* cb, std::string value);
126 
127  protected slots:
128 
129  void onOpacityChanged(int value);
130 
131  void onMonoChannelSelectionClicked();
132  void onRedChannelSelectionClicked();
133  void onGreenChannelSelectionClicked();
134  void onBlueChannelSelectionClicked();
135  void onCompositionChannelSelectionClicked();
136 
137  void onMonoChannelNameChanged(QString s);
138  void onRedChannelNameChanged(QString s);
139  void onGreenChannelNameChanged(QString s);
140  void onBlueChannelNameChanged(QString s);
141 
142  void onTypeConstratChanged(QString s);
143 
144  void onMonoGammaChanged(int v);
145  void onRedGammaChanged(int v);
146  void onGreenGammaChanged(int v);
147  void onBlueGammaChanged(int v);
148 
149  void onIncreaseGain();
150  void onDecreaseGain();
151  void onDefaultGain();
152  void onIncreaseOffset();
153  void onDecreaseOffset();
154  void onDefaultOffset();
155  void onSymbolizerChanged();
156 
157  void onDummyPushButtonClicked();
158 
159  void setContrastVisibility();
160 
161  //contrast slots
162 
163  void onHistogramToolButtonClicked();
164 
165  void onMinValueSelected(int value, int band);
166 
167  void onMaxValueSelected(int value, int band);
168 
169  void onMinValueSelected(double value, int band);
170 
171  void onMaxValueSelected(double value, int band);
172 
173  void onResetToolButtonClicked();
174 
175  void onApplyToolButtonClicked();
176 
177 
178  signals:
179 
180  void symbolizerChanged();
181 
182  void contrastChanged(bool remove);
183 
184  void mapRefresh();
185 
186  private:
187 
188  std::unique_ptr<Ui::RasterSymbolizerWidgetForm> m_ui; //!< Widget form.
189  te::qt::widgets::HorizontalSliderWidget* m_sliderWidget; //!< Slider widget used for opacity information.
191 
193 
194  te::se::RasterSymbolizer* m_symbolizer; //!< SE Raster Symbolizer element.
195  te::map::RasterContrast* m_contrast; //!< Raster Contrast element.
196 
198 
199  te::se::ContrastEnhancement* m_contrastRed; //!< SE Contrast element for red band.
200  te::se::ContrastEnhancement* m_contrastGreen; //!< SE Contrast element for green band.
201  te::se::ContrastEnhancement* m_contrastBlue; //!< SE Contrast element for blue band.
202  te::se::ContrastEnhancement* m_contrastMono; //!< SE Contrast element for mono band.
203 
204  te::se::SelectedChannel* m_scRed; //!< SE Selected Channel element for red band.
205  te::se::SelectedChannel* m_scGreen; //!< SE Selected Channel element for red band.
206  te::se::SelectedChannel* m_scBlue; //!< SE Selected Channel element for red band.
207  te::se::SelectedChannel* m_scMono; //!< SE Selected Channel element for red band.
208 
209  te::se::ChannelSelection* m_cs; //!< SE Channel Selection element.
210 
211  std::map<te::se::ContrastEnhancement::ContrastEnhancementType, QString> m_ceNames; //!< Contrast Types Names
212  std::map<te::rp::Contrast::InputParameters::ContrastType, te::map::RasterTransform::ContrastType> m_contrastMap; //!< Contrast Types Names
213 
214  double m_gainValue; //!< Value used to define the gain value.
215  double m_offsetValue; //!< Value used to define the offset value.
216  double m_gainOriginalValue; //!< Value used to define the gain value.
217  double m_offsetOriginalValue; //!< Value used to define the offset value.
218  };
219 
220  } // end namespace widgets
221  } // end namespace qt
222 } // end namespace te
223 
224 #endif // __TERRALIB_QT_WIDGETS_SE_INTERNAL_RASTERSYMBOLIZERWIDGET_H
std::map< te::se::ContrastEnhancement::ContrastEnhancementType, QString > m_ceNames
Contrast Types Names.
#define slots
A selected channel to be display.
te::se::ContrastEnhancement * m_contrastBlue
SE Contrast element for blue band.
This is the base class for layers.
Definition: AbstractLayer.h:77
std::unique_ptr< Ui::RasterSymbolizerWidgetForm > m_ui
Widget form.
te::se::SelectedChannel * m_scBlue
SE Selected Channel element for red band.
A widget used to configure a Raster Symbolizer SE element.
te::se::RasterSymbolizer * getRasterSymbolizer()
A widget to control the display of a set of layers.
Definition: MapDisplay.h:71
te::se::SelectedChannel * m_scMono
SE Selected Channel element for red band.
te::se::SelectedChannel * m_scRed
SE Selected Channel element for red band.
double m_offsetValue
Value used to define the offset value.
double m_offsetOriginalValue
Value used to define the offset value.
te::se::ContrastEnhancement * m_contrastMono
SE Contrast element for mono band.
This class is used to define a component for viewing overlaid layers.
te::se::SelectedChannel * m_scGreen
SE Selected Channel element for red band.
te::map::RasterContrast * m_contrast
Raster Contrast element.
URI C++ Library.
te::se::ChannelSelection * m_cs
SE Channel Selection element.
ContrastEnhancement defines the &#39;stretching&#39; of contrast for a channel of a false-color image or for ...
double m_gainOriginalValue
Value used to define the gain value.
The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos...
te::qt::widgets::HorizontalSliderWidget * m_sliderWidget
Slider widget used for opacity information.
te::se::ContrastEnhancement * m_contrastGreen
SE Contrast element for green band.
This class contains the parameters needed to apply dynamic contrast over a raster.
te::se::ContrastEnhancement * m_contrastRed
SE Contrast element for red band.
te::qt::widgets::RasterHistogramWidget * m_histogramWidget
Histogram widget.
std::map< te::rp::Contrast::InputParameters::ContrastType, te::map::RasterTransform::ContrastType > m_contrastMap
Contrast Types Names.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
double m_gainValue
Value used to define the gain value.
te::se::RasterSymbolizer * m_symbolizer
SE Raster Symbolizer element.
ChannelSelection specifies the false-color channel selection for a multi-spectral raster source (such...