27 #include "../../../common/progress/ProgressManager.h"
28 #include "../../../common/STLUtils.h"
29 #include "../../../dataaccess/dataset/DataSet.h"
30 #include "../../../dataaccess/utils/Utils.h"
31 #include "../../../raster/RasterFactory.h"
32 #include "../../../rp/Functions.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>
54 this->setWizardStyle(QWizard::ModernStyle);
55 this->setWindowTitle(tr(
"Color Transform"));
58 this->setOption(QWizard::HaveHelpButton,
true);
59 this->setOption(QWizard::HelpButtonOnRight,
false);
63 this->setButton(QWizard::HelpButton, helpButton);
77 if(currentPage() == m_layerSearchPage.get())
79 std::list<te::map::AbstractLayerPtr> list = m_layerSearchPage->getSearchWidget()->getSelecteds();
81 m_colorTransformPage->setList(list);
83 return m_layerSearchPage->isComplete();
85 else if(currentPage() == m_colorTransformPage.get())
87 return m_colorTransformPage->isComplete();
89 else if(currentPage() == m_rasterInfoPage.get())
99 m_layerSearchPage->getSearchWidget()->setList(layerList);
100 m_layerSearchPage->getSearchWidget()->filterOnlyByRaster();
101 m_layerSearchPage->getSearchWidget()->setMinRasterBands(3);
102 m_layerSearchPage->getSearchWidget()->enableMultiSelection(
false);
107 return m_outputLayer;
116 addPage(m_layerSearchPage.get());
117 addPage(m_colorTransformPage.get());
118 addPage(m_rasterInfoPage.get());
127 QApplication::setOverrideCursor(Qt::WaitCursor);
133 if(m_colorTransformPage->isRGB2IHS())
134 res = executeRGB2IHS();
135 else if(m_colorTransformPage->isIHS2RGB())
136 res = executeIHS2RGB();
142 m_rasterInfoPage->getWidget()->getInfo());
144 QMessageBox::information(
this, tr(
"Color Transform"), tr(
"Color Transform ended sucessfully"));
148 QMessageBox::critical(
this, tr(
"Color Transform"), tr(
"Color Transform execution error.") + (
" " +
te::rp::Module::getLastLogStr() ).c_str());
152 QApplication::restoreOverrideCursor();
157 catch(
const std::exception& e)
159 QMessageBox::warning(
this, tr(
"Color Transform"), e.what());
163 QApplication::restoreOverrideCursor();
169 QMessageBox::warning(
this, tr(
"Color Transform"), tr(
"An exception has occurred!"));
173 QApplication::restoreOverrideCursor();
180 QApplication::restoreOverrideCursor();
193 unsigned int rBand = m_colorTransformPage->getRGBRBand();
194 unsigned int gBand = m_colorTransformPage->getRGBGBand();
195 unsigned int bBand = m_colorTransformPage->getRGBBBand();
197 double minValue = m_colorTransformPage->getRGBMinValue();
198 double maxValue = m_colorTransformPage->getRGBMaxValue();
213 unsigned int rBand = m_colorTransformPage->getIHSIBand();
214 unsigned int gBand = m_colorTransformPage->getIHSHBand();
215 unsigned int bBand = m_colorTransformPage->getIHSSBand();
217 double minValue = m_colorTransformPage->getIHSMinValue();
218 double maxValue = m_colorTransformPage->getIHSMaxValue();
235 if(m_colorTransformPage->isRGB2IHS())
237 else if(m_colorTransformPage->isIHS2RGB())
241 std::string type = m_rasterInfoPage->getWidget()->getType();
242 std::map<std::string, std::string> info = m_rasterInfoPage->getWidget()->getInfo();
247 if(m_colorTransformPage->isRGB2IHS())
248 inputRaster = m_colorTransformPage->getRGBRaster();
249 else if(m_colorTransformPage->isIHS2RGB())
250 inputRaster = m_colorTransformPage->getIHSRaster();
255 std::vector<te::rst::BandProperty*> bands;
263 bands.push_back(bProp);
Utility functions for the data access module.
A raster band description.
virtual const Band * getBand(std::size_t i) const =0
Returns the raster i-th band.
bool ConvertIHS2RGB(const te::rst::Raster &inputIHSRaster, const unsigned int intensityBandIdx, const unsigned int hueBandIdx, const unsigned int saturationBandIdx, const double rgbRangeMin, const double rgbRangeMax, te::rst::Raster &outputRGBRaster)
IHS to RGB conversion.
int m_type
The data type of the elements in the band.
This file defines a class for a ColorTransform Wizard page.
This file defines a class for a Raster Info Wizard page.
bool ConvertRGB2IHS(const te::rst::Raster &inputRGBRaster, const unsigned int redBandIdx, const unsigned int greenBandIdx, const unsigned int blueBandIdx, const double rgbRangeMin, const double rgbRangeMax, te::rst::Raster &outputIHSRaster)
RGB to IHS conversion.
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.
An abstract class for raster data strucutures.
This class is GUI used to define the raster info parameters for raster factory.
BandProperty * getProperty()
Returns the band property.
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
Grid * getGrid()
It returns the raster grid.
int addViewer(AbstractProgressViewer *apv)
Attach a progress viewer.
static Raster * make()
It creates and returns an empty raster with default raster driver.
A rectified grid is the spatial support for raster data.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
This class is GUI used to define the colorTransform parameters for the RP colorTransform operation...