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  {"id" : ****},
31  {"name" : "******"},
32  {"coordGrid":
33  [
34  {"x" : ******},
35  {"y" : ******}
36  ]
37  }
38  {"coordGeo":
39  [
40  {"x" : ******},
41  {"y" : ******}
42  ]
43  }
44  {"values":
45  [
46  {"pixelValue" : *****},
47  {"pixelValue" : *****},
48  {"pixelValue" : *****}
49  ]
50  }
51  }
52  ]
53  }
54 
55  struct MixModelComponent
56  {
57  std::string m_id;
58  std::string m_name;
59  te::gm::Coord2D m_coordGrid;
60  te::gm::Coord2D m_coordGeo;
61  std::vector<double> m_values;
62  };
63 */
64 
65 #ifndef __TERRALIB_QT_WIDGETS_RP_INTERNAL_MIXTUREMODELWIZARDPAGE_H
66 #define __TERRALIB_QT_WIDGETS_RP_INTERNAL_MIXTUREMODELWIZARDPAGE_H
67 
68 // TerraLib
69 #include "../../../color/RGBAColor.h"
70 #include "../../../geometry/Coord2D.h"
71 #ifndef Q_MOC_RUN
72 #include "../../../maptools/AbstractLayer.h"
73 #include "../../../raster/Raster.h"
74 #include "../../../rp/MixtureModel.h"
75 #endif
76 #include "../Config.h"
77 
78 // STL
79 #include <memory>
80 
81 // Qt
82 #include <QWizardPage>
83 #include <QTableWidget>
84 
85 // Forward declaration
86 namespace Ui { class MixtureModelWizardPageForm; }
87 
88 namespace te
89 {
90  namespace se { class Mark; }
91 
92  namespace qt
93  {
94  namespace widgets
95  {
96  class RasterNavigatorDialog;
97 
98  /*!
99  \class MixtureModelWizardPage
100 
101  \brief This class is GUI used to define the mixture model parameters for the RP constast operation.
102  */
103  class TEQTWIDGETSEXPORT MixtureModelWizardPage : public QWizardPage
104  {
105  Q_OBJECT
106 
108  {
110  MIXMODEL_PCA
111  };
112 
114  {
115  std::string m_id;
116  std::string m_name;
119  std::vector<double> m_values;
120  };
121 
122  public:
123 
124  MixtureModelWizardPage(QWidget* parent = 0);
125 
127 
128  bool isComplete() const;
129 
130  public:
131 
132  /*!
133  \brief This method is used to set the selected layer for mixture model operation
134 
135  \param layer The layer ptr
136 
137  \note This layer MUST HAVE a valid raster object.
138  */
139  void set(te::map::AbstractLayerPtr layer);
140 
142 
143  te::rp::MixtureModel::InputParameters getInputParams();
144 
145  te::rp::MixtureModel::OutputParameters getOutputParams();
146 
147  void saveMixtureModelComponents(std::string fileName);
148 
149  void loadMixtureModelComponents(std::string fileName);
150 
151  public slots:
152 
153  void onSaveToolButtonClicked();
154 
155  void onLoadToolButtonClicked();
156 
157  void onMapDisplayExtentChanged();
158 
159  void onPointPicked(double x, double y);
160 
161  void onItemChanged(QTableWidgetItem* item);
162 
163  void onRemoveToolButtonClicked();
164 
165  void showNavigator(bool show);
166 
167  void onNavigatorClosed();
168 
169  protected:
170 
171  void fillMixtureModelTypes();
172 
173  void listBands();
174 
175  void drawMarks();
176 
177  void updateComponents();
178 
179  private:
180 
181  std::auto_ptr<Ui::MixtureModelWizardPageForm> m_ui;
182  std::auto_ptr<te::qt::widgets::RasterNavigatorDialog> m_navigatorDlg;
183 
184  std::map<std::string, MixModelComponent > m_components; //!< The map of selected components
185  unsigned int m_countComponents; //!< The maximum number of components inserted.
186 
190  };
191 
192  } // end namespace widgets
193  } // end namespace qt
194 } // end namespace te
195 
196 #endif // __TERRALIB_QT_WIDGETS_RP_INTERNAL_MIXTUREMODELWIZARDPAGE_H
A Mark specifies a geometric shape and applies coloring to it.
Definition: Mark.h:84
std::auto_ptr< te::qt::widgets::RasterNavigatorDialog > m_navigatorDlg
unsigned int m_countComponents
The maximum number of components inserted.
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
This class is GUI used to define the mixture model parameters for the RP constast operation...
MixtureModel input parameters.
Definition: MixtureModel.h:69
std::map< std::string, MixModelComponent > m_components
The map of selected components.
std::auto_ptr< Ui::MixtureModelWizardPageForm > m_ui
URI C++ Library.
MixtureModel output parameters.
Definition: MixtureModel.h:123
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
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr