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<map::AbstractLayerPtr> &layers);
78 
80 
81  void setActionGroup(QActionGroup* actionGroup);
82 
83  void setUserPath(std::string path);
84 
85  protected slots:
86 
88 
90 
92 
94 
96 
98 
99  void onFilterCellClicked(int row, int column);
100 
101  void onFilterCellDoubleClicked(int row, int column);
102 
103  void onFilterCellChanged(int row, int column);
104 
106 
108 
110 
112 
114 
116 
118 
120 
122 
124 
125  void onCloudMinValueSelected(int, int);
126 
127  void onCloudMaxValueSelected(int, int);
128 
129  void onCloudMinValueSelected(double, int);
130 
131  void onCloudMaxValueSelected(double, int);
132 
133  void onShadowMinValueSelected(int, int);
134 
135  void onShadowMaxValueSelected(int, int);
136 
137  void onShadowMinValueSelected(double, int);
138 
139  void onShadowMaxValueSelected(double, int);
140 
141  signals:
142 
144 
145  void closeTool();
146 
147  protected:
148 
149  bool execute();
150 
151  bool vectorize(te::rst::Raster* raster, std::vector<te::gm::Geometry*>& geomVec, std::vector< double >& geomsValues);
152 
154 
156 
158 
160 
161  void applyPreview();
162 
163  void drawGeom();
164 
166 
167  void writeStyle();
168 
169  void readStyle();
170 
171  /*! Function used to create the output dataset type */
172  std::unique_ptr<te::da::DataSetType> createDataSetType(std::string dataSetName, int srid);
173 
174  /*! Function used to create the output data */
175  std::unique_ptr<te::mem::DataSet> createDataSet(te::da::DataSetType* dsType, std::vector<te::gm::Geometry*>& geoms, std::vector< double >& geomsValues);
176 
177  /*! Function used to save the output dataset */
178  void saveDataSet(te::mem::DataSet* dataSet, te::da::DataSetType* dsType, te::da::DataSourcePtr ds, std::string dataSetName);
179 
180  void clearCanvas();
181 
182  void closeEvent(QCloseEvent* e);
183 
184  void rasterFilter(std::list<map::AbstractLayerPtr>& layers);
185 
186  private:
187 
188  std::unique_ptr<Ui::CloudDetectionDialogForm> m_ui;
189 
190  std::unique_ptr<te::qt::widgets::RasterHistogramWidget> m_cloudHistogramWidget;
191  std::unique_ptr<te::qt::widgets::RasterHistogramWidget> m_shadowHistogramWidget;
192  std::unique_ptr<te::qt::widgets::RpToolsWidget> m_navigator;
193 
194  std::list<te::map::AbstractLayerPtr> m_layers;
195  std::list<te::map::AbstractLayerPtr> m_layersRasterFiltered;
196 
200 
201  std::unique_ptr<te::rst::Raster> m_cloudRasterPreview;
202  std::unique_ptr<te::rst::Raster> m_shadowRasterPreview;
203 
204  std::unique_ptr<te::gm::Geometry> m_geom;
206 
208 
209  std::vector<double> m_cloudMinValue;
210  std::vector<double> m_cloudMaxValue;
211  std::vector<double> m_shadowMinValue;
212  std::vector<double> m_shadowMaxValue;
213 
214  std::string m_userPath;
215 
216  std::unique_ptr<te::qt::widgets::PolygonSymbolizerWidget> m_polygonSymbolizerWidget;
218  };
219  } // end namespace widgets
220  } // end namespace qt
221 } // end namespace te
222 
223 #endif // __TERRALIB_QT_PLUGINS_RP_INTERNAL_CLOUDDETECTIONDIALOG_H
224 
A class that models the description of a dataset.
Definition: DataSetType.h:73
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver.
Definition: DataSet.h:66
void onFilterCellChanged(int row, int column)
std::unique_ptr< te::qt::widgets::RasterHistogramWidget > m_shadowHistogramWidget
void setActionGroup(QActionGroup *actionGroup)
std::list< te::map::AbstractLayerPtr > m_layers
void onFilterCellClicked(int row, int column)
void setUserPath(std::string path)
te::qt::widgets::MapDisplay * m_mapDisplay
void setMapDisplay(te::qt::widgets::MapDisplay *mapDisplay)
void onShadowLayerComboBoxActivated(int index)
std::unique_ptr< te::gm::Geometry > m_geom
std::unique_ptr< Ui::CloudDetectionDialogForm > m_ui
void onFilterCellDoubleClicked(int row, int column)
void onEnvelopeAcquired(te::gm::Envelope env)
std::unique_ptr< te::rst::Raster > m_cloudRasterPreview
std::list< te::map::AbstractLayerPtr > m_layersRasterFiltered
bool vectorize(te::rst::Raster *raster, std::vector< te::gm::Geometry * > &geomVec, std::vector< double > &geomsValues)
std::unique_ptr< te::qt::widgets::RpToolsWidget > m_navigator
std::unique_ptr< te::rst::Raster > m_shadowRasterPreview
std::unique_ptr< te::qt::widgets::PolygonSymbolizerWidget > m_polygonSymbolizerWidget
std::unique_ptr< te::mem::DataSet > createDataSet(te::da::DataSetType *dsType, std::vector< te::gm::Geometry * > &geoms, std::vector< double > &geomsValues)
void rasterFilter(std::list< map::AbstractLayerPtr > &layers)
void onShadowMaxValueSelected(double, int)
void addLayer(te::map::AbstractLayerPtr layer)
std::unique_ptr< te::da::DataSetType > createDataSetType(std::string dataSetName, int srid)
std::unique_ptr< te::qt::widgets::RasterHistogramWidget > m_cloudHistogramWidget
CloudDetectionDialog(QWidget *parent=0, Qt::WindowFlags f=0)
void setLayers(std::list< map::AbstractLayerPtr > &layers)
void onShadowMinValueSelected(double, int)
void saveDataSet(te::mem::DataSet *dataSet, te::da::DataSetType *dsType, te::da::DataSourcePtr ds, std::string dataSetName)
A widget to control the display of a set of layers.
Definition: MapDisplay.h:72
An abstract class for raster data strucutures.
Definition: Raster.h:72
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:81
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1449
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
TerraLib.
#define slots
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63