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 "InputLayerWidget.h"
39 #include "OutputRasterWidget.h"
40 
41 // STL
42 #include <memory>
43 
44 // Qt
45 #include <qcombobox.h>
46 #include <QDialog>
47 #include <QActionGroup>
48 
49 // Forward declaration
50 namespace Ui { class ContrastDialogForm; }
51 
52 namespace te
53 {
54  namespace qt
55  {
56  namespace af
57  {
58  namespace evt
59  {
60  struct Event;
61  }
62  }
63 
64  namespace widgets
65  {
66  class RasterHistogramWidget;
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 
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 setList(std::list<te::map::AbstractLayerPtr>& layerList);
95 
97 
98  void setActionGroup(QActionGroup* actionGroup);
99 
101 
103 
105 
107 
108  protected:
109 
111 
112  void listBands();
113 
114  void applyPreview();
115 
116  // draw the internal raster preview using the stored raster in m_previewRasterPtr
118 
119  void drawGeom();
120 
121  void setDefaultValues(int contrastType);
122 
124 
126 
128 
130 
131  bool execute();
132 
133  void setDisableInterface(bool enabled);
134 
135  void clearCanvas();
136 
138 
139  void closeEvent(QCloseEvent*);
140 
142 
144 
145  /*!
146  \brief Get the current selected input band index.
147  \param bandIdx the current selected input band index.
148  \return true if at least one band is selected, false if no selected/checked bands ware found.
149  */
150  bool getSelectInputBandIdx( unsigned int& bandIdx );
151 
152  /*!
153  \brief Get the current selected output band index.
154  \param bandIdx the current selected output band index.
155  \return true if at least one band is selected, false if no selected/checked bands ware found.
156  */
157  bool getSelectOutputBandIdx( unsigned int& bandIdx );
158 
159  /*!
160  \brief Get the current checked band indexes;
161  \param bandIndexes The current checked band indexes.
162  */
163  void getCheckedInputBandIndexes( std::vector< unsigned int> & bandIndexes );
164 
165  protected slots:
166 
167  void onAllImageRadioButtonToggled(bool isChecked);
168 
170 
171  void onCellClicked(int row, int column);
172 
173  void onCellDoubleClicked(int row, int column);
174 
175  void onCellChanged(int row, int column);
176 
177  void onMinValueSelected(int value, int band);
178 
179  void onMinValueSelected(double value, int band);
180 
181  void onMaxValueSelected(int value, int band);
182 
183  void onMaxValueSelected(double value, int band);
184 
186 
187  void layerChanged();
188 
190 
191  void onRoiRadioButtonToggled(bool isChecked);
192 
193  void onVisibleAreaRadioButtonToggled(bool isChecked);
194 
196 
198 
200 
202 
204 
206 
207  signals:
208 
210 
211  void closeTool();
212 
213  private:
214 
215  std::unique_ptr<Ui::ContrastDialogForm> m_ui;
216  std::unique_ptr<te::qt::widgets::RpToolsWidget> m_navigator;
217  std::unique_ptr<te::qt::widgets::RasterHistogramWidget> m_histogramWidget;
218  std::unique_ptr<te::qt::widgets::RasterHistogramWidget> m_histogramWidget2;
219 
225 
226  std::unique_ptr<te::rst::Raster> m_raster;
227  std::unique_ptr<te::rst::Raster> m_previewRasterPtr;
228  std::unique_ptr<te::gm::Geometry> m_geom;
229 
230  std::vector<double> m_minValue;
231  std::vector<double> m_maxValue;
232  std::string m_lastText;
233  QString m_information;
234 
236  };
237 
238  } // end namespace widgets
239  } // end namespace qt
240 } // end namespace te
241 
242 #endif // __TERRALIB_QT_WIDGETS_RP_INTERNAL_CONTRASTDIALOGFORM_H
te::qt::widgets::ContrastDialogForm::m_navigator
std::unique_ptr< te::qt::widgets::RpToolsWidget > m_navigator
Definition: ContrastDialogForm.h:216
te::qt::widgets::ContrastDialogForm::ContrastDialogForm
ContrastDialogForm(QWidget *parent=0)
te::gm::Envelope
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
te::qt::widgets::ContrastDialogForm::onMaxValueSelected
void onMaxValueSelected(int value, int band)
te::qt::widgets::ContrastDialogForm::applyHistogram
void applyHistogram()
te::qt::widgets::ContrastDialogForm::onEableDisableHistoToolButtonClicked
void onEableDisableHistoToolButtonClicked(bool checked)
te::qt::widgets::ContrastDialogForm::m_outputWidget
te::qt::widgets::OutputRasterWidget * m_outputWidget
Definition: ContrastDialogForm.h:222
te::qt::widgets::ContrastDialogForm::m_histogramWidget2
std::unique_ptr< te::qt::widgets::RasterHistogramWidget > m_histogramWidget2
Definition: ContrastDialogForm.h:218
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::qt::widgets::ContrastDialogForm::onMinValueSelected
void onMinValueSelected(double value, int band)
te::qt::widgets::ContrastDialogForm::setDefaultValues
void setDefaultValues(int contrastType)
te::qt::widgets::ContrastDialogForm::m_geom
std::unique_ptr< te::gm::Geometry > m_geom
Definition: ContrastDialogForm.h:228
te::qt::widgets::ContrastDialogForm::getRasterFromROI
void getRasterFromROI()
te::qt::widgets::MapDisplay
A widget to control the display of a set of layers.
Definition: MapDisplay.h:72
te::map::AbstractLayerPtr
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
Definition: AbstractLayer.h:626
te::qt::widgets::ContrastDialogForm::onContrastTypeComboBoxActivated
void onContrastTypeComboBoxActivated(int index)
te::qt::widgets::ContrastDialogForm::~ContrastDialogForm
~ContrastDialogForm()
te::qt::widgets::ContrastDialogForm::fillContrastTypes
void fillContrastTypes()
te::qt::widgets::ContrastDialogForm::m_previewRasterPtr
std::unique_ptr< te::rst::Raster > m_previewRasterPtr
Definition: ContrastDialogForm.h:227
te::qt::widgets::ContrastDialogForm::onResetValuesToolButtonClicked
void onResetValuesToolButtonClicked()
te::qt::widgets::ContrastDialogForm::setMapDisplay
void setMapDisplay(te::qt::widgets::MapDisplay *mapDisplay)
te::qt::widgets::ContrastDialogForm::m_mapDisplay
te::qt::widgets::MapDisplay * m_mapDisplay
Definition: ContrastDialogForm.h:224
te::qt::widgets::ContrastDialogForm::closeEvent
void closeEvent(QCloseEvent *)
te::qt::widgets::ContrastDialogForm::onInfoToolButtonClicked
void onInfoToolButtonClicked()
te::qt::widgets::ContrastDialogForm::m_outputLayer
te::map::AbstractLayerPtr m_outputLayer
Definition: ContrastDialogForm.h:223
te::qt::widgets::ContrastDialogForm::drawInputHistogram
void drawInputHistogram()
OutputRasterWidget.h
This file has the OutputRasterWidget class.
te::qt::widgets::ContrastDialogForm::onAllImageRadioButtonToggled
void onAllImageRadioButtonToggled(bool isChecked)
te::qt::widgets::ContrastDialogForm::setDisableInterface
void setDisableInterface(bool enabled)
TEQTWIDGETSEXPORT
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
te::qt::widgets::ContrastDialogForm::m_lastText
std::string m_lastText
Definition: ContrastDialogForm.h:232
te::qt::widgets::ContrastDialogForm::onApplyPreviewClicked
void onApplyPreviewClicked()
te::qt::widgets::ContrastDialogForm::onCellClicked
void onCellClicked(int row, int column)
te::qt::widgets::ContrastDialogForm::closeTool
void closeTool()
te::qt::widgets::ContrastDialogForm::onMapDisplayExtentChanged
void onMapDisplayExtentChanged()
te::qt::widgets::ContrastDialogForm::onEnvelopeAcquired
void onEnvelopeAcquired(te::gm::Envelope env)
te::rp::Contrast::InputParameters
Contrast input parameters.
Definition: Contrast.h:66
te::qt::widgets::InputLayerWidget
This class is used to set input layer.
Definition: InputLayerWidget.h:57
te::qt::widgets::ContrastDialogForm::getInputParams
te::rp::Contrast::InputParameters getInputParams()
te::qt::widgets::ContrastDialogForm::drawPreviewRaster
void drawPreviewRaster()
te::se::ChannelSelection
ChannelSelection specifies the false-color channel selection for a multi-spectral raster source (such...
Definition: ChannelSelection.h:63
te::qt::widgets::ContrastDialogForm::m_minValue
std::vector< double > m_minValue
Definition: ContrastDialogForm.h:230
Ui
Definition: ConfigInputAddressDialog.h:44
te::qt::widgets::ContrastDialogForm::listBands
void listBands()
te::qt::widgets::ContrastDialogForm::m_maxValue
std::vector< double > m_maxValue
Definition: ContrastDialogForm.h:231
te::qt::widgets::ContrastDialogForm::getSelectInputBandIdx
bool getSelectInputBandIdx(unsigned int &bandIdx)
Get the current selected input band index.
te::qt::widgets::ContrastDialogForm::m_layer
te::map::AbstractLayerPtr m_layer
Definition: ContrastDialogForm.h:220
te::qt::af::evt::Event
A base class for application events.
Definition: Event.h:60
te::qt::widgets::ContrastDialogForm::getOutputLayer
te::map::AbstractLayerPtr getOutputLayer()
te::qt::widgets::ContrastDialogForm::addLayer
void addLayer(te::map::AbstractLayerPtr layer)
slots
#define slots
Definition: VirtualMachine.h:48
te::qt::widgets::ContrastDialogForm::m_histogramWidget
std::unique_ptr< te::qt::widgets::RasterHistogramWidget > m_histogramWidget
Definition: ContrastDialogForm.h:217
te::qt::widgets::ContrastDialogForm::drawOutputHistogram
void drawOutputHistogram()
te::qt::widgets::ContrastDialogForm::applyPreview
void applyPreview()
te::qt::widgets::ContrastDialogForm::m_raster
std::unique_ptr< te::rst::Raster > m_raster
Definition: ContrastDialogForm.h:226
te::qt::widgets::ContrastDialogForm::setList
void setList(std::list< te::map::AbstractLayerPtr > &layerList)
This method is used to set the selected layer for contrast operation.
te::qt::widgets::ContrastDialogForm::onCellChanged
void onCellChanged(int row, int column)
te::qt::widgets::ContrastDialogForm::onRoiRadioButtonToggled
void onRoiRadioButtonToggled(bool isChecked)
te::qt::widgets::ContrastDialogForm::resetOutputHistogram
void resetOutputHistogram()
te::qt::widgets::ContrastDialogForm::onCellDoubleClicked
void onCellDoubleClicked(int row, int column)
te::qt::widgets::ContrastDialogForm::onMinValueSelected
void onMinValueSelected(int value, int band)
te::qt::widgets::ContrastDialogForm::resetInputHistogram
void resetInputHistogram()
te::qt::widgets::ContrastDialogForm
This class is GUI used to define the contrast parameters for the RP constast operation.
Definition: ContrastDialogForm.h:74
te::qt::widgets::ContrastDialogForm::getCheckedInputBandIndexes
void getCheckedInputBandIndexes(std::vector< unsigned int > &bandIndexes)
Get the current checked band indexes;.
te::qt::widgets::ContrastDialogForm::setActionGroup
void setActionGroup(QActionGroup *actionGroup)
te::qt::widgets::ContrastDialogForm::get
te::map::AbstractLayerPtr get()
te::qt::widgets::ContrastDialogForm::getSelectOutputBandIdx
bool getSelectOutputBandIdx(unsigned int &bandIdx)
Get the current selected output band index.
te::qt::widgets::ContrastDialogForm::drawGeom
void drawGeom()
te::qt::widgets::ContrastDialogForm::m_updatePreview
bool m_updatePreview
Definition: ContrastDialogForm.h:235
te::qt::widgets::ContrastDialogForm::clearCanvas
void clearCanvas()
te::qt::widgets::ContrastDialogForm::onOkPushButtonClicked
void onOkPushButtonClicked()
te::qt::widgets::OutputRasterWidget
This class is used to set output layer.
Definition: OutputRasterWidget.h:57
te::qt::widgets::ContrastDialogForm::m_inputWidget
te::qt::widgets::InputLayerWidget * m_inputWidget
Definition: ContrastDialogForm.h:221
te::qt::widgets::ContrastDialogForm::onMaxValueSelected
void onMaxValueSelected(double value, int band)
te::qt::widgets::ContrastDialogForm::resetWindow
void resetWindow(te::map::AbstractLayerPtr layer)
InputLayerWidget.h
This file has the InputLayerWidget class.
te::qt::widgets::ContrastDialogForm::m_information
QString m_information
Definition: ContrastDialogForm.h:233
te::qt::widgets::ContrastDialogForm::m_ui
std::unique_ptr< Ui::ContrastDialogForm > m_ui
Definition: ContrastDialogForm.h:215
te::qt::widgets::ContrastDialogForm::onVisibleAreaRadioButtonToggled
void onVisibleAreaRadioButtonToggled(bool isChecked)
te::qt::widgets::ContrastDialogForm::layerChanged
void layerChanged()
te::qt::widgets::ContrastDialogForm::execute
bool execute()
te::qt::widgets::ContrastDialogForm::getChannelSelection
te::se::ChannelSelection * getChannelSelection()
te::qt::widgets::ContrastDialogForm::onApplicationTriggered
void onApplicationTriggered(te::qt::af::evt::Event *e)
te::qt::widgets::ContrastDialogForm::onBandChecked
void onBandChecked()