RasterSymbolizerWidget.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/qt/widgets/se/RasterSymbolizerWidget.cpp
22 
23  \brief A widget used to configure a Raster Symbolizer SE element.
24 */
25 
26 // TerraLib
27 #include "../../../common/STLUtils.h"
28 #include "../../../common/StringUtils.h"
29 #include "../../../dataaccess/utils/Utils.h"
30 #include "../../../maptools/RasterContrast.h"
31 #include "../../../maptools/Utils.h"
32 #include "../../../raster.h"
33 #include "../../../se/Utils.h"
34 #include "../canvas/MapDisplay.h"
35 #include "../charts/ChartDisplay.h"
36 #include "../charts/ChartStyle.h"
37 #include "../charts/Histogram.h"
38 #include "../charts/HistogramChart.h"
39 #include "../charts/HistogramStyle.h"
40 #include "../rp/RasterHistogramWidget.h"
41 #include "../utils/HorizontalSliderWidget.h"
42 #include "../utils/ScopedCursor.h"
43 #include "RasterSymbolizerWidget.h"
44 #include "ui_RasterSymbolizerWidgetForm.h"
45 
46 // Qt
47 #include <QLabel>
48 #include <QMessageBox>
49 
50 // STL
51 #include <cassert>
52 #include <limits>
53 
54 #define GAIN_CONSTANT_VALUE 0.1
55 #define OFFSET_CONSTANT_VALUE 10
56 
58  : QWidget(parent, f),
59  m_ui(new Ui::RasterSymbolizerWidgetForm),
60  m_sliderWidget(nullptr),
61  m_display(nullptr),
62  m_symbolizer(nullptr),
63  m_contrast(nullptr),
64  m_contrastRed(nullptr),
65  m_contrastGreen(nullptr),
66  m_contrastBlue(nullptr),
67  m_contrastMono(nullptr),
68  m_scRed(nullptr),
69  m_scGreen(nullptr),
70  m_scBlue(nullptr),
71  m_scMono(nullptr),
72  m_cs(new te::se::ChannelSelection),
73  m_setLocalSymbol(false)
74 {
75  m_ui->setupUi(this);
76 
77  // add opacity scrool bar
79  m_sliderWidget->setTitle(tr("Opacity"));
82 
83  QGridLayout* layout = new QGridLayout(m_ui->m_opacityWidget);
84  layout->setContentsMargins(0,0,0,0);
85  layout->setAlignment(Qt::AlignTop);
86  layout->addWidget(m_sliderWidget);
87 
88  // add histogram widget
89  QGridLayout* histogramLayout = new QGridLayout(m_ui->m_histogramGroupBox);
91  histogramLayout->addWidget(m_histogramWidget);
92  histogramLayout->setContentsMargins(0, 0, 0, 0);
93 
97  m_histogramWidget->m_chartDisplay->enableAxis(QwtPlot::yLeft, false);
98  m_histogramWidget->m_chartDisplay->insertLegend(nullptr);
101 
102  m_ui->m_inMinLineEdit->setValidator(new QDoubleValidator(this));
103  m_ui->m_inMaxLineEdit->setValidator(new QDoubleValidator(this));
104 
105  m_ui->m_typeComboBox->addItem(tr("Linear"), te::rp::Contrast::InputParameters::LinearContrastT);
106  m_ui->m_typeComboBox->addItem(tr("Square Constrast"), te::rp::Contrast::InputParameters::SquareContrastT);
107  m_ui->m_typeComboBox->addItem(tr("Square Root Constrast"), te::rp::Contrast::InputParameters::SquareRootContrastT);
108  m_ui->m_typeComboBox->addItem(tr("Log Constrast"), te::rp::Contrast::InputParameters::LogContrastT);
109 
114 
115  m_ui->m_visibleAreaRadioButton->setChecked(true);
116 
117  m_ui->m_allImageSummaryRadioButton->setChecked(true);
118 
119  //connect slots
120  connect(m_sliderWidget, SIGNAL(sliderValueChanged(int)), this, SLOT(onOpacityChanged(int)));
121  connect(m_sliderWidget, SIGNAL(sliderReleased()), this, SLOT(onSymbolizerChanged()));
122 
123  connect(m_ui->m_composeMRadioButton, SIGNAL(clicked()), this, SLOT(onMonoChannelSelectionClicked()));
124  connect(m_ui->m_composeRRadioButton, SIGNAL(clicked()), this, SLOT(onRedChannelSelectionClicked()));
125  connect(m_ui->m_composeGRadioButton, SIGNAL(clicked()), this, SLOT(onGreenChannelSelectionClicked()));
126  connect(m_ui->m_composeBRadioButton, SIGNAL(clicked()), this, SLOT(onBlueChannelSelectionClicked()));
127  connect(m_ui->m_composeCRadioButton, SIGNAL(clicked()), this, SLOT(onCompositionChannelSelectionClicked()));
128 
129  connect(m_ui->m_composeMComboBox, SIGNAL(activated(QString)), this, SLOT(onMonoChannelNameChanged(QString)));
130  connect(m_ui->m_composeRComboBox, SIGNAL(activated(QString)), this, SLOT(onRedChannelNameChanged(QString)));
131  connect(m_ui->m_composeGComboBox, SIGNAL(activated(QString)), this, SLOT(onGreenChannelNameChanged(QString)));
132  connect(m_ui->m_composeBComboBox, SIGNAL(activated(QString)), this, SLOT(onBlueChannelNameChanged(QString)));
133 
134  connect(m_ui->m_contrastTypeComboBox, SIGNAL(activated(QString)), this, SLOT(onTypeConstratChanged(QString)));
135 
136  connect(m_ui->m_contrastMHorizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(onMonoGammaChanged(int)));
137  connect(m_ui->m_contrastRHorizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(onRedGammaChanged(int)));
138  connect(m_ui->m_contrastGHorizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(onGreenGammaChanged(int)));
139  connect(m_ui->m_contrastBHorizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(onBlueGammaChanged(int)));
140 
141  connect(m_ui->m_contrastMHorizontalSlider, SIGNAL(sliderReleased()), this, SLOT(onSymbolizerChanged()));
142  connect(m_ui->m_contrastRHorizontalSlider, SIGNAL(sliderReleased()), this, SLOT(onSymbolizerChanged()));
143  connect(m_ui->m_contrastGHorizontalSlider, SIGNAL(sliderReleased()), this, SLOT(onSymbolizerChanged()));
144  connect(m_ui->m_contrastBHorizontalSlider, SIGNAL(sliderReleased()), this, SLOT(onSymbolizerChanged()));
145 
146  connect(m_ui->m_gainPlusPushButton, SIGNAL(clicked()), this, SLOT(onIncreaseGain()));
147  connect(m_ui->m_gainMinusPushButton, SIGNAL(clicked()), this, SLOT(onDecreaseGain()));
148  connect(m_ui->m_gainResetPushButton, SIGNAL(clicked()), this, SLOT(onDefaultGain()));
149  connect(m_ui->m_offsetPlusPushButton, SIGNAL(clicked()), this, SLOT(onIncreaseOffset()));
150  connect(m_ui->m_offsetMinusPushButton, SIGNAL(clicked()), this, SLOT(onDecreaseOffset()));
151  connect(m_ui->m_offsetResetPushButton, SIGNAL(clicked()), this, SLOT(onDefaultOffset()));
152 
153  connect(m_ui->m_dummyPushButton, SIGNAL(clicked()), this, SLOT(onDummyPushButtonClicked()));
154 
155  connect(m_ui->m_contrastGroupBox, SIGNAL(clicked()), this, SLOT(setContrastVisibility()));
156 
157  //contrast slots
158  connect(m_ui->m_histogramToolButton, SIGNAL(clicked()), this, SLOT(onHistogramToolButtonClicked()));
159  connect(m_ui->m_applyToolButton, SIGNAL(clicked()), this, SLOT(onApplyToolButtonClicked()));
160  connect(m_ui->m_resetToolButton, SIGNAL(clicked()), this, SLOT(onResetToolButtonClicked()));
161 
162  connect(m_ui->m_calcSummaryToolButton, SIGNAL(clicked()), this, SLOT(onCalcRasterSummaryClicked()));
163  connect(m_ui->m_resetSummaryToolButton, SIGNAL(clicked()), this, SLOT(onResetRasterSummaryTableClicked()));
164 
165  m_ui->m_histogramToolButton->setIcon(QIcon::fromTheme("chart-bar"));
166  m_ui->m_applyToolButton->setIcon(QIcon::fromTheme("check"));
167  m_ui->m_resetToolButton->setIcon(QIcon::fromTheme("edit-undo"));
168 
169  m_ui->m_calcSummaryToolButton->setIcon(QIcon::fromTheme("view-data-table"));
170  m_ui->m_resetSummaryToolButton->setIcon(QIcon::fromTheme("edit-undo"));
171 
172  QStringList list;
173  list.append(tr("Band"));
174  list.append(tr("Min"));
175  list.append(tr("Max"));
176  list.append(tr("Std Dev"));
177  list.append(tr("Mean"));
178 
179  m_ui->m_bandTableWidget->setColumnCount(5);
180  m_ui->m_bandTableWidget->setHorizontalHeaderLabels(list);
181 
182  m_ui->m_bandTableWidget->resizeColumnsToContents();
183  #if (QT_VERSION >= 0x050000)
184  m_ui->m_bandTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
185  #else
186  m_ui->m_bandTableWidget->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
187  #endif
188 
189  //init interface
190  initialize();
191 }
192 
194 {
195  delete m_contrast;
196 
197  m_ceNames.clear();
198 }
199 
201 {
202  assert(rs);
203 
204  m_setLocalSymbol = true;
205 
206  m_symbolizer = rs;
207 
209  {
211 
216 
218  {
219  m_ui->m_composeCRadioButton->setChecked(true);
220 
222  }
224  {
225  m_ui->m_composeMRadioButton->setChecked(true);
226 
228  }
230  {
231  m_ui->m_composeRRadioButton->setChecked(true);
232 
234  }
236  {
237  m_ui->m_composeGRadioButton->setChecked(true);
238 
240  }
242  {
243  m_ui->m_composeBRadioButton->setChecked(true);
244 
246  }
247 
248  m_contrastRed = nullptr;
250  {
252  }
253 
254  m_contrastGreen = nullptr;
256  {
258  }
259 
260  m_contrastBlue = nullptr;
262  {
264  }
265 
266  m_contrastMono = nullptr;
268  {
270  }
271  }
272  else
273  {
275  }
276 
277  updateUi();
278 
279  m_setLocalSymbol = false;
280 }
281 
283 {
284  delete m_contrast;
285 
286  m_contrast = new te::map::RasterContrast(*contrast);
287 }
288 
290 {
291  te::map::RasterContrast* rc = nullptr;
292 
293  if (m_contrast)
295 
296  return rc;
297 }
298 
300 {
301  if (!layer)
302  return;
303 
304  m_layer = layer;
305 
306  std::unique_ptr<te::da::DataSetType> dsType = m_layer->getSchema();
307 
309 
310  if (prop->getType() == te::dt::UCHAR_TYPE || prop->getType() == te::dt::UINT16_TYPE ||
311  prop->getType() == te::dt::UINT32_TYPE || prop->getType() == te::dt::UINT64_TYPE)
312  {
313  connect(m_histogramWidget, SIGNAL(minValueSelected(int, int)), this, SLOT(onMinValueSelected(int, int)));
314  connect(m_histogramWidget, SIGNAL(maxValueSelected(int, int)), this, SLOT(onMaxValueSelected(int, int)));
315  }
316  else
317  {
318  connect(m_histogramWidget, SIGNAL(minValueSelected(double, int)), this, SLOT(onMinValueSelected(double, int)));
319  connect(m_histogramWidget, SIGNAL(maxValueSelected(double, int)), this, SLOT(onMaxValueSelected(double, int)));
320  }
321 
323 
324  m_ui->m_inMinLineEdit->clear();
325  m_ui->m_inMaxLineEdit->clear();
326 
327  m_ui->m_gainLineEdit->clear();
328  m_ui->m_offset1LineEdit->clear();
329  m_ui->m_offset2LineEdit->clear();
330 
331  delete m_contrast;
332  m_contrast = nullptr;
333 }
334 
335 void te::qt::widgets::RasterSymbolizerWidget::setBandProperty(std::vector<te::rst::BandProperty*> bp)
336 {
337  QStringList bandNames;
338 
339  m_ui->m_bandComboBox->clear();
340 
341  for(size_t i = 0; i < bp.size(); ++i)
342  {
343  m_ui->m_bandComboBox->addItem(QString::number(i));
344 
345  // if the band property does not have the description information
346  // we must used the index information.
347  if(bp[i]->m_description.empty())
348  {
349  QString bandInfo;
350  bandInfo.setNum(bp[i]->m_idx);
351 
352  bandNames.push_back(bandInfo);
353  }
354  else
355  {
356  bandNames.push_back(bp[i]->m_description.c_str());
357  }
358 
359  if (i == 0)
360  {
361  if (bp[i]->m_noDataValue == std::numeric_limits<double>::max())
362  m_ui->m_rasterDummyLineEdit->clear();
363  else
364  m_ui->m_rasterDummyLineEdit->setText(QString::number(bp[i]->m_noDataValue));
365  }
366  }
367 
368  m_ui->m_composeMComboBox->clear();
369  m_ui->m_composeMComboBox->addItems(bandNames);
370 
371  m_ui->m_composeRComboBox->clear();
372  m_ui->m_composeRComboBox->addItems(bandNames);
373 
374  m_ui->m_composeGComboBox->clear();
375  m_ui->m_composeGComboBox->addItems(bandNames);
376 
377  m_ui->m_composeBComboBox->clear();
378  m_ui->m_composeBComboBox->addItems(bandNames);
379 }
380 
382 {
383  m_display = display;
384 }
385 
387 {
388  //set the pixmaps
389  m_ui->m_gainLabel->setPixmap(QIcon::fromTheme("gain").pixmap(16,16));
390  m_ui->m_offSetLabel->setPixmap(QIcon::fromTheme("offset").pixmap(16,16));
391  m_ui->m_gainPlusPushButton->setIcon(QIcon::fromTheme("list-add"));
392  m_ui->m_gainPlusPushButton->setIconSize(QSize(16,16));
393  m_ui->m_gainMinusPushButton->setIcon(QIcon::fromTheme("list-remove"));
394  m_ui->m_gainMinusPushButton->setIconSize(QSize(16,16));
395  m_ui->m_gainResetPushButton->setIcon(QIcon::fromTheme("edit-undo"));
396  m_ui->m_gainResetPushButton->setIconSize(QSize(16,16));
397  m_ui->m_offsetPlusPushButton->setIcon(QIcon::fromTheme("list-add"));
398  m_ui->m_offsetPlusPushButton->setIconSize(QSize(16,16));
399  m_ui->m_offsetMinusPushButton->setIcon(QIcon::fromTheme("list-remove"));
400  m_ui->m_offsetMinusPushButton->setIconSize(QSize(16,16));
401  m_ui->m_offsetResetPushButton->setIcon(QIcon::fromTheme("edit-undo"));
402  m_ui->m_offsetResetPushButton->setIconSize(QSize(16,16));
403 
404  m_ui->m_dummyPushButton->setIcon(QIcon::fromTheme("check"));
405  m_ui->m_dummyPushButton->setIconSize(QSize(16, 16));
406 
407  m_ui->m_composeMonoLabel->setPixmap(QIcon::fromTheme("bullet-black").pixmap(16,16));
408  m_ui->m_composeRedLabel->setPixmap(QIcon::fromTheme("bullet-red").pixmap(16,16));
409  m_ui->m_composeGreenLabel->setPixmap(QIcon::fromTheme("bullet-green").pixmap(16,16));
410  m_ui->m_composeBlueLabel->setPixmap(QIcon::fromTheme("bullet-blue").pixmap(16,16));
411 
412  m_ui->m_composeCRadioButton->setIcon(QIcon::fromTheme("channels").pixmap(16,16));
413  m_ui->m_composeRRadioButton->setIcon(QIcon::fromTheme("channel-red").pixmap(16,16));
414  m_ui->m_composeGRadioButton->setIcon(QIcon::fromTheme("channel-green").pixmap(16,16));
415  m_ui->m_composeBRadioButton->setIcon(QIcon::fromTheme("channel-blue").pixmap(16,16));
416  m_ui->m_composeMRadioButton->setIcon(QIcon::fromTheme("channel-gray").pixmap(16,16));
417 
418  m_ui->m_rContrastLabel->setPixmap(QIcon::fromTheme("contrast-red").pixmap(16,16));
419  m_ui->m_gContrastLabel->setPixmap(QIcon::fromTheme("contrast-green").pixmap(16,16));
420  m_ui->m_bContrastLabel->setPixmap(QIcon::fromTheme("contrast-blue").pixmap(16,16));
421  m_ui->m_mContrastLabel->setPixmap(QIcon::fromTheme("contrast-mono").pixmap(16,16));
422 
423  //set the contrast enhancement names
424  m_ceNames.clear();
425 
426  m_ceNames.insert(std::map<te::se::ContrastEnhancement::ContrastEnhancementType, QString>::value_type
428  m_ceNames.insert(std::map<te::se::ContrastEnhancement::ContrastEnhancementType, QString>::value_type
430  m_ceNames.insert(std::map<te::se::ContrastEnhancement::ContrastEnhancementType, QString>::value_type
432 
433  std::map<te::se::ContrastEnhancement::ContrastEnhancementType, QString>::iterator it = m_ceNames.begin();
434 
435  while(it != m_ceNames.end())
436  {
437  m_ui->m_contrastTypeComboBox->addItem(it->second);
438 
439  ++it;
440  }
441 
442  m_ui->m_contrastTypeComboBox->setCurrentIndex(m_ui->m_contrastTypeComboBox->findText(m_ceNames[te::se::ContrastEnhancement::ENHANCEMENT_NONE]));
443 
444  m_ui->m_contrastTypeComboBox->setVisible(false);
445  m_ui->m_contrastTypeLabel->setVisible(false);
446 
447  // other values
448  m_gainValue = 0.0;
449  m_offsetValue = 0.0;
452 
453  m_ui->m_gainValueLabel->setText(QString::number(m_gainValue + 1.));
454  m_ui->m_offSetValueLabel->setText(QString::number(m_offsetValue));
455  m_ui->m_dummyLineEdit->setValidator(new QDoubleValidator(this));
456 }
457 
459 {
460  if(m_symbolizer)
461  {
462  if(m_symbolizer->getOpacity())
463  {
464  double value = te::se::GetDouble(m_symbolizer->getOpacity()) * 100.;
465  m_sliderWidget->setCurrentValue((int)value);
466  }
467  else
468  {
470  }
471 
472  if(m_symbolizer->getGain())
473  {
476  }
477  else
478  {
479  QString s;
480  s.setNum(m_gainValue);
481  m_symbolizer->setGain(new te::se::ParameterValue(s.toUtf8().data()));
482  }
483 
484  m_ui->m_gainValueLabel->setText(QString::number(m_gainValue + 1.));
485 
486  if(m_symbolizer->getOffset())
487  {
490  }
491  else
492  {
493  QString s;
494  s.setNum(m_offsetValue);
495  m_symbolizer->setOffset(new te::se::ParameterValue(s.toUtf8().data()));
496  }
497 
498  m_ui->m_offSetValueLabel->setText(QString::number(m_offsetValue));
499 
500  //no data value
502  {
503  double value = te::se::GetDouble(m_symbolizer->getNoDataValue());
504  m_ui->m_dummyLineEdit->setText(QString::number(value));
505  }
506  else
507  {
508  m_ui->m_dummyLineEdit->clear();
509  }
510 
511  //update channel selection
512  m_ui->m_contrastGroupBox->setChecked(false);
513 
514  if(m_cs->getRedChannel())
515  {
517  int index = atoi(channel->getSourceChannelName().c_str());
518  m_ui->m_composeRComboBox->setCurrentIndex(index);
519 
520  if(channel->getContrastEnhancement())
521  {
523  double v = ce->getGammaValue() * 100.;
524  m_ui->m_contrastRHorizontalSlider->setValue((int)v);
525  m_ui->m_contrastTypeComboBox->setCurrentIndex(m_ui->m_contrastTypeComboBox->findText(m_ceNames[ce->getContrastEnhancementType()]));
526 
527  m_ui->m_contrastGroupBox->setChecked(true);
528  }
529  else
530  {
531  m_ui->m_contrastRHorizontalSlider->setValue(100.);
532  }
533  }
534 
535  if(m_cs->getGreenChannel())
536  {
538  int index = atoi(channel->getSourceChannelName().c_str());
539  m_ui->m_composeGComboBox->setCurrentIndex(index);
540 
541  if(channel->getContrastEnhancement())
542  {
544  double v = ce->getGammaValue() * 100.;
545  m_ui->m_contrastGHorizontalSlider->setValue((int)v);
546  m_ui->m_contrastTypeComboBox->setCurrentIndex(m_ui->m_contrastTypeComboBox->findText(m_ceNames[ce->getContrastEnhancementType()]));
547 
548  m_ui->m_contrastGroupBox->setChecked(true);
549  }
550  else
551  {
552  m_ui->m_contrastGHorizontalSlider->setValue(100.);
553  }
554  }
555 
556  if(m_cs->getBlueChannel())
557  {
559  int index = atoi(channel->getSourceChannelName().c_str());
560  m_ui->m_composeBComboBox->setCurrentIndex(index);
561 
562  if(channel->getContrastEnhancement())
563  {
565  double v = ce->getGammaValue() * 100.;
566  m_ui->m_contrastBHorizontalSlider->setValue((int)v);
567  m_ui->m_contrastTypeComboBox->setCurrentIndex(m_ui->m_contrastTypeComboBox->findText(m_ceNames[ce->getContrastEnhancementType()]));
568 
569  m_ui->m_contrastGroupBox->setChecked(true);
570  }
571  else
572  {
573  m_ui->m_contrastBHorizontalSlider->setValue(100.);
574  }
575  }
576 
577  if(m_cs->getGrayChannel())
578  {
580  int index = atoi(channel->getSourceChannelName().c_str());
581  m_ui->m_composeMComboBox->setCurrentIndex(index);
582 
583  if(channel->getContrastEnhancement())
584  {
586  double v = ce->getGammaValue() * 100.;
587  m_ui->m_contrastMHorizontalSlider->setValue((int)v);
588  m_ui->m_contrastTypeComboBox->setCurrentIndex(m_ui->m_contrastTypeComboBox->findText(m_ceNames[ce->getContrastEnhancementType()]));
589 
590  m_ui->m_contrastGroupBox->setChecked(true);
591  }
592  else
593  {
594  m_ui->m_contrastMHorizontalSlider->setValue(100.);
595  }
596  }
597  }
598 
600 }
601 
602 void te::qt::widgets::RasterSymbolizerWidget::setComboBoxText(QComboBox* cb, std::string value)
603 {
604  QString name = value.c_str();
605 
606  bool found = false;
607 
608  for(int i = 0; i < cb->count(); ++i)
609  {
610  if(cb->itemText(i) == name)
611  {
612  cb->setCurrentIndex(i);
613  found = true;
614  break;
615  }
616  }
617 
618  if(!found)
619  {
620  cb->addItem(name);
621  cb->setCurrentIndex(cb->count() - 1);
622  }
623 }
624 
626 {
627  if(m_symbolizer)
628  {
629  int opacity = value;
630  double seOpacity = opacity / 100.;
631  QString qStrOpacity;
632  qStrOpacity.setNum(seOpacity);
633 
634  m_symbolizer->setOpacity(new te::se::ParameterValue(qStrOpacity.toUtf8().data()));
635  }
636 }
637 
639 {
640  m_ui->m_composeMComboBox->setEnabled(true);
641  m_ui->m_composeRComboBox->setEnabled(false);
642  m_ui->m_composeGComboBox->setEnabled(false);
643  m_ui->m_composeBComboBox->setEnabled(false);
644 
645  if(m_scMono == nullptr)
646  {
648  m_scMono->setSourceChannelName(std::to_string(m_ui->m_composeMComboBox->currentIndex()));
650  }
651 
653 
655 
657 }
658 
660 {
661  m_ui->m_composeMComboBox->setEnabled(false);
662  m_ui->m_composeRComboBox->setEnabled(true);
663  m_ui->m_composeGComboBox->setEnabled(false);
664  m_ui->m_composeBComboBox->setEnabled(false);
665 
666  if(m_scRed == nullptr)
667  {
669  m_scRed->setSourceChannelName(std::to_string(m_ui->m_composeRComboBox->currentIndex()));
671  }
672 
674 
676 
678 }
679 
681 {
682  m_ui->m_composeMComboBox->setEnabled(false);
683  m_ui->m_composeRComboBox->setEnabled(false);
684  m_ui->m_composeGComboBox->setEnabled(true);
685  m_ui->m_composeBComboBox->setEnabled(false);
686 
687  if(m_scGreen== nullptr)
688  {
690  m_scGreen->setSourceChannelName(std::to_string(m_ui->m_composeGComboBox->currentIndex()));
692  }
693 
695 
697 
699 }
700 
702 {
703  m_ui->m_composeMComboBox->setEnabled(false);
704  m_ui->m_composeRComboBox->setEnabled(false);
705  m_ui->m_composeGComboBox->setEnabled(false);
706  m_ui->m_composeBComboBox->setEnabled(true);
707 
708  if(m_scBlue== nullptr)
709  {
711  m_scBlue->setSourceChannelName(std::to_string(m_ui->m_composeBComboBox->currentIndex()));
713  }
714 
716 
718 
720 }
721 
723 {
724  m_ui->m_composeMComboBox->setEnabled(false);
725  m_ui->m_composeRComboBox->setEnabled(true);
726  m_ui->m_composeGComboBox->setEnabled(true);
727  m_ui->m_composeBComboBox->setEnabled(true);
728 
729  if(m_scRed == nullptr)
730  {
732  m_scRed->setSourceChannelName(std::to_string(m_ui->m_composeRComboBox->currentIndex()));
734  }
735 
736  if(m_scGreen== nullptr)
737  {
739  m_scGreen->setSourceChannelName(std::to_string(m_ui->m_composeGComboBox->currentIndex()));
741  }
742 
743  if(m_scBlue== nullptr)
744  {
746  m_scBlue->setSourceChannelName(std::to_string(m_ui->m_composeBComboBox->currentIndex()));
748  }
749 
751 
753 
755 }
756 
758 {
759  m_scMono->setSourceChannelName(std::to_string(m_ui->m_composeMComboBox->findText(s)));
760 
762 }
763 
765 {
766  m_scRed->setSourceChannelName(std::to_string(m_ui->m_composeRComboBox->findText(s)));
767 
769 }
770 
772 {
773  m_scGreen->setSourceChannelName(std::to_string(m_ui->m_composeGComboBox->findText(s)));
774 
776 }
777 
779 {
780  m_scBlue->setSourceChannelName(std::to_string(m_ui->m_composeBComboBox->findText(s)));
781 
783 }
784 
786 {
787  if(m_contrastRed == nullptr)
788  {
791  }
792 
793  if(m_contrastGreen == nullptr)
794  {
797  }
798 
799  if(m_contrastBlue == nullptr)
800  {
803  }
804 
805  if(m_contrastMono == nullptr)
806  {
809  }
810 
811  std::map<te::se::ContrastEnhancement::ContrastEnhancementType, QString>::iterator it = m_ceNames.begin();
812 
813  while(it != m_ceNames.end())
814  {
815  if(it->second == s)
816  {
821 
822  break;
823  }
824 
825  ++it;
826  }
827 
829 }
830 
832 {
833  if(m_contrastMono == nullptr)
834  {
837  }
838 
839  double value = double(v) / 100.;
840 
842 }
843 
845 {
846  if(m_contrastRed == nullptr)
847  {
850  }
851 
852  double value = double(v) / 100.;
853 
855 }
856 
858 {
859  if(m_contrastGreen == nullptr)
860  {
863  }
864 
865  double value = double(v) / 100.;
866 
868 }
869 
871 {
872  if(m_contrastBlue == nullptr)
873  {
876  }
877 
878  double value = double(v) / 100.;
879 
881 }
882 
884 {
886 
887  QString s;
888  s.setNum(m_gainValue);
889 
890  if(m_symbolizer)
891  {
892  m_symbolizer->setGain(new te::se::ParameterValue(s.toUtf8().data()));
893 
895  }
896 
897  m_ui->m_gainValueLabel->setText(QString::number(m_gainValue + 1.));
898 }
899 
901 {
903 
904  QString s;
905  s.setNum(m_gainValue);
906 
907  if(m_symbolizer)
908  {
909  m_symbolizer->setGain(new te::se::ParameterValue(s.toUtf8().data()));
910 
912  }
913 
914  m_ui->m_gainValueLabel->setText(QString::number(m_gainValue + 1.));
915 }
916 
918 {
920 
921  QString s;
922  s.setNum(m_gainValue);
923 
924  if(m_symbolizer)
925  {
926  m_symbolizer->setGain(new te::se::ParameterValue(s.toUtf8().data()));
927 
929  }
930 
931  m_ui->m_gainValueLabel->setText(QString::number(m_gainValue + 1.));
932 }
933 
935 {
937 
938  QString s;
939  s.setNum(m_offsetValue);
940 
941  if(m_symbolizer)
942  {
943  m_symbolizer->setOffset(new te::se::ParameterValue(s.toUtf8().data()));
944 
946  }
947 
948  m_ui->m_offSetValueLabel->setText(QString::number(m_offsetValue));
949 }
950 
952 {
954 
955  QString s;
956  s.setNum(m_offsetValue);
957 
958  if(m_symbolizer)
959  {
960  m_symbolizer->setOffset(new te::se::ParameterValue(s.toUtf8().data()));
961 
963  }
964 
965  m_ui->m_offSetValueLabel->setText(QString::number(m_offsetValue));
966 }
967 
969 {
971 
972  QString s;
973  s.setNum(m_offsetValue);
974 
975  if(m_symbolizer)
976  {
977  m_symbolizer->setOffset(new te::se::ParameterValue(s.toUtf8().data()));
978 
980  }
981 
982  m_ui->m_offSetValueLabel->setText(QString::number(m_offsetValue));
983 }
984 
986 {
987  if (m_setLocalSymbol)
988  return;
989 
990  emit symbolizerChanged();
991 }
992 
994 {
995  if (m_ui->m_dummyLineEdit->text().isEmpty())
996  {
997  if (m_symbolizer)
998  m_symbolizer->setNoDataValue(nullptr);
999  }
1000  else
1001  {
1002  if (m_symbolizer)
1003  m_symbolizer->setNoDataValue(new te::se::ParameterValue(m_ui->m_dummyLineEdit->text().toUtf8().data()));
1004  }
1005 
1007 }
1008 
1010 {
1011  if(m_ui->m_contrastGroupBox->isChecked() == false)
1012  {
1013  m_ui->m_contrastRHorizontalSlider->setValue(100);
1014  m_ui->m_contrastGHorizontalSlider->setValue(100);
1015  m_ui->m_contrastBHorizontalSlider->setValue(100);
1016  m_ui->m_contrastMHorizontalSlider->setValue(100);
1017 
1018  if (m_contrastMono)
1019  {
1020  m_scMono->setContrastEnhancement(nullptr);
1021  m_contrastMono = nullptr;
1022  }
1023 
1024  if (m_contrastRed)
1025  {
1026  m_scRed->setContrastEnhancement(nullptr);
1027  m_contrastRed = nullptr;
1028  }
1029 
1030  if (m_contrastGreen)
1031  {
1033  m_contrastGreen = nullptr;
1034  }
1035 
1036  if (m_contrastBlue)
1037  {
1038  m_scBlue->setContrastEnhancement(nullptr);
1039  m_contrastBlue = nullptr;
1040  }
1041 
1043 
1044  return;
1045  }
1046 
1047  m_ui->m_contrastRHorizontalSlider->setEnabled(false);
1048  m_ui->m_contrastGHorizontalSlider->setEnabled(false);
1049  m_ui->m_contrastBHorizontalSlider->setEnabled(false);
1050  m_ui->m_contrastMHorizontalSlider->setEnabled(false);
1051 
1052  if(m_ui->m_composeMRadioButton->isChecked())
1053  {
1054  m_ui->m_contrastMHorizontalSlider->setEnabled(true);
1055  }
1056 
1057  if(m_ui->m_composeRRadioButton->isChecked())
1058  {
1059  m_ui->m_contrastRHorizontalSlider->setEnabled(true);
1060  }
1061 
1062  if(m_ui->m_composeGRadioButton->isChecked())
1063  {
1064  m_ui->m_contrastGHorizontalSlider->setEnabled(true);
1065  }
1066 
1067  if(m_ui->m_composeBRadioButton->isChecked())
1068  {
1069  m_ui->m_contrastBHorizontalSlider->setEnabled(true);
1070  }
1071 
1072  if(m_ui->m_composeCRadioButton->isChecked())
1073  {
1074  m_ui->m_contrastRHorizontalSlider->setEnabled(true);
1075  m_ui->m_contrastGHorizontalSlider->setEnabled(true);
1076  m_ui->m_contrastBHorizontalSlider->setEnabled(true);
1077  }
1078 }
1079 
1081 {
1082  int bandIdx = m_ui->m_bandComboBox->currentText().toInt();
1083 
1084  std::unique_ptr<te::rst::Raster> raster(te::map::GetRaster(m_layer));
1085 
1086  te::gm::Envelope* visibleAreaRasterProj = nullptr;
1087 
1088  if (m_display)
1089  {
1090  visibleAreaRasterProj = new te::gm::Envelope(m_display->getExtent());
1091  visibleAreaRasterProj->transform(m_display->getSRID(), m_layer->getSRID());
1092 
1093  std::map<std::string, std::string> info;
1094  info["FORCE_MEM_DRIVER"] = "TRUE";
1095 
1096  if(m_ui->m_visibleAreaRadioButton->isChecked())
1097  {
1098  raster.reset(raster->trim(visibleAreaRasterProj, info));
1099  }
1100  else
1101  {
1103 
1104  std::unique_ptr<te::rst::Raster> rasterExt(te::map::GetRaster(m_layer));
1105 
1106  raster.reset(rasterExt->trim(env, info));
1107 
1108  double resx = visibleAreaRasterProj->getWidth() / static_cast<double>(m_display->getWidth());
1109  double resy = visibleAreaRasterProj->getHeight() / static_cast<double>(m_display->getHeight());
1110 
1111  double rx = resx / raster->getResolutionX();
1112  double ry = resy / raster->getResolutionY();
1113 
1114  double factor = std::min(rx, ry);
1115  factor = std::max(factor, 1.0);
1116 
1117  std::size_t level = static_cast<std::size_t>(std::log(factor) / std::log(2.0));
1118  std::size_t numberOfLevels = raster->getMultiResLevelsCount();
1119 
1120  te::rst::Raster* overview = nullptr;
1121 
1122  if (level != 0 && numberOfLevels != 0) // need overview? has overview?
1123  {
1124  if (numberOfLevels >= level)
1125  overview = raster->getMultiResLevel(static_cast<unsigned int>(level - 1));
1126  else
1127  overview = raster->getMultiResLevel(static_cast<unsigned int>(numberOfLevels - 1));
1128 
1129  //adjust raster overview parameters
1130 
1131  if (raster->getNumberOfBands() == overview->getNumberOfBands())
1132  {
1133  for (std::size_t t = 0; t < raster->getNumberOfBands(); ++t)
1134  {
1135  te::rst::BandProperty* bp = raster->getBand(t)->getProperty();
1136  te::rst::BandProperty* bpOverView = overview->getBand(t)->getProperty();
1137  bpOverView->m_noDataValue = bp->m_noDataValue;
1138  bpOverView->m_min = bp->m_min;
1139  bpOverView->m_max = bp->m_max;
1140  }
1141  }
1142 
1143  overview->getGrid()->setSRID(raster->getSRID());
1144 
1145  raster.reset(overview);
1146  }
1147 
1148  delete env;
1149  }
1150  }
1151 
1152  te::qt::widgets::ScopedCursor c(Qt::WaitCursor);
1153 
1154  m_histogramWidget->setInputRaster(raster.get());
1155 
1156  double min = 0.;
1157  double max = 0.;
1158 
1159  te::rst::BandProperty* bp = raster->getBand(bandIdx)->getProperty();
1160 
1161  if (bp->m_min != std::numeric_limits<double>::max() &&
1162  bp->m_max != std::numeric_limits<double>::max())
1163  {
1164  min = bp->m_min;
1165  max = bp->m_max;
1166  }
1167  else
1168  {
1169  te::rst::GetDataTypeRanges(bp->getType(), min, max);
1170  }
1171 
1174 
1175  m_histogramWidget->updateMinimumValueLabel(tr("Suggested Minimum"));
1176  m_histogramWidget->updateMaximumValueLabel(tr("Suggested Maximum"));
1177 
1178  m_ui->m_inMinLineEdit->setText(QString::number(min));
1179  m_ui->m_inMaxLineEdit->setText(QString::number(max));
1180 
1181  if (m_contrast)
1182  {
1183  std::vector<double> gain, offset1, offset2, min, max;
1184  m_contrast->getValues(gain, offset1, offset2, min, max);
1185 
1186  m_ui->m_gainLineEdit->setText(QString::number(gain[bandIdx]));
1187  m_ui->m_offset1LineEdit->setText(QString::number(offset1[bandIdx]));
1188  m_ui->m_offset2LineEdit->setText(QString::number(offset2[bandIdx]));
1189 
1190 
1191  // only set minimum and maximum values if values was defined by user
1192  bool defaultValues = false;
1193 
1194  if (gain[bandIdx] == 1. && offset1[bandIdx] == 0. && offset2[bandIdx] == 0.)
1195  defaultValues = true;
1196 
1197  if (!defaultValues)
1198  {
1199  m_ui->m_inMinLineEdit->setText(QString::number(min[bandIdx]));
1200  m_ui->m_inMaxLineEdit->setText(QString::number(max[bandIdx]));
1201 
1202  m_histogramWidget->updateMinimumValueLine(min[bandIdx], false);
1203  m_histogramWidget->updateMaximumValueLine(max[bandIdx], false);
1204 
1205  m_histogramWidget->updateMinimumValueLabel(tr("Acquired Minimum"));
1206  m_histogramWidget->updateMaximumValueLabel(tr("Acquired Maximum"));
1207  }
1208  }
1209 
1210  m_histogramWidget->drawHistogram(bandIdx);
1211 }
1212 
1214  int /*band*/)
1215 {
1216  m_ui->m_inMinLineEdit->setText(QString::number(value));
1217 
1219 }
1220 
1222  int /*band*/)
1223 {
1224  m_ui->m_inMaxLineEdit->setText(QString::number(value));
1225 
1227 }
1228 
1230  int /*band*/)
1231 {
1232  m_ui->m_inMinLineEdit->setText(QString::number(value));
1233 
1235 }
1236 
1238  int /*band*/)
1239 {
1240  m_ui->m_inMaxLineEdit->setText(QString::number(value));
1241 
1243 }
1244 
1246 {
1247  delete m_contrast;
1248  m_contrast = nullptr;
1249 
1250  if (m_layer)
1251  m_layer->setRasterContrast(nullptr);
1252 
1253  m_ui->m_gainLineEdit->clear();
1254  m_ui->m_offset1LineEdit->clear();
1255  m_ui->m_offset2LineEdit->clear();
1256 
1257  m_ui->m_inMinLineEdit->clear();
1258  m_ui->m_inMaxLineEdit->clear();
1259 
1261 
1262  emit contrastChanged(false);
1263 
1265 
1266  emit mapRefresh();
1267 }
1268 
1270 {
1271  int type = m_ui->m_typeComboBox->currentData().toInt();
1273 
1274  if (!m_contrast)
1275  {
1276  m_contrast = new te::map::RasterContrast((te::map::RasterTransform::ContrastType)typeMapped, m_ui->m_bandComboBox->count());
1277  }
1278 
1279  if (m_ui->m_inMinLineEdit->text().isEmpty() || m_ui->m_inMaxLineEdit->text().isEmpty())
1280  {
1281  QMessageBox::warning(this, tr("Warning"), tr("Input values not defined."));
1282  return;
1283  }
1284 
1285  double minValue = m_ui->m_inMinLineEdit->text().toDouble();
1286  double maxValue = m_ui->m_inMaxLineEdit->text().toDouble();
1287 
1288  if (minValue >= maxValue)
1289  {
1290  QMessageBox::warning(this, tr("Warning"), tr("Invalid input values."));
1291  return;
1292  }
1293 
1294  double gain, offset1, offset2;
1295 
1296  if (te::rp::Contrast::getGainAndOffset((te::rp::Contrast::InputParameters::ContrastType)type, minValue, maxValue, 0., 255., gain, offset1, offset2))
1297  {
1298  int bandIdx = m_ui->m_bandComboBox->currentText().toInt();
1299 
1300  m_contrast->setValues(gain, offset1, offset2, minValue, maxValue, bandIdx);
1301 
1302  m_ui->m_gainLineEdit->setText(QString::number(gain));
1303  m_ui->m_offset1LineEdit->setText(QString::number(offset1));
1304  m_ui->m_offset2LineEdit->setText(QString::number(offset2));
1305 
1306  emit contrastChanged(false);
1307 
1309 
1310  emit mapRefresh();
1311  }
1312  else
1313  {
1314  QMessageBox::warning(this, tr("Warning"), tr("Internal error."));
1315  return;
1316  }
1317 }
1318 
1320 {
1321  std::unique_ptr<te::rst::Raster> inputRaster(te::map::GetRaster(m_layer));
1322 
1323  m_ui->m_bandTableWidget->setRowCount((int)inputRaster->getNumberOfBands());
1324 
1325  if(m_display)
1326  {
1327  te::gm::Envelope* visibleAreaRasterProj = nullptr;
1328  visibleAreaRasterProj = new te::gm::Envelope(m_display->getExtent());
1329  visibleAreaRasterProj->transform(m_display->getSRID(), m_layer->getSRID());
1330 
1331  std::map<std::string, std::string> info;
1332  info["FORCE_MEM_DRIVER"] = "TRUE";
1333 
1334  if(m_ui->m_visibleAreaSummaryRadioButton->isChecked())
1335  {
1336  inputRaster.reset(inputRaster->trim(visibleAreaRasterProj, info));
1337 
1338  te::qt::widgets::ScopedCursor c(Qt::WaitCursor);
1339  }
1340  }
1341 
1342  for(std::size_t i = 0; i < inputRaster->getNumberOfBands(); ++i)
1343  {
1344  const std::complex<double>* minRs = te::rst::RasterSummaryManager::getInstance().get(inputRaster.get(), te::rst::SUMMARY_MIN, true)->at(i).m_minVal;
1345  const std::complex<double>* maxRs = te::rst::RasterSummaryManager::getInstance().get(inputRaster.get(), te::rst::SUMMARY_MAX, true)->at(i).m_maxVal;
1346  const std::complex<double>* stdRs = te::rst::RasterSummaryManager::getInstance().get(inputRaster.get(), te::rst::SUMMARY_STD)->at(i).m_stdVal;
1347  const std::complex<double>* meanRs = te::rst::RasterSummaryManager::getInstance().get(inputRaster.get(), te::rst::SUMMARY_MEAN)->at(i).m_meanVal;
1348 
1349  QTableWidgetItem* itemBand = new QTableWidgetItem(QString::number(i));
1350  itemBand->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable);
1351  m_ui->m_bandTableWidget->setItem(i, 0, itemBand);
1352 
1353  QTableWidgetItem* itemMin = new QTableWidgetItem(te::common::Convert2String(minRs->real(), 2).c_str());
1354  itemMin->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable);
1355  m_ui->m_bandTableWidget->setItem(i, 1, itemMin);
1356 
1357  QTableWidgetItem* itemMax = new QTableWidgetItem(te::common::Convert2String(maxRs->real(), 2).c_str());
1358  itemMax->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable);
1359  m_ui->m_bandTableWidget->setItem(i, 2, itemMax);
1360 
1361  QTableWidgetItem* itemStd = new QTableWidgetItem(te::common::Convert2String(stdRs->real(), 2).c_str());
1362  itemStd->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable);
1363  m_ui->m_bandTableWidget->setItem(i, 3, itemStd);
1364 
1365  QTableWidgetItem* itemMean = new QTableWidgetItem(te::common::Convert2String(meanRs->real(), 2).c_str());
1366  itemMean->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable);
1367  m_ui->m_bandTableWidget->setItem(i, 4, itemMean);
1368  }
1369 }
1370 
1372 {
1373  m_ui->m_bandTableWidget->setRowCount(0);
1374 }
std::map< te::se::ContrastEnhancement::ContrastEnhancementType, QString > m_ceNames
Contrast Types Names.
TEDATAACCESSEXPORT te::rst::RasterProperty * GetFirstRasterProperty(const DataSetType *dt)
void setComboBoxText(QComboBox *cb, std::string value)
void setRedChannel(SelectedChannel *c)
A selected channel to be display.
te::se::ContrastEnhancement * m_contrastBlue
SE Contrast element for blue band.
void setValues(const double &gain, const double &offset1, const double &offset2, const double &min, const double &max, const std::size_t &band)
It set the transformation values for contranst of one band.
void adjustDisplay()
Updates the general display settings according to the ChartStyle. The adjusted properties are: Title;...
unsigned int getWidth() const
It returns the MapDisplay current width in pixels.
TERASTEREXPORT void GetDataTypeRanges(const int &dataType, double &min, double &max)
Return the values range of a given data type.
This is the base class for layers.
Definition: AbstractLayer.h:77
virtual const te::gm::Envelope & getExtent() const
It returns the Layer extent (or minimum bounding box).
te::qt::widgets::ChartDisplay * m_chartDisplay
A raster band description.
Definition: BandProperty.h:61
virtual void setRasterContrast(te::map::RasterContrast *contrast)
It sets the raster contrast associated to the Layer.
std::unique_ptr< Ui::RasterSymbolizerWidgetForm > m_ui
Widget form.
te::se::SelectedChannel * m_scBlue
SE Selected Channel element for red band.
ParameterValue * getOffset() const
void setGridChecked(bool newGridChecked)
It sets the boolean used to decided weather to display the grid or not.
Definition: ChartStyle.cpp:155
void setGain(ParameterValue *p)
double m_min
Minimum pixel value (default is std::numeric_limits<double>::max() which means no value set)...
Definition: BandProperty.h:147
static bool getGainAndOffset(const InputParameters::ContrastType &type, const double &inRangeMin, const double &inRangeMax, const double &outRangeMin, const double &outRangeMax, double &gain, double &offset1, double &offset2)
Returns gain and offset values for contrast types (when applicable).
void initialize()
Internal method to initialize the widget (e.g.: color, combos, icons, etc.)
RasterSymbolizerWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a RasterSymbolizerWidget dialog which is a child of parent, with widget flags set to f...
te::se::ChannelSelection * getChannelSelection() const
double getWidth() const
It returns the envelope width.
SelectedChannel * getRedChannel() const
void setGammaValue(const double &v)
TESEEXPORT double GetDouble(const te::se::ParameterValue *param)
It gets the parameter value as a double.
A widget to control the display of a set of layers.
void setGrayChannel(SelectedChannel *c)
void setMapDisplay(te::qt::widgets::MapDisplay *display)
SelectedChannel * getBlueChannel() const
te::se::SelectedChannel * m_scMono
SE Selected Channel element for red band.
double m_noDataValue
Value to indicate elements where there is no data, default is std::numeric_limits<double>::max().
Definition: BandProperty.h:136
double m_max
Maximum pixel value (default is std::numeric_limits<double>::max() which means no value set)...
Definition: BandProperty.h:148
The "ParameterValueType" uses WFS-Filter expressions to give values for SE graphic parameters...
void setLayer(te::map::AbstractLayer *layer)
Raster property.
te::se::SelectedChannel * m_scRed
SE Selected Channel element for red band.
std::string getSourceChannelName() const
double m_offsetValue
Value used to define the offset value.
double m_offsetOriginalValue
Value used to define the offset value.
ParameterValue * getGain() const
te::se::ContrastEnhancement * m_contrastMono
SE Contrast element for mono band.
This class is used to define a component for viewing overlaid layers.
void updateMaximumValueLine(int value, bool replot=false)
te::se::SelectedChannel * m_scGreen
SE Selected Channel element for red band.
te::map::RasterContrast * m_contrast
Raster Contrast element.
static RasterSummaryManager & getInstance()
It returns a reference to the singleton instance.
An Envelope defines a 2D rectangular region.
An abstract class for raster data strucutures.
void setAxisY(QString newAxisY)
It sets the style&#39;s y axis label.
Definition: ChartStyle.cpp:101
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
virtual int getSRID() const
It return the Spatial Reference System used by the Map Display.
void setNoDataValue(ParameterValue *p)
Calculate the standard deviation value.
BandProperty * getProperty()
Returns the band property.
void setColorCompositionType(ColorCompositionType cct)
virtual std::unique_ptr< LayerSchema > getSchema() const =0
It returns the layer schema.
ParameterValue * getOpacity() const
URI C++ Library.
Definition: Attributes.h:37
te::se::ChannelSelection * m_cs
SE Channel Selection element.
ContrastEnhancement defines the &#39;stretching&#39; of contrast for a channel of a false-color image or for ...
A widget used to configure a Raster Symbolizer SE element.
void setChannelSelection(ChannelSelection *c)
#define OFFSET_CONSTANT_VALUE
ColorCompositionType getColorCompositionType() const
virtual const te::gm::Envelope & getExtent() const
It returns the world extent showned by the MapDisplay.
void setAxisX(QString newAxisX)
It sets the style&#39;s x axis label.
Definition: ChartStyle.cpp:91
double m_gainOriginalValue
Value used to define the gain value.
The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos...
void setOpacity(ParameterValue *p)
virtual const Band * getBand(std::size_t i) const =0
Returns the raster i-th band.
virtual Raster * getMultiResLevel(const unsigned int level) const =0
Returns the required level of a multi-resolution pyramid or NULL if that level does not exists...
Grid * getGrid()
It returns the raster grid.
#define GAIN_CONSTANT_VALUE
te::qt::widgets::HorizontalSliderWidget * m_sliderWidget
Slider widget used for opacity information.
te::qt::widgets::ChartStyle * m_chartStyle
void updateMinimumValueLine(int value, bool replot=false)
te::se::ContrastEnhancement * m_contrastGreen
SE Contrast element for green band.
int getType() const
It returns the property data type.
Definition: Property.h:161
This class contains the parameters needed to apply dynamic contrast over a raster.
TEMAPEXPORT te::rst::Raster * GetRaster(AbstractLayer *layer)
It gets the raster referenced by the given data set layer.
ContrastEnhancementType getContrastEnhancementType() const
te::se::ContrastEnhancement * m_contrastRed
SE Contrast element for red band.
void setContrastEnhancementType(ContrastEnhancementType t)
unsigned int getHeight() const
It returns the MapDisplay current height in pixels.
SelectedChannel * getGreenChannel() const
te::qt::widgets::RasterHistogramWidget * m_histogramWidget
Histogram widget.
ContrastEnhancement * getContrastEnhancement() const
void setRasterSymbolizer(te::se::RasterSymbolizer *rs)
void setOffset(ParameterValue *p)
std::map< te::rp::Contrast::InputParameters::ContrastType, te::map::RasterTransform::ContrastType > m_contrastMap
Contrast Types Names.
void setContrastEnhancement(ContrastEnhancement *c)
void setSourceChannelName(const std::string &name)
double m_gainValue
Value used to define the gain value.
te::se::RasterSymbolizer * m_symbolizer
SE Raster Symbolizer element.
virtual int getSRID() const
It returns the Spatial Reference System ID associated to the Layer.
int getType() const
It returns the data type of the elements in the band.
Definition: BandProperty.h:113
void setSRID(int srid)
Just sets the grid spatial reference system identifier.
void updateUi()
Updates the widget form based on internal mark element.
std::string Convert2String(boost::int16_t value)
It converts a short integer value to a string.
Definition: StringUtils.h:56
void getValues(std::vector< double > &gain, std::vector< double > &offset1, std::vector< double > &offset2, std::vector< double > &min, std::vector< double > &max)
It get the contrast transformation values.
Calculate the min value.
void setBandProperty(std::vector< te::rst::BandProperty * > bp)
void setBlueChannel(SelectedChannel *c)
ParameterValue * getNoDataValue() const
SelectedChannel * getGrayChannel() const
Calculate the max value.
void transform(int oldsrid, int newsrid)
It will transform the coordinates of the Envelope from the old SRS to the new one.
Calculate the mean value.
double getHeight() const
It returns the envelope height.
void setRasterContrast(te::map::RasterContrast *contrast)
An object that when created shows a cursor during its scope.
Definition: ScopedCursor.h:48
void setGreenChannel(SelectedChannel *c)
void setInputRaster(te::rst::Raster *raster)