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 #ifndef Q_MOC_RUN
31 #include "../../../maptools/AbstractLayer.h"
32 #include "../../../maptools/RasterTransform.h"
33 #include "../../../rp/Contrast.h"
34 #include "../../../se.h"
35 #endif
36 #include "../Config.h"
37 
38 // Qt
39 #include <QWidget>
40 #include <QComboBox>
41 
42 // STL
43 #include <memory>
44 #include <string>
45 #include <vector>
46 #include <map>
47 
48 // Forward declaraion
49 namespace Ui { class RasterSymbolizerWidgetForm; }
50 
51 namespace te
52 {
53  // Forward declarations
54  namespace map
55  {
56  class RasterContrast;
57  }
58 
59  namespace se
60  {
61  class ContrastEnhancement;
62  class RasterSymbolizer;
63  class Symbolizer;
64  }
65 
66  namespace rst
67  {
68  class BandProperty;
69  }
70 
71 // Forward declarations
72  namespace qt
73  {
74  namespace widgets
75  {
76  // Forward declarations
77  class MapDisplay;
78  class HorizontalSliderWidget;
79  class RasterHistogramWidget;
80 
81  /*!
82  \class RasterSymbolizerWidget
83 
84  \brief A widget used to configure a Raster Symbolizer SE element.
85  */
87  {
88  Q_OBJECT
89 
90  public:
91 
92  /** @name Initializer Methods
93  * Methods related to instantiation and destruction.
94  */
95  //@{
96 
97  /*! \brief Constructs a RasterSymbolizerWidget dialog which is a child of parent, with widget flags set to f. */
98  RasterSymbolizerWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
99 
100  /*! \brief Destructor. */
102 
103  //@}
104 
105  //!< We never change the received pointer. We copy it
106  void setRasterSymbolizer(const te::se::RasterSymbolizer* rs);
107 
108  //!< The caller will be the owner of the returner pointer
109  te::se::RasterSymbolizer* getRasterSymbolizer();
110 
111  void setRasterContrast(te::map::RasterContrast* contrast);
112 
113  te::map::RasterContrast* getRasterContrast();
114 
115  void setLayer(te::map::AbstractLayer* layer);
116 
117  void setBandProperty(std::vector<te::rst::BandProperty*> bp);
118 
119  void setMapDisplay(te::qt::widgets::MapDisplay* display);
120 
121  protected:
122 
123  /*! \brief Internal method to initialize the widget (e.g.: color, combos, icons, etc.) */
124  void initialize();
125 
126  /*! \brief Updates the widget form based on internal mark element. */
127  void updateUi();
128 
129  void setComboBoxText(QComboBox* cb, std::string value);
130 
131  protected slots:
132 
133  void onOpacityChanged(int value);
134 
135  void onMonoChannelSelectionClicked();
136  void onRedChannelSelectionClicked();
137  void onGreenChannelSelectionClicked();
138  void onBlueChannelSelectionClicked();
139  void onCompositionChannelSelectionClicked();
140 
141  void onMonoChannelNameChanged(QString s);
142  void onRedChannelNameChanged(QString s);
143  void onGreenChannelNameChanged(QString s);
144  void onBlueChannelNameChanged(QString s);
145 
146  void onTypeConstratChanged(QString s);
147 
148  void onMonoGammaChanged(int v);
149  void onRedGammaChanged(int v);
150  void onGreenGammaChanged(int v);
151  void onBlueGammaChanged(int v);
152 
153  void onIncreaseGain();
154  void onDecreaseGain();
155  void onDefaultGain();
156  void onIncreaseOffset();
157  void onDecreaseOffset();
158  void onDefaultOffset();
159  void onSymbolizerChanged();
160 
161  void onDummyPushButtonClicked();
162 
163  void setContrastVisibility();
164 
165  //contrast slots
166 
167  void onHistogramToolButtonClicked();
168 
169  void onMinValueSelected(int value, int band);
170 
171  void onMaxValueSelected(int value, int band);
172 
173  void onMinValueSelected(double value, int band);
174 
175  void onMaxValueSelected(double value, int band);
176 
177  void onResetToolButtonClicked();
178 
179  void onApplyToolButtonClicked();
180 
181  void onCalcRasterSummaryClicked();
182 
183  void onResetRasterSummaryTableClicked();
184 
185  void onMinimumValueChanged();
186 
187  void onMaximumValueChanged();
188 
189  signals:
190 
191  void symbolizerChanged();
192 
193  void contrastChanged(bool remove);
194 
195  void mapRefresh();
196 
197  private:
198 
199  std::unique_ptr<Ui::RasterSymbolizerWidgetForm> m_ui; //!< Widget form.
200  te::qt::widgets::HorizontalSliderWidget* m_sliderWidget; //!< Slider widget used for opacity information.
202 
204 
205  te::se::RasterSymbolizer* m_symbolizer; //!< SE Raster Symbolizer element.
206  te::map::RasterContrast* m_contrast; //!< Raster Contrast element.
207 
209 
210  te::se::ContrastEnhancement* m_contrastRed; //!< SE Contrast element for red band.
211  te::se::ContrastEnhancement* m_contrastGreen; //!< SE Contrast element for green band.
212  te::se::ContrastEnhancement* m_contrastBlue; //!< SE Contrast element for blue band.
213  te::se::ContrastEnhancement* m_contrastMono; //!< SE Contrast element for mono band.
214 
215  te::se::SelectedChannel* m_scRed; //!< SE Selected Channel element for red band.
216  te::se::SelectedChannel* m_scGreen; //!< SE Selected Channel element for red band.
217  te::se::SelectedChannel* m_scBlue; //!< SE Selected Channel element for red band.
218  te::se::SelectedChannel* m_scMono; //!< SE Selected Channel element for red band.
219 
220  te::se::ChannelSelection* m_cs; //!< SE Channel Selection element.
221 
222  std::map<te::se::ContrastEnhancement::ContrastEnhancementType, QString> m_ceNames; //!< Contrast Types Names
223  std::map<te::rp::Contrast::InputParameters::ContrastType, te::map::RasterTransform::ContrastType> m_contrastMap; //!< Contrast Types Names
224 
225  double m_gainValue; //!< Value used to define the gain value.
226  double m_offsetValue; //!< Value used to define the offset value.
227  double m_gainOriginalValue; //!< Value used to define the gain value.
228  double m_offsetOriginalValue; //!< Value used to define the offset value.
229 
230  std::vector<double> m_minValue;
231  std::vector<double> m_maxValue;
232 
234  };
235 
236  } // end namespace widgets
237  } // end namespace qt
238 } // end namespace te
239 
240 #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.
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.
TerraLib.
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...