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 #include "../../../maptools/AbstractLayer.h"
72 #include "../../../raster/Raster.h"
73 #include "../../../rp/MixtureModel.h"
74 #include "../Config.h"
75 
76 // STL
77 #include <memory>
78 
79 // Qt
80 #include <QWizardPage>
81 #include <QTableWidget>
82 
83 // Forward declaration
84 namespace Ui { class MixtureModelWizardPageForm; }
85 
86 namespace te
87 {
88  namespace se { class Mark; }
89 
90  namespace qt
91  {
92  namespace widgets
93  {
94  class RasterNavigatorDialog;
95 
96  /*!
97  \class MixtureModelWizardPage
98 
99  \brief This class is GUI used to define the mixture model parameters for the RP constast operation.
100  */
101  class TEQTWIDGETSEXPORT MixtureModelWizardPage : public QWizardPage
102  {
103  Q_OBJECT
104 
106  {
108  MIXMODEL_PCA
109  };
110 
112  {
113  std::string m_id;
114  std::string m_name;
117  std::vector<double> m_values;
118  };
119 
120  public:
121 
122  MixtureModelWizardPage(QWidget* parent = 0);
123 
125 
126  bool isComplete() const;
127 
128  public:
129 
130  /*!
131  \brief This method is used to set the selected layer for mixture model operation
132 
133  \param layer The layer ptr
134 
135  \note This layer MUST HAVE a valid raster object.
136  */
137  void set(te::map::AbstractLayerPtr layer);
138 
140 
141  te::rp::MixtureModel::InputParameters getInputParams();
142 
143  te::rp::MixtureModel::OutputParameters getOutputParams();
144 
145  void saveMixtureModelComponents(std::string fileName);
146 
147  void loadMixtureModelComponents(std::string fileName);
148 
149  public slots:
150 
151  void onSaveToolButtonClicked();
152 
153  void onLoadToolButtonClicked();
154 
155  void onMapDisplayExtentChanged();
156 
157  void onPointPicked(double x, double y);
158 
159  void onItemChanged(QTableWidgetItem* item);
160 
161  void onRemoveToolButtonClicked();
162 
163  void showNavigator(bool show);
164 
165  void onNavigatorClosed();
166 
167  protected:
168 
169  void fillMixtureModelTypes();
170 
171  void listBands();
172 
173  void drawMarks();
174 
175  void updateComponents();
176 
177  private:
178 
179  std::auto_ptr<Ui::MixtureModelWizardPageForm> m_ui;
180  std::auto_ptr<te::qt::widgets::RasterNavigatorDialog> m_navigatorDlg;
181 
182  std::map<std::string, MixModelComponent > m_components; //!< The map of selected components
183  unsigned int m_countComponents; //!< The maximum number of components inserted.
184 
188  };
189 
190  } // end namespace widgets
191  } // end namespace qt
192 } // end namespace te
193 
194 #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