MixtureModelWizardPage.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/MixtureModelWizardPage.h
22 
23  \brief This file defines a class for a MixtureModel Wizard page.
24 
25  /brief JSON File Structure used to save the mix model components information
26 
27  {"MixModel_Components":
28  [
29  {"Component":
30  {"name" : "******"},
31  {"geomGrid":
32  [
33  {"x0" : ******},
34  {"y0" : ******},
35  .
36  .
37  .
38  {"xn" : ******},
39  {"yn" : ******}
40  ]
41  }
42  {"geomGeo":
43  [
44  {"x0" : ******},
45  {"y0" : ******},
46  .
47  .
48  .
49  {"xn" : ******},
50  {"yn" : ******}
51  ]
52  }
53  {"values":
54  [
55  {"pixelValue" : *****},
56  {"pixelValue" : *****},
57  {"pixelValue" : *****}
58  ]
59  }
60  {"Color":"#******"
61  }
62  }
63  ]
64  }
65 
66  struct MixModelComponent
67  {
68  std::string m_name;
69  te::gm::Geometry* m_geomGrid;
70  te::gm::Geometry* m_geomGeo;
71  std::vector<double> m_values;
72  te::color::RGBAColor m_color;
73  };
74 */
75 
76 #ifndef __TERRALIB_QT_WIDGETS_RP_INTERNAL_MIXTUREMODELWIZARDPAGE_H
77 #define __TERRALIB_QT_WIDGETS_RP_INTERNAL_MIXTUREMODELWIZARDPAGE_H
78 
79 // TerraLib
80 #include "../../../color/RGBAColor.h"
81 #include "../../../geometry/Geometry.h"
82 #ifndef Q_MOC_RUN
83 #include "../../../maptools/AbstractLayer.h"
84 #include "../../../qt/widgets/canvas/MapDisplay.h"
85 #include "../../../qt/widgets/charts/ChartDisplay.h"
86 #include "../../../qt/widgets/charts/ChartDisplayWidget.h"
87 #include "../../../qt/widgets/charts/ChartStyle.h"
88 #include "../../../raster/Raster.h"
89 #include "../../../rp/Functions.h"
90 #include "../../../rp/MixtureModel.h"
91 #endif
92 #include "../Config.h"
93 
94 
95 // STL
96 #include <memory>
97 
98 // Qt
99 #include <QWizardPage>
100 #include <QTableWidget>
101 #include <QActionGroup>
102 #include <qgridlayout.h>
103 #include <QSignalMapper>
104 #include <QTreeWidget>
105 #include <QTreeWidgetItem>
106 
107 //QWT
108 #include <qwt_plot_curve.h>
109 
110 // Forward declaration
111 namespace Ui { class MixtureModelWizardPageForm; }
112 
113 namespace te
114 {
115  namespace se { class Mark; }
116 
117  namespace qt
118  {
119  namespace widgets
120  {
121  class RpToolsWidget;
122  class SensorManagerDialog;
123 
124  /*!
125  \class MixtureModelWizardPage
126 
127  \brief This class is GUI used to define the mixture model parameters for the RP constast operation.
128  */
129  class TEQTWIDGETSEXPORT MixtureModelWizardPage : public QWizardPage
130  {
131  Q_OBJECT
132 
134  {
136  MIXMODEL_PCA
137  };
138 
140  {
141  std::string m_name;
144  std::vector<double> m_values;
146  };
147 
148  public:
149 
150  MixtureModelWizardPage(QWidget* parent = 0);
151 
153 
154  bool isComplete() const;
155 
156  public:
157 
158  /*!
159  \brief This method is used to set the selected layer for mixture model operation
160  \param layer The layer ptr
161  \note This layer MUST HAVE a valid raster object.
162  */
163  void set(std::list<te::map::AbstractLayerPtr> layers);
164 
165  void setMapDisplay(te::qt::widgets::MapDisplay* mapDisplay);
166 
167  void setActionGroup(QActionGroup* actionGroup);
168 
169  std::list<te::map::AbstractLayerPtr> get();
170 
171  te::rp::MixtureModel::InputParameters getInputParams();
172 
173  bool isDecompose();
174 
175  te::rp::MixtureModel::OutputParameters getOutputParams();
176 
177  void saveMixtureModelComponents(std::string &fileName);
178 
179  void loadMixtureModelComponents(std::string &fileName);
180 
181  void updateComponents();
182 
183  void clearCanvas();
184 
185  public slots:
186 
187  void onMixturetabChanged(int);
188 
189  void onSaveToolButtonClicked();
190 
191  void onLoadToolButtonClicked();
192 
193  void onMapDisplayExtentChanged();
194 
195  void onPointPicked(double x, double y);
196 
197  void onEnvelopeAcquired(te::gm::Envelope env);
198 
199  void onGeomAquired(te::gm::Polygon* poly);
200 
201  void onRemoveToolButtonClicked();
202 
203  void onComponentItemClicked(QTreeWidgetItem * item, int column);
204  void oncomponentChanged();
205  void oncolorToolButtonClicked();
206  void onselectedEnabled(bool);
207  void onallEnabled(bool);
208 
209  void drawGeom();
210 
211  void onSensorToolButtonClicked(int);
212  void onBandItemClicked();
213 
214  protected:
215 
216  void fillMixtureModelTypes();
217 
218  void listBands();
219 
220  void drawMarks();
221 
222  void PlotSpectralSignature();
223 
224  double GetMediumWavelength(std::string sensor);
225 
226  void addGeometryComponent();
227 
228  private:
229  QSignalMapper m_ButtonSignalMapper;
230 
232  std::map<std::string, te::rp::SpectralSensorParams > m_SensorParams;
233 
234  std::auto_ptr<Ui::MixtureModelWizardPageForm> m_ui;
235  std::auto_ptr<te::qt::widgets::RpToolsWidget> m_navigator;
236 
238 
239  std::map<std::string, MixModelComponent > m_components; //!< The map of selected components
240  unsigned int m_countComponents; //!< The maximum number of components inserted.
241 
242  std::list<te::map::AbstractLayerPtr> m_layers;
243  std::vector<double> m_maxValue; //!< vector to store maximum value of each band
246 
248 
250  QGridLayout* m_layoutg;
251  QColor m_color;
253 
254  };
255 
256  } // end namespace widgets
257  } // end namespace qt
258 } // end namespace te
259 
260 #endif // __TERRALIB_QT_WIDGETS_RP_INTERNAL_MIXTUREMODELWIZARDPAGE_H
std::list< te::map::AbstractLayerPtr > m_layers
std::map< std::string, te::rp::SpectralSensorParams > m_SensorParams
A Mark specifies a geometric shape and applies coloring to it.
Definition: Mark.h:84
unsigned int m_countComponents
The maximum number of components inserted.
A widget to control the display of a set of layers.
Definition: MapDisplay.h:69
This class is GUI used to define the mixture model parameters for the RP constast operation...
te::qt::widgets::ChartDisplayWidget * m_displayWidget
MixtureModel input parameters.
Definition: MixtureModel.h:69
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
std::map< std::string, MixModelComponent > m_components
The map of selected components.
std::auto_ptr< Ui::MixtureModelWizardPageForm > m_ui
URI C++ Library.
std::auto_ptr< te::qt::widgets::RpToolsWidget > m_navigator
std::vector< double > m_maxValue
vector to store maximum value of each band
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:74
A wdiget used to display a chart.
MixtureModel output parameters.
Definition: MixtureModel.h:123
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57
#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::SensorManagerDialog * m_sensorManagerDialog
A dialog used to build a SensorManagerDialog element.
te::qt::widgets::MapDisplay * m_mapDisplay