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/Contrast.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 <QApplication>
48 #include <QMessageBox>
55 this->setWizardStyle(QWizard::ModernStyle);
56 this->setWindowTitle(tr(
"Contrast"));
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_contrastPage->set(l);
89 return m_layerSearchPage->isComplete();
91 else if(currentPage() == m_contrastPage.get())
93 bool res = m_contrastPage->isComplete();
96 QMessageBox::warning(
this, tr(
"Warning"), tr(
"Select at least one band."));
100 else if(currentPage() == m_rasterInfoPage.get())
110 m_layerSearchPage->getSearchWidget()->setList(layerList);
111 m_layerSearchPage->getSearchWidget()->filterOnlyByRaster();
116 removePage(m_layerSearchId);
118 m_contrastPage->set(layer);
123 return m_outputLayer;
132 m_layerSearchId = addPage(m_layerSearchPage.get());
133 addPage(m_contrastPage.get());
134 addPage(m_rasterInfoPage.get());
137 m_layerSearchPage->getSearchWidget()->enableMultiSelection(
false);
142 if(m_rasterInfoPage->getWidget()->fileExists())
144 QMessageBox::warning(
this, tr(
"Contrast"), tr(
"File already exists."));
150 std::auto_ptr<te::da::DataSet> ds = l->getData();
154 std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
172 QApplication::setOverrideCursor(Qt::WaitCursor);
176 if(algorithmInstance.
initialize(algoInputParams))
178 if(algorithmInstance.
execute(algoOutputParams))
180 algoOutputParams.
reset();
184 m_rasterInfoPage->getWidget()->getInfo());
186 QMessageBox::information(
this, tr(
"Contrast"), tr(
"Contrast enhencement ended sucessfully"));
190 QMessageBox::critical(
this, tr(
"Contrast"), tr(
"Contrast enhencement execution error.") +
193 QApplication::restoreOverrideCursor();
200 QMessageBox::critical(
this, tr(
"Contrast"), tr(
"Contrast enhencement initialization error.") +
203 QApplication::restoreOverrideCursor();
208 catch(
const std::exception& e)
210 QMessageBox::warning(
this, tr(
"Contrast"), e.what());
214 QApplication::restoreOverrideCursor();
220 QMessageBox::warning(
this, tr(
"Contrast"), tr(
"An exception has occurred!"));
224 QApplication::restoreOverrideCursor();
231 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.
void removeViewer(int viewerId)
Dettach a progress viewer.
static ProgressManager & getInstance()
It returns a reference to the singleton instance.
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.
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.
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.