CloudDetectionDialog.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/CloudDetectionDialog.h
22 
23  \brief ....
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_RP_INTERNAL_CLOUDDETECTIONDIALOG_H
27 #define __TERRALIB_QT_WIDGETS_RP_INTERNAL_CLOUDDETECTIONDIALOG_H
28 
29 // TerraLib
30 #include "../Config.h"
31 #ifndef Q_MOC_RUN
32 #include "../../../dataaccess/datasource/DataSource.h"
33 #include "../../../dataaccess/datasource/DataSourceInfo.h"
34 #include "../../../maptools/AbstractLayer.h"
35 #endif
36 
37 // STL
38 #include <memory>
39 
40 // Qt
41 #include <QDialog>
42 
43 namespace Ui { class CloudDetectionDialogForm; }
44 
45 namespace te
46 {
47  //forward declarations
48  namespace da { class DataSetType; }
49  namespace gm { class Envelope; }
50  namespace mem { class DataSet; }
51 
52  namespace qt
53  {
54  namespace widgets
55  {
56  class Canvas;
57  class MapDisplay;
58  class RasterHistogramWidget;
59 
60  /*!
61  \class CloudDetectionDialog
62 
63  \brief ....
64  */
65  class TEQTWIDGETSEXPORT CloudDetectionDialog : public QDialog
66  {
67  Q_OBJECT
68 
69  public:
70 
71  CloudDetectionDialog(QWidget* parent = 0, Qt::WindowFlags f = 0);
72 
74 
75  void setLayers(std::list<te::map::AbstractLayerPtr> layers);
76 
77  void setMapDisplay(te::qt::widgets::MapDisplay* mapDisplay);
78 
79 
80  protected slots:
81 
82  void onCloudLayerComboBoxActivated(int index);
83 
84  void onShadowLayerComboBoxActivated(int index);
85 
86  void onCloudBandComboBoxActivated(int index);
87 
88  void onShadowBandComboBoxActivated(int index);
89 
90  void onSearchCloudLayerToolButtonClicked();
91 
92  void onSearchShadowLayerToolButtonClicked();
93 
94  void onUpToolButtonClicked();
95 
96  void onDownToolButtonClicked();
97 
98  void onPreviewCheckBoxToggled(bool isChecked);
99 
100  void onNewROIPushButtonClicked();
101 
102  void onCellClicked(int row, int column);
103 
104  void onCellDoubleClicked(int row, int column);
105 
106  void onCellChanged(int row, int column);
107 
108  void onFilterCellClicked(int row, int column);
109 
110  void onFilterCellDoubleClicked(int row, int column);
111 
112  void onFilterCellChanged(int row, int column);
113 
114  void onTargetDatasourceToolButtonClicked();
115 
116  void onTargetFileToolButtonClicked();
117 
118  void onEnvelopeAcquired(te::gm::Envelope env);
119 
120  void onOkPushButtonClicked();
121 
122  signals:
123 
124  void addLayer(te::map::AbstractLayerPtr layer);
125 
126  void closeTool();
127 
128  protected:
129 
130  bool execute();
131 
132  bool vectorize(te::rst::Raster* raster, std::vector<te::gm::Geometry*>& geomVec, std::vector< double >& geomsValues);
133 
134  void setCloudBands();
135 
136  void setShadowBands();
137 
138  void setCloudMinMax();
139 
140  void setShadowMinMax();
141 
142  void drawHistogram();
143 
144  void applyPreview();
145 
146  void getRasterFromROI();
147 
148  /*! Function used to create the output dataset type */
149  std::auto_ptr<te::da::DataSetType> createDataSetType(std::string dataSetName, int srid);
150 
151  /*! Function used to create the output data */
152  std::auto_ptr<te::mem::DataSet> createDataSet(te::da::DataSetType* dsType, std::vector<te::gm::Geometry*>& geoms, std::vector< double >& geomsValues);
153 
154  /*! Function used to save the output dataset */
155  void saveDataSet(te::mem::DataSet* dataSet, te::da::DataSetType* dsType, te::da::DataSourcePtr ds, std::string dataSetName);
156 
157  void closeEvent(QCloseEvent* e);
158 
159  private:
160 
162  std::string m_outputDataSetName;
163 
164  std::auto_ptr<Ui::CloudDetectionDialogForm> m_ui;
165  std::unique_ptr<te::qt::widgets::RasterHistogramWidget> m_histogramWidget;
166 
167  std::list<te::map::AbstractLayerPtr> m_layers;
178  std::string m_lastText;
179  std::vector<double> m_cloudMinValue;
180  std::vector<double> m_cloudMaxValue;
181  std::vector<double> m_shadowMinValue;
182  std::vector<double> m_shadowMaxValue;
184 
185  };
186  } // end namespace widgets
187  } // end namespace qt
188 } // end namespace te
189 
190 #endif // __TERRALIB_QT_PLUGINS_RP_INTERNAL_CLOUDDETECTIONDIALOG_H
191 
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1438
A class that models the description of a dataset.
Definition: DataSetType.h:72
te::qt::widgets::MapDisplay * m_mapDisplay
A widget to control the display of a set of layers.
Definition: MapDisplay.h:69
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
Definition: DataSet.h:65
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
An abstract class for raster data strucutures.
Definition: Raster.h:71
std::list< te::map::AbstractLayerPtr > m_layers
URI C++ Library.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:74
A canvas built on top of Qt.
Definition: Canvas.h:54
#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::auto_ptr< Ui::CloudDetectionDialogForm > m_ui
std::unique_ptr< te::qt::widgets::RasterHistogramWidget > m_histogramWidget
te::da::DataSourceInfoPtr m_outDataSourceInfo
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr