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/MixtureModel.h"
90 #endif
91 #include "../Config.h"
92 
93 // STL
94 #include <memory>
95 
96 // Qt
97 #include <QWizardPage>
98 #include <QTableWidget>
99 #include <QActionGroup>
100 #include <qgridlayout.h>
101 #include <QTreeWidget>
102 #include <QTreeWidgetItem>
103 
104 //QWT
105 #include <qwt_plot_curve.h>
106 
107 // Forward declaration
108 namespace Ui { class MixtureModelWizardPageForm; }
109 
110 namespace te
111 {
112  namespace se { class Mark; }
113 
114  namespace qt
115  {
116  namespace widgets
117  {
118  class RpToolsWidget;
119 
120  /*!
121  \class MixtureModelWizardPage
122 
123  \brief This class is GUI used to define the mixture model parameters for the RP constast operation.
124  */
125  class TEQTWIDGETSEXPORT MixtureModelWizardPage : public QWizardPage
126  {
127  Q_OBJECT
128 
130  {
132  MIXMODEL_PCA
133  };
134 
136  {
137  std::string m_name;
140  std::vector<double> m_values;
142  };
143 
144  public:
145 
146  MixtureModelWizardPage(QWidget* parent = 0);
147 
149 
150  bool isComplete() const;
151 
152  public:
153 
154  /*!
155  \brief This method is used to set the selected layer for mixture model operation
156 
157  \param layer The layer ptr
158 
159  \note This layer MUST HAVE a valid raster object.
160  */
161  void set(std::list<te::map::AbstractLayerPtr> layers);
162 
163  void setMapDisplay(te::qt::widgets::MapDisplay* mapDisplay);
164 
165  void setActionGroup(QActionGroup* actionGroup);
166 
167  std::list<te::map::AbstractLayerPtr> get();
168 
169  te::rp::MixtureModel::InputParameters getInputParams();
170 
171  bool isDecompose();
172 
173  te::rp::MixtureModel::OutputParameters getOutputParams();
174 
175  void saveMixtureModelComponents(std::string &fileName);
176 
177  void loadMixtureModelComponents(std::string &fileName);
178 
179  void updateComponents();
180 
181  void clearCanvas();
182 
183  public slots:
184 
185  void onMixturetabChanged(int);
186 
187  void onSaveToolButtonClicked();
188 
189  void onLoadToolButtonClicked();
190 
191  void onMapDisplayExtentChanged();
192 
193  void onPointPicked(double x, double y);
194 
195  void onEnvelopeAcquired(te::gm::Envelope env);
196 
197  void onGeomAquired(te::gm::Polygon* poly);
198 
199  void onRemoveToolButtonClicked();
200 
201  void onComponentItemClicked(QTreeWidgetItem * item, int column);
202  void oncomponentChanged();
203  void oncolorToolButtonClicked();
204  void onselectedEnabled(bool);
205  void onallEnabled(bool);
206 
207  void drawGeom();
208 
209  protected:
210 
211  void fillMixtureModelTypes();
212 
213  void listBands();
214 
215  void drawMarks();
216 
217  void PlotSpectralSignature();
218 
219  double GetMediumWavelength(std::string sensor);
220 
221  void addGeometryComponent();
222 
223  private:
224 
225  std::auto_ptr<Ui::MixtureModelWizardPageForm> m_ui;
226  std::auto_ptr<te::qt::widgets::RpToolsWidget> m_navigator;
227 
228  std::map<std::string, MixModelComponent > m_components; //!< The map of selected components
229  unsigned int m_countComponents; //!< The maximum number of components inserted.
230 
231  std::list<te::map::AbstractLayerPtr> m_layers;
234 
236 
238  QGridLayout* m_layoutg;
239  QColor m_color;
240 
241  //te::cl::ROISet* m_rs;
243 
244  };
245 
246  } // end namespace widgets
247  } // end namespace qt
248 } // end namespace te
249 
250 #endif // __TERRALIB_QT_WIDGETS_RP_INTERNAL_MIXTUREMODELWIZARDPAGE_H
std::list< te::map::AbstractLayerPtr > m_layers
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
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::MapDisplay * m_mapDisplay