27 #include "../../../common/progress/ProgressManager.h"
28 #include "../../../dataaccess/dataset/DataSet.h"
29 #include "../../../dataaccess/utils/Utils.h"
30 #include "../../../raster/Raster.h"
31 #include "../../../rp/Classifier.h"
32 #include "../../../rp/Module.h"
33 #include "../help/HelpPushButton.h"
34 #include "../layer/search/LayerSearchWidget.h"
35 #include "../layer/search/LayerSearchWizardPage.h"
36 #include "../progress/ProgressViewerDialog.h"
47 #include <QMessageBox>
48 #include <QApplication>
55 this->setWizardStyle(QWizard::ModernStyle);
56 this->setWindowTitle(tr(
"Classifier"));
59 this->setOption(QWizard::HaveHelpButton,
true);
60 this->setOption(QWizard::HelpButtonOnRight,
false);
64 this->setButton(QWizard::HelpButton, helpButton);
78 if(currentPage() == m_layerSearchPage.get())
80 std::list<te::map::AbstractLayerPtr> list = m_layerSearchPage->getSearchWidget()->getSelecteds();
82 if(list.empty() ==
false)
86 m_classifierPage->set(l);
89 return m_layerSearchPage->isComplete();
91 else if(currentPage() == m_classifierPage.get())
93 return m_classifierPage->isComplete();
95 else if(currentPage() == m_rasterInfoPage.get())
105 m_layerSearchPage->getSearchWidget()->setList(layerList);
106 m_layerSearchPage->getSearchWidget()->filterOnlyByRaster();
108 m_classifierPage->setList(layerList);
113 return m_outputLayer;
122 addPage(m_layerSearchPage.get());
123 addPage(m_classifierPage.get());
124 addPage(m_rasterInfoPage.get());
127 m_layerSearchPage->getSearchWidget()->enableMultiSelection(
false);
133 std::list<te::map::AbstractLayerPtr> list = m_layerSearchPage->getSearchWidget()->getSelecteds();
135 std::auto_ptr<te::da::DataSet> ds = l->getData();
139 std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
148 algoOutputParams.
m_rInfo = m_rasterInfoPage->getWidget()->getInfo();
149 algoOutputParams.
m_rType = m_rasterInfoPage->getWidget()->getType();
155 QApplication::setOverrideCursor(Qt::WaitCursor);
157 if(algorithmInstance.
initialize(algoInputParams))
159 if(algorithmInstance.
execute(algoOutputParams))
161 algoOutputParams.
reset();
165 m_rasterInfoPage->getWidget()->getInfo());
167 QMessageBox::information(
this, tr(
"Classifier"), tr(
"Classifier ended sucessfully"));
171 QMessageBox::critical(
this, tr(
"Classifier"), tr(
"Classifier execution error.") +
176 QApplication::restoreOverrideCursor();
183 QMessageBox::critical(
this, tr(
"Classifier"), tr(
"Classifier initialization error.") +
188 QApplication::restoreOverrideCursor();
195 QApplication::restoreOverrideCursor();
Utility functions for the data access module.
A Qt dialog that allows users to run a classifier operation defined by RP module. ...
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
Classifier output parameters.
This file defines a class for a Raster Info Wizard page.
static const std::string & getLastLogStr()
Returns the last log string generated by this module.
void removeViewer(int viewerId)
Dettach a progress viewer.
static ProgressManager & getInstance()
It returns a reference to the singleton instance.
This file defines a class for a Classifier Wizard page.
This class is GUI used to define the raster info parameters for raster factory.
This class is GUI used to define the classifier parameters for the RP constast operation.
int addViewer(AbstractProgressViewer *apv)
Attach a progress viewer.
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
std::map< std::string, std::string > m_rInfo
The necessary information to create the raster (as described in te::raster::RasterFactory).
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr