27 #include "../../../dataaccess/dataset/DataSet.h"
28 #include "../../../dataaccess/utils/Utils.h"
29 #include "../../../raster/Utils.h"
31 #include "ui_ColorTransformWizardPageForm.h"
34 #include <QApplication>
35 #include <QGridLayout>
36 #include <QMessageBox>
44 : QWizardPage(parent),
45 m_ui(new Ui::ColorTransformWizardPageForm)
53 this->setTitle(tr(
"Color Transform"));
54 this->setSubTitle(tr(
"Select the type of color transformation and set their specific parameters."));
56 m_ui->m_rgbMinLineEdit->setValidator(
new QDoubleValidator(
this));
57 m_ui->m_rgbMaxLineEdit->setValidator(
new QDoubleValidator(
this));
58 m_ui->m_ihsMinLineEdit->setValidator(
new QDoubleValidator(
this));
59 m_ui->m_ihsMaxLineEdit->setValidator(
new QDoubleValidator(
this));
83 int idx = m_ui->m_colorTransformTypeComboBox->currentIndex();
85 int type = m_ui->m_colorTransformTypeComboBox->itemData(idx).toInt();
87 return (type == COLORTRANSFORM_RGB2IHS);
92 int idx = m_ui->m_colorTransformTypeComboBox->currentIndex();
94 int type = m_ui->m_colorTransformTypeComboBox->itemData(idx).toInt();
96 return (type == COLORTRANSFORM_IHS2RGB);
103 QVariant varLayer = m_ui->m_rgbRComboBox->itemData(0, Qt::UserRole);
105 std::auto_ptr<te::da::DataSet> ds = l->getData();
108 return ds->getRaster(rpos).release();
113 return m_ui->m_rgbRBandComboBox->currentText().toUInt();
118 return m_ui->m_rgbGBandComboBox->currentText().toUInt();
123 return m_ui->m_rgbBBandComboBox->currentText().toUInt();
128 return m_ui->m_rgbMinLineEdit->text().isEmpty() ? 0 : m_ui->m_rgbMinLineEdit->text().toDouble();
133 return m_ui->m_rgbMaxLineEdit->text().isEmpty() ? 255 : m_ui->m_rgbMaxLineEdit->text().toDouble();
140 QVariant varLayer = m_ui->m_ihsIComboBox->itemData(0, Qt::UserRole);
142 std::auto_ptr<te::da::DataSet> ds = l->getData();
145 return ds->getRaster(rpos).release();
150 return m_ui->m_ihsIBandComboBox->currentText().toUInt();
155 return m_ui->m_ihsHBandComboBox->currentText().toUInt();
160 return m_ui->m_ihsSBandComboBox->currentText().toUInt();
165 return m_ui->m_ihsMinLineEdit->text().isEmpty() ? 0 : m_ui->m_ihsMinLineEdit->text().toDouble();
170 return m_ui->m_ihsMaxLineEdit->text().isEmpty() ? 255 : m_ui->m_ihsMaxLineEdit->text().toDouble();
175 m_layerList = layerList;
178 m_ui->m_rgbRComboBox->clear();
179 m_ui->m_rgbGComboBox->clear();
180 m_ui->m_rgbBComboBox->clear();
182 m_ui->m_ihsIComboBox->clear();
183 m_ui->m_ihsHComboBox->clear();
184 m_ui->m_ihsSComboBox->clear();
186 std::list<te::map::AbstractLayerPtr>::iterator it = m_layerList.begin();
187 std::vector<std::size_t> bands;
189 while(it != m_layerList.end())
193 std::auto_ptr<te::da::DataSetType> dst = l->getSchema();
195 if(dst.get() && dst->hasRaster())
197 m_ui->m_rgbRComboBox->addItem(l->getTitle().c_str(), QVariant::fromValue(l));
198 m_ui->m_rgbGComboBox->addItem(l->getTitle().c_str(), QVariant::fromValue(l));
199 m_ui->m_rgbBComboBox->addItem(l->getTitle().c_str(), QVariant::fromValue(l));
201 m_ui->m_ihsIComboBox->addItem(l->getTitle().c_str(), QVariant::fromValue(l));
202 m_ui->m_ihsHComboBox->addItem(l->getTitle().c_str(), QVariant::fromValue(l));
203 m_ui->m_ihsSComboBox->addItem(l->getTitle().c_str(), QVariant::fromValue(l));
209 rgbRComboBoxActivated(0);
210 rgbGComboBoxActivated(0);
211 rgbBComboBoxActivated(0);
213 ihsIComboBoxActivated(0);
214 ihsHComboBoxActivated(0);
215 ihsSComboBoxActivated(0);
220 getRasterBands(m_ui->m_rgbRComboBox, index, m_ui->m_rgbRBandComboBox);
225 getRasterBands(m_ui->m_rgbGComboBox, index, m_ui->m_rgbGBandComboBox);
230 getRasterBands(m_ui->m_rgbBComboBox, index, m_ui->m_rgbBBandComboBox);
235 getRasterBands(m_ui->m_ihsIComboBox, index, m_ui->m_ihsIBandComboBox);
240 getRasterBands(m_ui->m_ihsHComboBox, index, m_ui->m_ihsHBandComboBox);
245 getRasterBands(m_ui->m_ihsSComboBox, index, m_ui->m_ihsSBandComboBox);
251 m_ui->m_colorTransformTypeComboBox->clear();
253 m_ui->m_colorTransformTypeComboBox->addItem(tr(
"RGB - IHS"), COLORTRANSFORM_RGB2IHS);
254 m_ui->m_colorTransformTypeComboBox->addItem(tr(
"IHS - RGB"), COLORTRANSFORM_IHS2RGB);
260 QVariant varLayer = layer->itemData(index, Qt::UserRole);
264 std::auto_ptr<te::da::DataSet> ds = l->getData();
266 std::auto_ptr<te::rst::Raster> rst = ds->getRaster(rpos);
273 for(std::size_t t = 0; t < rst->getNumberOfBands(); ++t)
274 band->addItem(QString::number(t));
282 m_ui->m_rgbMinLineEdit->setText(QString::number(min));
283 m_ui->m_ihsMinLineEdit->setText(QString::number(min));
285 m_ui->m_rgbMaxLineEdit->setText(QString::number(max));
286 m_ui->m_ihsMaxLineEdit->setText(QString::number(max));
Q_DECLARE_METATYPE(te::map::AbstractLayerPtr)
void getRasterBands(QComboBox *layer, int index, QComboBox *band)
te::rst::Raster * getIHSRaster()
TERASTEREXPORT void GetDataTypeRanges(const int &dataType, double &min, double &max)
Return the values range of a given data type.
te::rst::Raster * getRGBRaster()
void rgbRComboBoxActivated(int index)
unsigned int getIHSSBand()
void ihsHComboBoxActivated(int index)
This file defines a class for a ColorTransform Wizard page.
ColorTransformWizardPage(QWidget *parent=0)
void ihsIComboBoxActivated(int index)
~ColorTransformWizardPage()
void fillColorTransformTypes()
An abstract class for raster data strucutures.
void rgbBComboBoxActivated(int index)
unsigned int getIHSIBand()
std::auto_ptr< Ui::ColorTransformWizardPageForm > m_ui
unsigned int getRGBRBand()
unsigned int getIHSHBand()
unsigned int getRGBBBand()
void ihsSComboBoxActivated(int index)
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
unsigned int getRGBGBand()
void rgbGComboBoxActivated(int index)
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
void setList(std::list< te::map::AbstractLayerPtr > &layerList)