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 #include "../../../qt/widgets/rp/RpToolsWidget.h"
36 #include "../se/PolygonSymbolizerWidget.h"
37 #endif
38 
39 // STL
40 #include <memory>
41 
42 // Qt
43 #include <QDialog>
44 
45 namespace Ui { class CloudDetectionDialogForm; }
46 
47 namespace te
48 {
49  //forward declarations
50  namespace da { class DataSetType; }
51  namespace gm { class Envelope; }
52  namespace mem { class DataSet; }
53 
54  namespace qt
55  {
56  namespace widgets
57  {
58  class Canvas;
59  class MapDisplay;
60  class RasterHistogramWidget;
61 
62  /*!
63  \class CloudDetectionDialog
64 
65  \brief ....
66  */
67  class TEQTWIDGETSEXPORT CloudDetectionDialog : public QDialog
68  {
69  Q_OBJECT
70 
71  public:
72 
73  CloudDetectionDialog(QWidget* parent = 0, Qt::WindowFlags f = 0);
74 
76 
77  void setLayers(std::list<te::map::AbstractLayerPtr> layers);
78 
79  void setMapDisplay(te::qt::widgets::MapDisplay* mapDisplay);
80 
81  void setActionGroup(QActionGroup* actionGroup);
82 
83  protected slots:
84 
85  void onCloudLayerComboBoxActivated(int index);
86 
87  void onShadowLayerComboBoxActivated(int index);
88 
89  void onCloudBandComboBoxActivated(int index);
90 
91  void onShadowBandComboBoxActivated(int index);
92 
93  void onSearchCloudLayerToolButtonClicked();
94 
95  void onSearchShadowLayerToolButtonClicked();
96 
97  void onUpToolButtonClicked();
98 
99  void onDownToolButtonClicked();
100 
101  void onPreviewCheckBoxToggled(bool isChecked);
102 
103  void onCellClicked(int row, int column);
104 
105  void onCellDoubleClicked(int row, int column);
106 
107  void onCellChanged(int row, int column);
108 
109  void onFilterCellClicked(int row, int column);
110 
111  void onFilterCellDoubleClicked(int row, int column);
112 
113  void onFilterCellChanged(int row, int column);
114 
115  void onTargetDatasourceToolButtonClicked();
116 
117  void onTargetFileToolButtonClicked();
118 
119  void onEnvelopeAcquired(te::gm::Envelope env);
120 
121  void onMapDisplayExtentChanged();
122 
123  void onOkPushButtonClicked();
124 
125  void onStyleToolButtonClicked();
126 
127  signals:
128 
129  void addLayer(te::map::AbstractLayerPtr layer);
130 
131  void closeTool();
132 
133  protected:
134 
135  bool execute();
136 
137  bool vectorize(te::rst::Raster* raster, std::vector<te::gm::Geometry*>& geomVec, std::vector< double >& geomsValues);
138 
139  void setCloudBands();
140 
141  void setShadowBands();
142 
143  void setCloudMinMax();
144 
145  void setShadowMinMax();
146 
147  void drawHistogram();
148 
149  void applyPreview();
150 
151  void drawGeom();
152 
153  void getRasterFromROI();
154 
155  /*! Function used to create the output dataset type */
156  std::unique_ptr<te::da::DataSetType> createDataSetType(std::string dataSetName, int srid);
157 
158  /*! Function used to create the output data */
159  std::unique_ptr<te::mem::DataSet> createDataSet(te::da::DataSetType* dsType, std::vector<te::gm::Geometry*>& geoms, std::vector< double >& geomsValues);
160 
161  /*! Function used to save the output dataset */
162  void saveDataSet(te::mem::DataSet* dataSet, te::da::DataSetType* dsType, te::da::DataSourcePtr ds, std::string dataSetName);
163 
164  void clearCanvas();
165 
166  void closeEvent(QCloseEvent* e);
167 
168  private:
169 
170  std::unique_ptr<Ui::CloudDetectionDialogForm> m_ui;
171 
172  std::unique_ptr<te::qt::widgets::RasterHistogramWidget> m_histogramWidget;
173 
174  std::unique_ptr<te::qt::widgets::RpToolsWidget> m_navigator;
175 
176  std::list<te::map::AbstractLayerPtr> m_layers;
180 
181  std::unique_ptr<te::rst::Raster> m_cloudRaster;
182  std::unique_ptr<te::rst::Raster> m_shadowRaster;
183  std::unique_ptr<te::rst::Raster> m_cloudRasterPreview;
184  std::unique_ptr<te::rst::Raster> m_shadowRasterPreview;
185 
186  std::unique_ptr<te::gm::Geometry> m_geom;
188 
189  std::string m_lastText;
190  std::vector<double> m_cloudMinValue;
191  std::vector<double> m_cloudMaxValue;
192  std::vector<double> m_shadowMinValue;
193  std::vector<double> m_shadowMaxValue;
195 
196  std::unique_ptr<te::qt::widgets::PolygonSymbolizerWidget> m_polygonSymbolizerWidget;
198 
199  };
200  } // end namespace widgets
201  } // end namespace qt
202 } // end namespace te
203 
204 #endif // __TERRALIB_QT_PLUGINS_RP_INTERNAL_CLOUDDETECTIONDIALOG_H
205 
#define slots
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1440
A class that models the description of a dataset.
Definition: DataSetType.h:72
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:80
te::qt::widgets::MapDisplay * m_mapDisplay
std::unique_ptr< te::gm::Geometry > m_geom
std::unique_ptr< te::qt::widgets::RpToolsWidget > m_navigator
A widget to control the display of a set of layers.
Definition: MapDisplay.h:71
std::unique_ptr< te::qt::widgets::PolygonSymbolizerWidget > m_polygonSymbolizerWidget
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
Definition: DataSet.h:65
std::unique_ptr< te::rst::Raster > m_shadowRaster
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.
std::unique_ptr< te::rst::Raster > m_cloudRasterPreview
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
std::unique_ptr< te::rst::Raster > m_shadowRasterPreview
std::unique_ptr< Ui::CloudDetectionDialogForm > m_ui
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
std::unique_ptr< te::rst::Raster > m_cloudRaster
std::unique_ptr< te::qt::widgets::RasterHistogramWidget > m_histogramWidget