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.2
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;
298 if(m_symbolizer->getOpacity())
301 m_sliderWidget->setCurrentValue((
int)value);
305 onOpacityChanged(m_sliderWidget->getValue());
308 if(m_symbolizer->getGain())
311 m_gainOriginalValue = m_gainValue;
316 s.setNum(m_gainValue);
320 if(m_symbolizer->getOffset())
323 m_offsetOriginalValue = m_offsetValue;
328 s.setNum(m_offsetValue);
333 if(m_cs->getRedChannel())
337 setComboBoxText(m_ui->m_composeRComboBox, name);
343 m_ui->m_contrastRHorizontalSlider->setValue((
int)v);
344 m_ui->m_contrastTypeComboBox->setCurrentIndex(m_ui->m_contrastTypeComboBox->findText(m_ceNames[ce->
getContrastEnhancementType()]));
346 m_ui->m_contrastGroupBox->setChecked(
true);
350 m_ui->m_contrastRHorizontalSlider->setValue(100.);
354 if(m_cs->getGreenChannel())
358 setComboBoxText(m_ui->m_composeGComboBox, name);
364 m_ui->m_contrastGHorizontalSlider->setValue((
int)v);
365 m_ui->m_contrastTypeComboBox->setCurrentIndex(m_ui->m_contrastTypeComboBox->findText(m_ceNames[ce->
getContrastEnhancementType()]));
367 m_ui->m_contrastGroupBox->setChecked(
true);
371 m_ui->m_contrastGHorizontalSlider->setValue(100.);
375 if(m_cs->getBlueChannel())
379 setComboBoxText(m_ui->m_composeBComboBox, name);
385 m_ui->m_contrastBHorizontalSlider->setValue((
int)v);
386 m_ui->m_contrastTypeComboBox->setCurrentIndex(m_ui->m_contrastTypeComboBox->findText(m_ceNames[ce->
getContrastEnhancementType()]));
388 m_ui->m_contrastGroupBox->setChecked(
true);
392 m_ui->m_contrastBHorizontalSlider->setValue(100.);
396 if(m_cs->getGrayChannel())
400 setComboBoxText(m_ui->m_composeMComboBox, name);
406 m_ui->m_contrastMHorizontalSlider->setValue((
int)v);
407 m_ui->m_contrastTypeComboBox->setCurrentIndex(m_ui->m_contrastTypeComboBox->findText(m_ceNames[ce->
getContrastEnhancementType()]));
409 m_ui->m_contrastGroupBox->setChecked(
true);
413 m_ui->m_contrastMHorizontalSlider->setValue(100.);
418 setContrastVisibility();
423 QString name = value.c_str();
427 for(
int i = 0; i < cb->count(); ++i)
429 if(cb->itemText(i) == name)
431 cb->setCurrentIndex(i);
440 cb->setCurrentIndex(cb->count() - 1);
449 double seOpacity = opacity / 100.;
451 qStrOpacity.setNum(seOpacity);
459 m_ui->m_composeMComboBox->setEnabled(
true);
460 m_ui->m_composeRComboBox->setEnabled(
false);
461 m_ui->m_composeGComboBox->setEnabled(
false);
462 m_ui->m_composeBComboBox->setEnabled(
false);
467 m_scMono->setSourceChannelName(m_ui->m_composeMComboBox->currentText().toStdString());
468 m_cs->setGrayChannel(m_scMono);
473 onSymbolizerChanged();
475 setContrastVisibility();
480 m_ui->m_composeMComboBox->setEnabled(
false);
481 m_ui->m_composeRComboBox->setEnabled(
true);
482 m_ui->m_composeGComboBox->setEnabled(
false);
483 m_ui->m_composeBComboBox->setEnabled(
false);
488 m_scRed->setSourceChannelName(m_ui->m_composeRComboBox->currentText().toStdString());
489 m_cs->setRedChannel(m_scRed);
494 onSymbolizerChanged();
496 setContrastVisibility();
501 m_ui->m_composeMComboBox->setEnabled(
false);
502 m_ui->m_composeRComboBox->setEnabled(
false);
503 m_ui->m_composeGComboBox->setEnabled(
true);
504 m_ui->m_composeBComboBox->setEnabled(
false);
509 m_scGreen->setSourceChannelName(m_ui->m_composeGComboBox->currentText().toStdString());
510 m_cs->setGreenChannel(m_scGreen);
515 onSymbolizerChanged();
517 setContrastVisibility();
522 m_ui->m_composeMComboBox->setEnabled(
false);
523 m_ui->m_composeRComboBox->setEnabled(
false);
524 m_ui->m_composeGComboBox->setEnabled(
false);
525 m_ui->m_composeBComboBox->setEnabled(
true);
530 m_scBlue->setSourceChannelName(m_ui->m_composeBComboBox->currentText().toStdString());
531 m_cs->setBlueChannel(m_scBlue);
536 onSymbolizerChanged();
538 setContrastVisibility();
543 m_ui->m_composeMComboBox->setEnabled(
false);
544 m_ui->m_composeRComboBox->setEnabled(
true);
545 m_ui->m_composeGComboBox->setEnabled(
true);
546 m_ui->m_composeBComboBox->setEnabled(
true);
551 m_scRed->setSourceChannelName(m_ui->m_composeRComboBox->currentText().toStdString());
552 m_cs->setRedChannel(m_scRed);
558 m_scGreen->setSourceChannelName(m_ui->m_composeGComboBox->currentText().toStdString());
559 m_cs->setGreenChannel(m_scGreen);
565 m_scBlue->setSourceChannelName(m_ui->m_composeBComboBox->currentText().toStdString());
566 m_cs->setBlueChannel(m_scBlue);
571 onSymbolizerChanged();
573 setContrastVisibility();
578 m_scMono->setSourceChannelName(s.toLatin1().data());
580 onSymbolizerChanged();
585 m_scRed->setSourceChannelName(s.toLatin1().data());
587 onSymbolizerChanged();
592 m_scGreen->setSourceChannelName(s.toLatin1().data());
594 onSymbolizerChanged();
599 m_scBlue->setSourceChannelName(s.toLatin1().data());
601 onSymbolizerChanged();
606 if(m_contrastRed == 0)
609 m_scRed->setContrastEnhancement(m_contrastRed);
612 if(m_contrastGreen == 0)
615 m_scGreen->setContrastEnhancement(m_contrastGreen);
618 if(m_contrastBlue == 0)
621 m_scBlue->setContrastEnhancement(m_contrastBlue);
624 if(m_contrastMono == 0)
627 m_scMono->setContrastEnhancement(m_contrastMono);
630 std::map<te::se::ContrastEnhancement::ContrastEnhancementType, QString>::iterator it = m_ceNames.begin();
632 while(it != m_ceNames.end())
636 m_contrastRed->setContrastEnhancementType(it->first);
637 m_contrastGreen->setContrastEnhancementType(it->first);
638 m_contrastBlue->setContrastEnhancementType(it->first);
639 m_contrastMono->setContrastEnhancementType(it->first);
647 onSymbolizerChanged();
652 if(m_contrastMono == 0)
655 m_scMono->setContrastEnhancement(m_contrastMono);
658 double value = double(v) / 100.;
660 m_contrastMono->setGammaValue(value);
665 if(m_contrastRed == 0)
668 m_scRed->setContrastEnhancement(m_contrastRed);
671 double value = double(v) / 100.;
673 m_contrastRed->setGammaValue(value);
678 if(m_contrastGreen == 0)
681 m_scGreen->setContrastEnhancement(m_contrastGreen);
684 double value = double(v) / 100.;
686 m_contrastGreen->setGammaValue(value);
691 if(m_contrastBlue == 0)
694 m_scBlue->setContrastEnhancement(m_contrastBlue);
697 double value = double(v) / 100.;
699 m_contrastBlue->setGammaValue(value);
707 s.setNum(m_gainValue);
713 onSymbolizerChanged();
722 s.setNum(m_gainValue);
728 onSymbolizerChanged();
734 m_gainValue = m_gainOriginalValue;
737 s.setNum(m_gainValue);
743 onSymbolizerChanged();
752 s.setNum(m_offsetValue);
758 onSymbolizerChanged();
767 s.setNum(m_offsetValue);
773 onSymbolizerChanged();
779 m_offsetValue = m_offsetOriginalValue;
782 s.setNum(m_offsetValue);
788 onSymbolizerChanged();
794 emit symbolizerChanged();
799 if(m_ui->m_contrastGroupBox->isChecked() ==
false)
801 m_ui->m_contrastRHorizontalSlider->setValue(100);
802 m_ui->m_contrastGHorizontalSlider->setValue(100);
803 m_ui->m_contrastBHorizontalSlider->setValue(100);
804 m_ui->m_contrastMHorizontalSlider->setValue(100);
809 m_ui->m_contrastRHorizontalSlider->setEnabled(
false);
810 m_ui->m_contrastGHorizontalSlider->setEnabled(
false);
811 m_ui->m_contrastBHorizontalSlider->setEnabled(
false);
812 m_ui->m_contrastMHorizontalSlider->setEnabled(
false);
814 if(m_ui->m_composeMRadioButton->isChecked())
816 m_ui->m_contrastMHorizontalSlider->setEnabled(
true);
819 if(m_ui->m_composeRRadioButton->isChecked())
821 m_ui->m_contrastRHorizontalSlider->setEnabled(
true);
824 if(m_ui->m_composeGRadioButton->isChecked())
826 m_ui->m_contrastGHorizontalSlider->setEnabled(
true);
829 if(m_ui->m_composeBRadioButton->isChecked())
831 m_ui->m_contrastBHorizontalSlider->setEnabled(
true);
834 if(m_ui->m_composeCRadioButton->isChecked())
836 m_ui->m_contrastRHorizontalSlider->setEnabled(
true);
837 m_ui->m_contrastGHorizontalSlider->setEnabled(
true);
838 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