ContrastDialogForm.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/rp/ContrastDialogForm.h
22 
23  \brief This file defines a class for a Contrast dialog.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_RP_INTERNAL_CONTRASTDIALOGFORM_H
27 #define __TERRALIB_QT_WIDGETS_RP_INTERNAL_CONTRASTDIALOGFORM_H
28 
29 // TerraLib
30 #ifndef Q_MOC_RUN
31 #include "../../../maptools/AbstractLayer.h"
32 #include "../../../qt/widgets/rp/RpToolsWidget.h"
33 #endif
34 #include "../../../rp/Contrast.h"
35 #include "../../../se/ChannelSelection.h"
36 #include "../../../qt/widgets/canvas/MapDisplay.h"
37 #include "../Config.h"
38 #include "OutputRasterWidget.h"
39 
40 // STL
41 #include <memory>
42 
43 // Qt
44 #include <qcombobox.h>
45 #include <QDialog>
46 #include <QActionGroup>
47 
48 // Forward declaration
49 namespace Ui { class ContrastDialogForm; }
50 
51 namespace te
52 {
53  namespace qt
54  {
55  namespace af
56  {
57  namespace evt
58  {
59  struct Event;
60  }
61  }
62 
63  namespace widgets
64  {
65  class RasterHistogramWidget;
66  class RasterNavigatorWidget;
67 
68  /*!
69  \class ContrastDialogForm
70 
71  \brief This class is GUI used to define the contrast parameters for the RP constast operation.
72  */
73  class TEQTWIDGETSEXPORT ContrastDialogForm : public QDialog
74  {
75  Q_OBJECT
76 
77  public:
78 
79  ContrastDialogForm(QWidget* parent = 0);
80 
82 
83  public:
84 
85  void resetWindow(te::map::AbstractLayerPtr layer);
86 
87  /*!
88  \brief This method is used to set the selected layer for contrast operation
89 
90  \param layer The layer ptr
91 
92  \note This layer MUST HAVE a valid raster object.
93  */
94  void set(te::map::AbstractLayerPtr layer);
95 
96  void setConfigurations();
97 
98  void setMapDisplay(te::qt::widgets::MapDisplay* mapDisplay);
99 
100  void setActionGroup(QActionGroup* actionGroup);
101 
103 
104  te::rp::Contrast::InputParameters getInputParams();
105 
106  te::rp::Contrast::OutputParameters getOutputParams();
107 
108  te::map::AbstractLayerPtr getOutputLayer();
109 
110  protected:
111 
112  void fillContrastTypes();
113 
114  te::se::ChannelSelection* getChannelSelection();
115 
116  void listBands();
117 
118  void applyPreview();
119 
120  void drawPreview(te::rst::Raster* raster);
121 
122  void drawGeom();
123 
124  void getRasterFromROI();
125 
126  bool execute();
127 
128  void clearCanvas();
129 
130  void closeEvent(QCloseEvent* e);
131 
132  protected slots:
133 
134  void onAllImageRadioButtonToggled(bool isChecked);
135 
136  void onBlueComboBoxCurrentIndexChanged(int index);
137 
138  void onContrastTypeComboBoxActivated(int index);
139 
140  void onCellClicked(int row, int column);
141 
142  void onCellDoubleClicked(int row, int column);
143 
144  void onCellChanged(int row, int column);
145 
146  void onGreenComboBoxCurrentIndexChanged(int index);
147 
148  void onMinValueSelected(int value, int band);
149 
150  void onMinValueSelected(double value, int band);
151 
152  void onMaxValueSelected(int value, int band);
153 
154  void onMaxValueSelected(double value, int band);
155 
156  void onMonoComboBoxCurrentIndexChanged(int index);
157 
158  void onHistogramCheckBoxToggled(bool isChecked);
159 
160  void onOkPushButtonClicked();
161 
162  void onPreviewCheckBoxToggled(bool isChecked);
163 
164  void onRedComboBoxCurrentIndexChanged(int index);
165 
166  void onRoiRadioButtonToggled(bool isChecked);
167 
168  void onVisibleAreaRadioButtonToggled(bool isChecked);
169 
170  void drawHistogram();
171 
172  void onApplicationTriggered(te::qt::af::evt::Event* e);
173 
174  void onMapDisplayExtentChanged();
175 
176  void onEnvelopeAcquired(te::gm::Envelope env);
177 
178  signals:
179 
180  void geomAquired(te::gm::Polygon* poly);
181 
182  void addLayer(te::map::AbstractLayerPtr layer);
183 
184  void closeTool();
185 
186  private:
187 
188  std::unique_ptr<Ui::ContrastDialogForm> m_ui;
189  std::unique_ptr<te::qt::widgets::RpToolsWidget> m_navigator;
190  std::unique_ptr<te::qt::widgets::RasterHistogramWidget> m_histogramWidget;
191 
201  std::vector<double> m_minValue;
202  std::vector<double> m_maxValue;
204  std::string m_lastText;
207 
208  QComboBox* m_monoComboBox;
209  QComboBox* m_redComboBox;
210  QComboBox* m_greenComboBox;
211  QComboBox* m_blueComboBox;
212  };
213 
214  } // end namespace widgets
215  } // end namespace qt
216 } // end namespace te
217 
218 #endif // __TERRALIB_QT_WIDGETS_RP_INTERNAL_CONTRASTDIALOGFORM_H
te::qt::widgets::MapDisplay * m_mapDisplay
te::qt::widgets::OutputRasterWidget * m_outputWidget
te::map::AbstractLayerPtr m_outputLayer
A base class for application events.
Definition: Event.h:59
A widget to control the display of a set of layers.
Definition: MapDisplay.h:69
Contrast input parameters.
Definition: Contrast.h:65
This file has the OutputRasterWidget class.
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
An abstract class for raster data strucutures.
Definition: Raster.h:71
URI C++ Library.
This class is used to set output layer.
te::se::ChannelSelection * m_channelSelect
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:74
This class is GUI used to define the contrast parameters for the RP constast operation.
A canvas built on top of Qt.
Definition: Canvas.h:54
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
std::unique_ptr< te::qt::widgets::RasterHistogramWidget > m_histogramWidget
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
Contrast output parameters.
Definition: Contrast.h:188
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
te::qt::widgets::Canvas * m_canvas
std::unique_ptr< te::qt::widgets::RpToolsWidget > m_navigator
std::unique_ptr< Ui::ContrastDialogForm > m_ui
ChannelSelection specifies the false-color channel selection for a multi-spectral raster source (such...