27 #include "../../../dataaccess/dataset/DataSet.h"
28 #include "../../../dataaccess/utils/Utils.h"
29 #include "../../../raster/Raster.h"
30 #include "../../../rp/MixtureModel.h"
31 #include "../../../rp/Module.h"
32 #include "../help/HelpPushButton.h"
33 #include "../layer/search/LayerSearchWidget.h"
34 #include "../layer/search/LayerSearchWizardPage.h"
45 #include <QApplication>
46 #include <QMessageBox>
56 this->setWizardStyle(QWizard::ModernStyle);
57 this->setWindowTitle(tr(
"Mixture Model"));
60 this->setOption(QWizard::HaveHelpButton,
true);
61 this->setOption(QWizard::HelpButtonOnRight,
false);
65 this->setButton(QWizard::HelpButton, helpButton);
79 if(currentPage() == m_layerSearchPage.get())
81 std::list<te::map::AbstractLayerPtr> list = m_layerSearchPage->getSearchWidget()->getSelecteds();
83 if(list.empty() ==
false)
87 m_mixtureModelPage->set(l);
90 return m_layerSearchPage->isComplete();
92 else if(currentPage() == m_mixtureModelPage.get())
94 return m_mixtureModelPage->isComplete();
96 else if(currentPage() == m_rasterInfoPage.get())
106 return m_outputLayer;
111 m_layerSearchPage->getSearchWidget()->setList(layerList);
112 m_layerSearchPage->getSearchWidget()->filterOnlyByRaster();
117 removePage(m_layerSearchId);
119 m_mixtureModelPage->set(layer);
128 m_layerSearchId = addPage(m_layerSearchPage.get());
129 addPage(m_mixtureModelPage.get());
130 addPage(m_rasterInfoPage.get());
133 m_layerSearchPage->getSearchWidget()->enableMultiSelection(
false);
138 if(m_rasterInfoPage->getWidget()->fileExists())
140 QMessageBox::warning(
this, tr(
"Mixture Model"), tr(
"File already exists."));
146 std::auto_ptr<te::da::DataSet> ds(l->getData());
148 std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
157 QMessageBox::critical(
this, tr(
"Mixture Model"), tr(
"The number of components must be the same as the number of selected bands"));
164 algoOutputParams.
m_rInfo = m_rasterInfoPage->getWidget()->getInfo();
165 algoOutputParams.
m_rType = m_rasterInfoPage->getWidget()->getType();
167 QApplication::setOverrideCursor(Qt::WaitCursor);
169 if(algorithmInstance.
initialize(algoInputParams))
171 if(algorithmInstance.
execute(algoOutputParams))
173 algoOutputParams.
reset();
177 m_rasterInfoPage->getWidget()->getInfo());
178 QMessageBox::information(
this, tr(
"Mixture Model"), tr(
"Mixture Model ended sucessfully"));
182 QMessageBox::critical(
this, tr(
"Mixture Model"), tr(
"Mixture Model execution error.") +
185 QApplication::restoreOverrideCursor();
192 QMessageBox::critical(
this, tr(
"Mixture Model"), tr(
"Mixture Model initialization error." ) +
195 QApplication::restoreOverrideCursor();
200 QApplication::restoreOverrideCursor();
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
Utility functions for the data access module.
This file defines a class for a MixtureModel Wizard page.
Raster decomposition using mixture model.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
This file defines a class for a Raster Info Wizard page.
This class is GUI used to define the mixture model parameters for the RP constast operation...
A Qt dialog that allows users to run a mixture model operation defined by RP module.
std::map< std::string, std::string > m_rInfo
The necessary information to create the raster (as described in te::raster::RasterFactory).
static const std::string & getLastLogStr()
Returns the last log string generated by this module.
This class is GUI used to define the raster info parameters for raster factory.
MixtureModel output parameters.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr