27 #include "../../../dataaccess/dataset/DataSet.h"
28 #include "../../../dataaccess/utils/Utils.h"
29 #include "../../../raster/Raster.h"
30 #include "../../../rp/Contrast.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>
53 this->setWizardStyle(QWizard::ModernStyle);
54 this->setWindowTitle(tr(
"Contrast"));
57 this->setOption(QWizard::HaveHelpButton,
true);
58 this->setOption(QWizard::HelpButtonOnRight,
false);
62 this->setButton(QWizard::HelpButton, helpButton);
76 if(currentPage() == m_layerSearchPage.get())
78 std::list<te::map::AbstractLayerPtr> list = m_layerSearchPage->getSearchWidget()->getSelecteds();
80 if(list.empty() ==
false)
84 m_contrastPage->set(l);
87 return m_layerSearchPage->isComplete();
89 else if(currentPage() == m_contrastPage.get())
91 bool res = m_contrastPage->isComplete();
94 QMessageBox::warning(
this, tr(
"Warning"), tr(
"Select at least one band."));
98 else if(currentPage() == m_rasterInfoPage.get())
108 m_layerSearchPage->getSearchWidget()->setList(layerList);
109 m_layerSearchPage->getSearchWidget()->filterOnlyByRaster();
114 removePage(m_layerSearchId);
116 m_contrastPage->set(layer);
121 return m_outputLayer;
130 m_layerSearchId = addPage(m_layerSearchPage.get());
131 addPage(m_contrastPage.get());
132 addPage(m_rasterInfoPage.get());
135 m_layerSearchPage->getSearchWidget()->enableMultiSelection(
false);
140 if(m_rasterInfoPage->getWidget()->fileExists())
142 QMessageBox::warning(
this, tr(
"Contrast"), tr(
"File already exists."));
148 std::auto_ptr<te::da::DataSet> ds = l->getData();
152 std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
166 QApplication::setOverrideCursor(Qt::WaitCursor);
168 if(algorithmInstance.
initialize(algoInputParams))
170 if(algorithmInstance.
execute(algoOutputParams))
172 algoOutputParams.
reset();
176 m_rasterInfoPage->getWidget()->getInfo());
178 QMessageBox::information(
this, tr(
"Contrast"), tr(
"Contrast enhencement ended sucessfully"));
182 QMessageBox::critical(
this, tr(
"Contrast"), tr(
"Contrast enhencement execution error.") +
185 QApplication::restoreOverrideCursor();
192 QMessageBox::critical(
this, tr(
"Contrast"), tr(
"Contrast enhencement initialization error.") +
195 QApplication::restoreOverrideCursor();
200 QApplication::restoreOverrideCursor();
Utility functions for the data access module.
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.
This class is GUI used to define the contrast parameters for the RP constast operation.
This class is GUI used to define the raster info parameters for raster factory.
std::vector< unsigned int > m_outRasterBands
Bands to be processed from the output raster.
A Qt dialog that allows users to run a contrast operation defined by RP module.
This file defines a class for a Contrast Wizard page.
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.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
std::string m_createdOutRasterDSType
Output raster data source type (as described in te::raster::RasterFactory ), leave empty if the resul...
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
Contrast output parameters.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
std::map< std::string, std::string > m_createdOutRasterInfo
The necessary information to create the raster (as described in te::raster::RasterFactory), leave empty if the result must be written to the raster pointed m_outRasterPtr.