27 #include "../../../common/STLUtils.h" 
   28 #include "../../../raster.h" 
   29 #include "../../../se/Utils.h" 
   30 #include "../utils/HorizontalSliderWidget.h" 
   32 #include "ui_RasterSymbolizerWidgetForm.h" 
   40 #define GAIN_CONSTANT_VALUE 0.1 
   41 #define OFFSET_CONSTANT_VALUE 10 
   45     m_ui(new Ui::RasterSymbolizerWidgetForm),
 
   56     m_cs(new te::se::ChannelSelection)
 
   66   QGridLayout* layout = 
new QGridLayout(
m_ui->m_opacityWidget);
 
   67   layout->setContentsMargins(0,0,0,0);
 
   68   layout->setAlignment(Qt::AlignTop);
 
   89   connect(
m_ui->m_contrastMHorizontalSlider, SIGNAL(valueChanged(
int)), 
this, SLOT(
onMonoGammaChanged(
int)));
 
   90   connect(
m_ui->m_contrastRHorizontalSlider, SIGNAL(valueChanged(
int)), 
this, SLOT(
onRedGammaChanged(
int)));
 
   92   connect(
m_ui->m_contrastBHorizontalSlider, SIGNAL(valueChanged(
int)), 
this, SLOT(
onBlueGammaChanged(
int)));
 
  100   connect(
m_ui->m_gainMinusPushButton, SIGNAL(clicked()), 
this, SLOT(
onDecreaseGain()));
 
  101   connect(
m_ui->m_gainResetPushButton, SIGNAL(clicked()), 
this, SLOT(
onDefaultGain()));
 
  123   if(m_symbolizer->getChannelSelection())
 
  128     m_scGreen = m_cs->getGreenChannel();
 
  129     m_scBlue = m_cs->getBlueChannel();
 
  130     m_scMono = m_cs->getGrayChannel();
 
  134       m_ui->m_composeCRadioButton->setChecked(
true);
 
  136       onCompositionChannelSelectionClicked();
 
  140       m_ui->m_composeMRadioButton->setChecked(
true);
 
  142       onMonoChannelSelectionClicked();
 
  146       m_ui->m_composeRRadioButton->setChecked(
true);
 
  148       onRedChannelSelectionClicked();
 
  152       m_ui->m_composeGRadioButton->setChecked(
true);
 
  154       onGreenChannelSelectionClicked();
 
  158       m_ui->m_composeBRadioButton->setChecked(
true);
 
  160       onBlueChannelSelectionClicked();
 
  164     if(m_scRed && m_scRed->getContrastEnhancement())
 
  166       m_contrastRed = m_scRed->getContrastEnhancement();
 
  170     if(m_scGreen && m_scGreen->getContrastEnhancement())
 
  172       m_contrastGreen = m_scGreen->getContrastEnhancement();
 
  176     if(m_scBlue && m_scBlue->getContrastEnhancement())
 
  178       m_contrastBlue = m_scBlue->getContrastEnhancement();
 
  182     if(m_scMono && m_scMono->getContrastEnhancement())
 
  184       m_contrastMono = m_scMono->getContrastEnhancement();
 
  189     m_symbolizer->setChannelSelection(m_cs);
 
  197   QStringList bandNames;
 
  199   for(
size_t i = 0; i < bp.size(); ++i)
 
  203     if(bp[i]->m_description.empty())
 
  206       bandInfo.setNum(bp[i]->m_idx);
 
  208       bandNames.push_back(bandInfo);
 
  212       bandNames.push_back(bp[i]->m_description.c_str());
 
  216   m_ui->m_composeMComboBox->clear();
 
  217   m_ui->m_composeMComboBox->addItems(bandNames);
 
  219   m_ui->m_composeRComboBox->clear();
 
  220   m_ui->m_composeRComboBox->addItems(bandNames);
 
  222   m_ui->m_composeGComboBox->clear();
 
  223   m_ui->m_composeGComboBox->addItems(bandNames);
 
  225   m_ui->m_composeBComboBox->clear();
 
  226   m_ui->m_composeBComboBox->addItems(bandNames);
 
  232   m_ui->m_gainLabel->setPixmap(QIcon::fromTheme(
"gain").pixmap(16,16));
 
  233   m_ui->m_offSetLabel->setPixmap(QIcon::fromTheme(
"offset").pixmap(16,16));
 
  234   m_ui->m_gainPlusPushButton->setIcon(QIcon::fromTheme(
"list-add"));
 
  235   m_ui->m_gainPlusPushButton->setIconSize(QSize(16,16));
 
  236   m_ui->m_gainMinusPushButton->setIcon(QIcon::fromTheme(
"list-remove"));
 
  237   m_ui->m_gainMinusPushButton->setIconSize(QSize(16,16));
 
  238   m_ui->m_gainResetPushButton->setIcon(QIcon::fromTheme(
"edit-undo"));
 
  239   m_ui->m_gainResetPushButton->setIconSize(QSize(16,16));
 
  240   m_ui->m_offsetPlusPushButton->setIcon(QIcon::fromTheme(
"list-add"));
 
  241   m_ui->m_offsetPlusPushButton->setIconSize(QSize(16,16));
 
  242   m_ui->m_offsetMinusPushButton->setIcon(QIcon::fromTheme(
"list-remove"));
 
  243   m_ui->m_offsetMinusPushButton->setIconSize(QSize(16,16));
 
  244   m_ui->m_offsetResetPushButton->setIcon(QIcon::fromTheme(
"edit-undo"));
 
  245   m_ui->m_offsetResetPushButton->setIconSize(QSize(16,16));
 
  247   m_ui->m_composeMonoLabel->setPixmap(QIcon::fromTheme(
"bullet-black").pixmap(16,16));
 
  248   m_ui->m_composeRedLabel->setPixmap(QIcon::fromTheme(
"bullet-red").pixmap(16,16));
 
  249   m_ui->m_composeGreenLabel->setPixmap(QIcon::fromTheme(
"bullet-green").pixmap(16,16));
 
  250   m_ui->m_composeBlueLabel->setPixmap(QIcon::fromTheme(
"bullet-blue").pixmap(16,16));
 
  252   m_ui->m_composeCRadioButton->setIcon(QIcon::fromTheme(
"channels").pixmap(16,16));
 
  253   m_ui->m_composeRRadioButton->setIcon(QIcon::fromTheme(
"channel-red").pixmap(16,16));
 
  254   m_ui->m_composeGRadioButton->setIcon(QIcon::fromTheme(
"channel-green").pixmap(16,16));
 
  255   m_ui->m_composeBRadioButton->setIcon(QIcon::fromTheme(
"channel-blue").pixmap(16,16));
 
  256   m_ui->m_composeMRadioButton->setIcon(QIcon::fromTheme(
"channel-gray").pixmap(16,16));
 
  258   m_ui->m_rContrastLabel->setPixmap(QIcon::fromTheme(
"contrast-red").pixmap(16,16));
 
  259   m_ui->m_gContrastLabel->setPixmap(QIcon::fromTheme(
"contrast-green").pixmap(16,16));
 
  260   m_ui->m_bContrastLabel->setPixmap(QIcon::fromTheme(
"contrast-blue").pixmap(16,16));
 
  261   m_ui->m_mContrastLabel->setPixmap(QIcon::fromTheme(
"contrast-mono").pixmap(16,16));
 
  266   m_ceNames.insert(std::map<te::se::ContrastEnhancement::ContrastEnhancementType, QString>::value_type
 
  268   m_ceNames.insert(std::map<te::se::ContrastEnhancement::ContrastEnhancementType, QString>::value_type
 
  270   m_ceNames.insert(std::map<te::se::ContrastEnhancement::ContrastEnhancementType, QString>::value_type
 
  273   std::map<te::se::ContrastEnhancement::ContrastEnhancementType, QString>::iterator it = m_ceNames.begin();
 
  275   while(it != m_ceNames.end())
 
  277     m_ui->m_contrastTypeComboBox->addItem(it->second);
 
  284   m_ui->m_contrastTypeComboBox->setVisible(
false);
 
  285   m_ui->m_contrastTypeLabel->setVisible(
false);
 
  290   m_gainOriginalValue = m_gainValue;
 
  291   m_offsetOriginalValue = m_offsetValue;
 
  293   m_ui->m_gainValueLabel->setText(QString::number(m_gainValue + 1.));
 
  294   m_ui->m_offSetValueLabel->setText(QString::number(m_offsetValue));
 
  301     if(m_symbolizer->getOpacity())
 
  304       m_sliderWidget->setCurrentValue((
int)value);
 
  308       onOpacityChanged(m_sliderWidget->getValue());
 
  311     if(m_symbolizer->getGain())
 
  314       m_gainOriginalValue = m_gainValue;
 
  319       s.setNum(m_gainValue);
 
  323     m_ui->m_gainValueLabel->setText(QString::number(m_gainValue + 1.));
 
  325     if(m_symbolizer->getOffset())
 
  328       m_offsetOriginalValue = m_offsetValue;
 
  333       s.setNum(m_offsetValue);
 
  337     m_ui->m_offSetValueLabel->setText(QString::number(m_offsetValue));
 
  340     if(m_cs->getRedChannel())
 
  344       setComboBoxText(m_ui->m_composeRComboBox, name);
 
  350         m_ui->m_contrastRHorizontalSlider->setValue((
int)v);
 
  351         m_ui->m_contrastTypeComboBox->setCurrentIndex(m_ui->m_contrastTypeComboBox->findText(m_ceNames[ce->
getContrastEnhancementType()]));
 
  353         m_ui->m_contrastGroupBox->setChecked(
true);
 
  357         m_ui->m_contrastRHorizontalSlider->setValue(100.);
 
  361     if(m_cs->getGreenChannel())
 
  365       setComboBoxText(m_ui->m_composeGComboBox, name);
 
  371         m_ui->m_contrastGHorizontalSlider->setValue((
int)v);
 
  372         m_ui->m_contrastTypeComboBox->setCurrentIndex(m_ui->m_contrastTypeComboBox->findText(m_ceNames[ce->
getContrastEnhancementType()]));
 
  374         m_ui->m_contrastGroupBox->setChecked(
true);
 
  378         m_ui->m_contrastGHorizontalSlider->setValue(100.);
 
  382     if(m_cs->getBlueChannel())
 
  386       setComboBoxText(m_ui->m_composeBComboBox, name);
 
  392         m_ui->m_contrastBHorizontalSlider->setValue((
int)v);
 
  393         m_ui->m_contrastTypeComboBox->setCurrentIndex(m_ui->m_contrastTypeComboBox->findText(m_ceNames[ce->
getContrastEnhancementType()]));
 
  395         m_ui->m_contrastGroupBox->setChecked(
true);
 
  399         m_ui->m_contrastBHorizontalSlider->setValue(100.);
 
  403     if(m_cs->getGrayChannel())
 
  407       setComboBoxText(m_ui->m_composeMComboBox, name);
 
  413         m_ui->m_contrastMHorizontalSlider->setValue((
int)v);
 
  414         m_ui->m_contrastTypeComboBox->setCurrentIndex(m_ui->m_contrastTypeComboBox->findText(m_ceNames[ce->
getContrastEnhancementType()]));
 
  416         m_ui->m_contrastGroupBox->setChecked(
true);
 
  420         m_ui->m_contrastMHorizontalSlider->setValue(100.);
 
  425   setContrastVisibility();
 
  430   QString name = value.c_str();
 
  434   for(
int i = 0; i < cb->count(); ++i)
 
  436     if(cb->itemText(i) == name)
 
  438       cb->setCurrentIndex(i);
 
  447     cb->setCurrentIndex(cb->count() - 1);
 
  456     double seOpacity = opacity / 100.;
 
  458     qStrOpacity.setNum(seOpacity);
 
  466   m_ui->m_composeMComboBox->setEnabled(
true);
 
  467   m_ui->m_composeRComboBox->setEnabled(
false);
 
  468   m_ui->m_composeGComboBox->setEnabled(
false);
 
  469   m_ui->m_composeBComboBox->setEnabled(
false);
 
  474     m_scMono->setSourceChannelName(m_ui->m_composeMComboBox->currentText().toStdString());
 
  475     m_cs->setGrayChannel(m_scMono);
 
  480   onSymbolizerChanged();
 
  482   setContrastVisibility();
 
  487   m_ui->m_composeMComboBox->setEnabled(
false);
 
  488   m_ui->m_composeRComboBox->setEnabled(
true);
 
  489   m_ui->m_composeGComboBox->setEnabled(
false);
 
  490   m_ui->m_composeBComboBox->setEnabled(
false);
 
  495     m_scRed->setSourceChannelName(m_ui->m_composeRComboBox->currentText().toStdString());
 
  496     m_cs->setRedChannel(m_scRed);
 
  501   onSymbolizerChanged();
 
  503   setContrastVisibility();
 
  508   m_ui->m_composeMComboBox->setEnabled(
false);
 
  509   m_ui->m_composeRComboBox->setEnabled(
false);
 
  510   m_ui->m_composeGComboBox->setEnabled(
true);
 
  511   m_ui->m_composeBComboBox->setEnabled(
false);
 
  516     m_scGreen->setSourceChannelName(m_ui->m_composeGComboBox->currentText().toStdString());
 
  517     m_cs->setGreenChannel(m_scGreen);
 
  522   onSymbolizerChanged();
 
  524   setContrastVisibility();
 
  529   m_ui->m_composeMComboBox->setEnabled(
false);
 
  530   m_ui->m_composeRComboBox->setEnabled(
false);
 
  531   m_ui->m_composeGComboBox->setEnabled(
false);
 
  532   m_ui->m_composeBComboBox->setEnabled(
true);
 
  537     m_scBlue->setSourceChannelName(m_ui->m_composeBComboBox->currentText().toStdString());
 
  538     m_cs->setBlueChannel(m_scBlue);
 
  543   onSymbolizerChanged();
 
  545   setContrastVisibility();
 
  550   m_ui->m_composeMComboBox->setEnabled(
false);
 
  551   m_ui->m_composeRComboBox->setEnabled(
true);
 
  552   m_ui->m_composeGComboBox->setEnabled(
true);
 
  553   m_ui->m_composeBComboBox->setEnabled(
true);
 
  558     m_scRed->setSourceChannelName(m_ui->m_composeRComboBox->currentText().toStdString());
 
  559     m_cs->setRedChannel(m_scRed);
 
  565     m_scGreen->setSourceChannelName(m_ui->m_composeGComboBox->currentText().toStdString());
 
  566     m_cs->setGreenChannel(m_scGreen);
 
  572     m_scBlue->setSourceChannelName(m_ui->m_composeBComboBox->currentText().toStdString());
 
  573     m_cs->setBlueChannel(m_scBlue);
 
  578   onSymbolizerChanged();
 
  580   setContrastVisibility();
 
  585   m_scMono->setSourceChannelName(s.toLatin1().data());
 
  587   onSymbolizerChanged();
 
  592   m_scRed->setSourceChannelName(s.toLatin1().data());
 
  594   onSymbolizerChanged();
 
  599   m_scGreen->setSourceChannelName(s.toLatin1().data());
 
  601   onSymbolizerChanged();
 
  606   m_scBlue->setSourceChannelName(s.toLatin1().data());
 
  608   onSymbolizerChanged();
 
  613   if(m_contrastRed == 0)
 
  616     m_scRed->setContrastEnhancement(m_contrastRed);
 
  619   if(m_contrastGreen == 0)
 
  622     m_scGreen->setContrastEnhancement(m_contrastGreen);
 
  625   if(m_contrastBlue == 0)
 
  628     m_scBlue->setContrastEnhancement(m_contrastBlue);
 
  631   if(m_contrastMono == 0)
 
  634     m_scMono->setContrastEnhancement(m_contrastMono);
 
  637   std::map<te::se::ContrastEnhancement::ContrastEnhancementType, QString>::iterator it = m_ceNames.begin();
 
  639   while(it != m_ceNames.end())
 
  643       m_contrastRed->setContrastEnhancementType(it->first);
 
  644       m_contrastGreen->setContrastEnhancementType(it->first);
 
  645       m_contrastBlue->setContrastEnhancementType(it->first);
 
  646       m_contrastMono->setContrastEnhancementType(it->first);
 
  654   onSymbolizerChanged();
 
  659   if(m_contrastMono == 0)
 
  662     m_scMono->setContrastEnhancement(m_contrastMono);
 
  665   double value = double(v) / 100.;
 
  667   m_contrastMono->setGammaValue(value);
 
  672   if(m_contrastRed == 0)
 
  675     m_scRed->setContrastEnhancement(m_contrastRed);
 
  678   double value = double(v) / 100.;
 
  680   m_contrastRed->setGammaValue(value);
 
  685   if(m_contrastGreen == 0)
 
  688     m_scGreen->setContrastEnhancement(m_contrastGreen);
 
  691   double value = double(v) / 100.;
 
  693   m_contrastGreen->setGammaValue(value);
 
  698   if(m_contrastBlue == 0)
 
  701     m_scBlue->setContrastEnhancement(m_contrastBlue);
 
  704   double value = double(v) / 100.;
 
  706   m_contrastBlue->setGammaValue(value);
 
  714   s.setNum(m_gainValue);
 
  720     onSymbolizerChanged();
 
  723   m_ui->m_gainValueLabel->setText(QString::number(m_gainValue + 1.));
 
  731   s.setNum(m_gainValue);
 
  737     onSymbolizerChanged();
 
  740   m_ui->m_gainValueLabel->setText(QString::number(m_gainValue + 1.));
 
  745   m_gainValue = m_gainOriginalValue;
 
  748   s.setNum(m_gainValue);
 
  754     onSymbolizerChanged();
 
  757   m_ui->m_gainValueLabel->setText(QString::number(m_gainValue + 1.));
 
  765   s.setNum(m_offsetValue);
 
  771     onSymbolizerChanged();
 
  774   m_ui->m_offSetValueLabel->setText(QString::number(m_offsetValue));
 
  782   s.setNum(m_offsetValue);
 
  788     onSymbolizerChanged();
 
  791   m_ui->m_offSetValueLabel->setText(QString::number(m_offsetValue));
 
  796   m_offsetValue = m_offsetOriginalValue;
 
  799   s.setNum(m_offsetValue);
 
  805     onSymbolizerChanged();
 
  808   m_ui->m_offSetValueLabel->setText(QString::number(m_offsetValue));
 
  813   emit symbolizerChanged();
 
  818   if(m_ui->m_contrastGroupBox->isChecked() == 
false)
 
  820     m_ui->m_contrastRHorizontalSlider->setValue(100);
 
  821     m_ui->m_contrastGHorizontalSlider->setValue(100);
 
  822     m_ui->m_contrastBHorizontalSlider->setValue(100);
 
  823     m_ui->m_contrastMHorizontalSlider->setValue(100);
 
  828   m_ui->m_contrastRHorizontalSlider->setEnabled(
false);
 
  829   m_ui->m_contrastGHorizontalSlider->setEnabled(
false);
 
  830   m_ui->m_contrastBHorizontalSlider->setEnabled(
false);
 
  831   m_ui->m_contrastMHorizontalSlider->setEnabled(
false);
 
  833   if(m_ui->m_composeMRadioButton->isChecked())
 
  835     m_ui->m_contrastMHorizontalSlider->setEnabled(
true);
 
  838   if(m_ui->m_composeRRadioButton->isChecked())
 
  840     m_ui->m_contrastRHorizontalSlider->setEnabled(
true);
 
  843   if(m_ui->m_composeGRadioButton->isChecked())
 
  845     m_ui->m_contrastGHorizontalSlider->setEnabled(
true);
 
  848   if(m_ui->m_composeBRadioButton->isChecked())
 
  850     m_ui->m_contrastBHorizontalSlider->setEnabled(
true);
 
  853   if(m_ui->m_composeCRadioButton->isChecked())
 
  855     m_ui->m_contrastRHorizontalSlider->setEnabled(
true);
 
  856     m_ui->m_contrastGHorizontalSlider->setEnabled(
true);
 
  857     m_ui->m_contrastBHorizontalSlider->setEnabled(
true);
 
A selected channel to be display. 
te::se::ChannelSelection * getChannelSelection() const 
SelectedChannel * getRedChannel() const 
TESEEXPORT double GetDouble(const te::se::ParameterValue *param)
It gets the parameter value as a double. 
The "ParameterValueType" uses WFS-Filter expressions to give values for SE graphic parameters...
std::string getSourceChannelName() const 
ContrastEnhancement defines the 'stretching' of contrast for a channel of a false-color image or for ...
The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos...
ContrastEnhancementType getContrastEnhancementType() const 
ContrastEnhancement * getContrastEnhancement() const 
double getGammaValue() const