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  void setUserPath(std::string path);
84 
85  protected slots:
86 
87  void onCloudLayerComboBoxActivated(int index);
88 
89  void onShadowLayerComboBoxActivated(int index);
90 
91  void onCloudBandComboBoxActivated(int index);
92 
93  void onShadowBandComboBoxActivated(int index);
94 
95  void onSearchCloudLayerToolButtonClicked();
96 
97  void onSearchShadowLayerToolButtonClicked();
98 
99  void onUpToolButtonClicked();
100 
101  void onDownToolButtonClicked();
102 
103  void onPreviewCheckBoxToggled(bool isChecked);
104 
105  void onCellClicked(int row, int column);
106 
107  void onCellDoubleClicked(int row, int column);
108 
109  void onCellChanged(int row, int column);
110 
111  void onFilterCellClicked(int row, int column);
112 
113  void onFilterCellDoubleClicked(int row, int column);
114 
115  void onFilterCellChanged(int row, int column);
116 
117  void onTargetDatasourceToolButtonClicked();
118 
119  void onTargetFileToolButtonClicked();
120 
121  void onEnvelopeAcquired(te::gm::Envelope env);
122 
123  void onMapDisplayExtentChanged();
124 
125  void onOkPushButtonClicked();
126 
127  void onStyleToolButtonClicked();
128 
129  signals:
130 
131  void addLayer(te::map::AbstractLayerPtr layer);
132 
133  void closeTool();
134 
135  protected:
136 
137  bool execute();
138 
139  bool vectorize(te::rst::Raster* raster, std::vector<te::gm::Geometry*>& geomVec, std::vector< double >& geomsValues);
140 
141  void setCloudBands();
142 
143  void setShadowBands();
144 
145  void setCloudMinMax();
146 
147  void setShadowMinMax();
148 
149  void drawHistogram();
150 
151  void applyPreview();
152 
153  void drawGeom();
154 
155  void getRasterFromROI();
156 
157  void writeStyle();
158 
159  void readStyle();
160 
161  /*! Function used to create the output dataset type */
162  std::unique_ptr<te::da::DataSetType> createDataSetType(std::string dataSetName, int srid);
163 
164  /*! Function used to create the output data */
165  std::unique_ptr<te::mem::DataSet> createDataSet(te::da::DataSetType* dsType, std::vector<te::gm::Geometry*>& geoms, std::vector< double >& geomsValues);
166 
167  /*! Function used to save the output dataset */
168  void saveDataSet(te::mem::DataSet* dataSet, te::da::DataSetType* dsType, te::da::DataSourcePtr ds, std::string dataSetName);
169 
170  void clearCanvas();
171 
172  void closeEvent(QCloseEvent* e);
173 
174  private:
175 
176  std::unique_ptr<Ui::CloudDetectionDialogForm> m_ui;
177 
178  std::unique_ptr<te::qt::widgets::RasterHistogramWidget> m_histogramWidget;
179 
180  std::unique_ptr<te::qt::widgets::RpToolsWidget> m_navigator;
181 
182  std::list<te::map::AbstractLayerPtr> m_layers;
186 
187  std::unique_ptr<te::rst::Raster> m_cloudRaster;
188  std::unique_ptr<te::rst::Raster> m_shadowRaster;
189  std::unique_ptr<te::rst::Raster> m_cloudRasterPreview;
190  std::unique_ptr<te::rst::Raster> m_shadowRasterPreview;
191 
192  std::unique_ptr<te::gm::Geometry> m_geom;
194 
195  std::string m_lastText;
196  std::vector<double> m_cloudMinValue;
197  std::vector<double> m_cloudMaxValue;
198  std::vector<double> m_shadowMinValue;
199  std::vector<double> m_shadowMaxValue;
201 
202  std::string m_userPath;
203 
204  std::unique_ptr<te::qt::widgets::PolygonSymbolizerWidget> m_polygonSymbolizerWidget;
206 
207  };
208  } // end namespace widgets
209  } // end namespace qt
210 } // end namespace te
211 
212 #endif // __TERRALIB_QT_PLUGINS_RP_INTERNAL_CLOUDDETECTIONDIALOG_H
213 
#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