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 "../../../qt/widgets/canvas/MapDisplay.h"
36 #include "../Config.h"
37 #include "OutputRasterWidget.h"
38 
39 // STL
40 #include <memory>
41 
42 // Qt
43 #include <qcombobox.h>
44 #include <QDialog>
45 #include <QActionGroup>
46 
47 // Forward declaration
48 namespace Ui { class ContrastDialogForm; }
49 
50 namespace te
51 {
52  namespace qt
53  {
54  namespace af
55  {
56  namespace evt
57  {
58  struct Event;
59  }
60  }
61 
62  namespace widgets
63  {
64  class RasterHistogramWidget;
65  class RasterNavigatorWidget;
66 
67  /*!
68  \class ContrastDialogForm
69 
70  \brief This class is GUI used to define the contrast parameters for the RP constast operation.
71  */
72  class TEQTWIDGETSEXPORT ContrastDialogForm : public QDialog
73  {
74  Q_OBJECT
75 
76  public:
77 
78  ContrastDialogForm(QWidget* parent = 0);
79 
81 
82  public:
83 
84  void resetWindow(te::map::AbstractLayerPtr layer);
85 
86  /*!
87  \brief This method is used to set the selected layer for contrast operation
88 
89  \param layer The layer ptr
90 
91  \note This layer MUST HAVE a valid raster object.
92  */
93  void set(te::map::AbstractLayerPtr layer);
94 
95  void setConfigurations();
96 
97  void setMapDisplay(te::qt::widgets::MapDisplay* mapDisplay);
98 
99  void setActionGroup(QActionGroup* actionGroup);
100 
102 
103  te::rp::Contrast::InputParameters getInputParams();
104 
105  te::map::AbstractLayerPtr getOutputLayer();
106 
107  protected:
108 
109  void fillContrastTypes();
110 
111  void listBands();
112 
113  void applyPreview();
114 
115  void drawPreview(te::rst::Raster* raster);
116 
117  void drawGeom();
118 
119  void getRasterFromROI();
120 
121  bool execute();
122 
123  void clearCanvas();
124 
125  void closeEvent(QCloseEvent* e);
126 
127  protected slots:
128 
129  void onAllImageRadioButtonToggled(bool isChecked);
130 
131  void onContrastTypeComboBoxActivated(int index);
132 
133  void onCellClicked(int row, int column);
134 
135  void onCellDoubleClicked(int row, int column);
136 
137  void onCellChanged(int row, int column);
138 
139  void onMinValueSelected(int value, int band);
140 
141  void onMinValueSelected(double value, int band);
142 
143  void onMaxValueSelected(int value, int band);
144 
145  void onMaxValueSelected(double value, int band);
146 
147  void onOkPushButtonClicked();
148 
149  void onPreviewCheckBoxToggled(bool isChecked);
150 
151  void onRoiRadioButtonToggled(bool isChecked);
152 
153  void onVisibleAreaRadioButtonToggled(bool isChecked);
154 
155  void drawHistogram();
156 
157  void onApplicationTriggered(te::qt::af::evt::Event* e);
158 
159  void onMapDisplayExtentChanged();
160 
161  void onEnvelopeAcquired(te::gm::Envelope env);
162 
163  void onBandChecked();
164 
165  signals:
166 
167  void addLayer(te::map::AbstractLayerPtr layer);
168 
169  void closeTool();
170 
171  private:
172 
173  std::unique_ptr<Ui::ContrastDialogForm> m_ui;
174  std::unique_ptr<te::qt::widgets::RpToolsWidget> m_navigator;
175  std::unique_ptr<te::qt::widgets::RasterHistogramWidget> m_histogramWidget;
176 
180 
181  std::unique_ptr<te::rst::Raster> m_raster;
182  std::unique_ptr<te::gm::Geometry> m_geom;
183 
184  std::vector<double> m_minValue;
185  std::vector<double> m_maxValue;
187  std::string m_lastText;
188 
192  };
193 
194  } // end namespace widgets
195  } // end namespace qt
196 } // end namespace te
197 
198 #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
std::unique_ptr< te::gm::Geometry > m_geom
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
std::unique_ptr< te::rst::Raster > m_raster
URI C++ Library.
This class is used to set output layer.
This class is GUI used to define the contrast parameters for the RP constast operation.
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
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
std::unique_ptr< te::qt::widgets::RpToolsWidget > m_navigator
std::unique_ptr< Ui::ContrastDialogForm > m_ui