27 #include "../../af/ApplicationController.h" 28 #include "../../../raster/Grid.h" 29 #include "../../../common/progress/ProgressManager.h" 30 #include "../../../common/StringUtils.h" 31 #include "../../../dataaccess/dataset/DataSet.h" 32 #include "../../../dataaccess/utils/Utils.h" 33 #include "../../../geometry/GeometryProperty.h" 34 #include "../../../geometry/Utils.h" 35 #include "../../../memory/DataSet.h" 36 #include "../../../memory/DataSetItem.h" 37 #include "../../../raster/Raster.h" 38 #include "../../../raster/RasterProperty.h" 39 #include "../../../raster/RasterSummaryManager.h" 40 #include "../../../raster/Utils.h" 41 #include "../../../maptools/Utils.h" 42 #include "../../../rp/Module.h" 43 #include "../../../qt/widgets/rp/Utils.h" 44 #include "../../../qt/widgets/utils/ScopedCursor.h" 45 #include "../../../se/CoverageStyle.h" 46 #include "../../../se/RasterSymbolizer.h" 47 #include "../../../se/Rule.h" 48 #include "../../../se/SelectedChannel.h" 49 #include "../../../se/Symbolizer.h" 50 #include "../../../se/Utils.h" 51 #include "../../af/ApplicationController.h" 52 #include "../../af/events/ApplicationEvents.h" 53 #include "../../af/events/LayerEvents.h" 54 #include "../../widgets/tools/ExtentAcquire.h" 55 #include "../canvas/Canvas.h" 56 #include "../progress/ProgressViewerDialog.h" 62 #include "ui_ContrastDialogForm.h" 65 #include <QGridLayout> 66 #include <QMessageBox> 69 #include <boost/lexical_cast.hpp> 78 m_outputWidget(nullptr),
91 QGridLayout* histogramLayout =
new QGridLayout(
m_ui->m_histWidget);
94 histogramLayout->setContentsMargins(0,0,0,0);
96 QGridLayout* displayLayout =
new QGridLayout(
m_ui->m_navigatorWidget);
99 displayLayout->setContentsMargins(0, 0, 0, 0);
101 m_ui->m_navigatorWidget->setEnabled(
true);
103 m_ui->m_resetToolButton->setIcon(QIcon::fromTheme(
"edit-undo"));
106 QGridLayout* outputLayout =
new QGridLayout(
m_ui->m_outputWidget);
107 outputLayout->setContentsMargins(0, 0, 0, 0);
113 connect(
m_ui->m_bandTableWidget, SIGNAL(cellClicked(
int,
int)),
this, SLOT(
onCellClicked(
int,
int)));
114 connect(
m_ui->m_bandTableWidget, SIGNAL(cellDoubleClicked(
int,
int)),
this, SLOT(
onCellDoubleClicked(
int,
int)));
115 connect(
m_ui->m_bandTableWidget, SIGNAL(cellChanged(
int,
int)),
this, SLOT(
onCellChanged(
int,
int)));
126 m_ui->m_helpPushButton->setNameSpace(
"dpi.inpe.br.plugins");
127 m_ui->m_helpPushButton->setPageReference(
"plugins/rp/rp_contrast.html");
141 for (std::size_t
b = 0;
b < raster->getNumberOfBands(); ++
b)
145 const std::complex<double>* cmin = rsMin->at(
b).m_minVal;
146 const std::complex<double>* cmax = rsMax->at(
b).m_maxVal;
147 double min = cmin->real();
148 double max = cmax->real();
173 m_ui->m_roiRadioButton->setChecked(
true);
202 int index =
m_ui->m_contrastTypeComboBox->currentIndex();
203 int contrastType =
m_ui->m_contrastTypeComboBox->itemData(index).toInt();
204 int nBands =
m_ui->m_bandTableWidget->rowCount();
212 for(
int i = 0; i < nBands; ++i)
214 QCheckBox* bandCheckBox = (QCheckBox*)
m_ui->m_bandTableWidget->cellWidget(i, 0);
216 if(bandCheckBox->isChecked())
218 QTableWidgetItem* item =
m_ui->m_bandTableWidget->item(i, 1);
219 QTableWidgetItem* item1 =
m_ui->m_bandTableWidget->item(i, 2);
223 QString valueMin = item->text();
224 algoInputParams.
m_lCMinInput.push_back(valueMin.toDouble());
229 QString valueMax = item1->text();
230 algoInputParams.
m_lCMaxInput.push_back(valueMax.toDouble());
239 for(
int i = 0; i < nBands; ++i)
241 QCheckBox* bandCheckBox = (QCheckBox*)
m_ui->m_bandTableWidget->cellWidget(i, 0);
243 if(bandCheckBox->isChecked())
245 QTableWidgetItem* item =
m_ui->m_bandTableWidget->item(i, 1);
249 QString valueMax = item->text();
250 algoInputParams.
m_hECMaxInput.push_back(valueMax.toDouble());
259 for(
int i = 0; i < nBands; ++i)
261 QCheckBox* bandCheckBox = (QCheckBox*)
m_ui->m_bandTableWidget->cellWidget(i, 0);
263 if(bandCheckBox->isChecked())
265 QTableWidgetItem* item =
m_ui->m_bandTableWidget->item(i, 1);
266 QTableWidgetItem* item1 =
m_ui->m_bandTableWidget->item(i, 2);
270 QString valueMean = item->text();
276 QString valueStdDev = item1->text();
286 for(
int i = 0; i < nBands; ++i)
288 QCheckBox* bandCheckBox = (QCheckBox*)
m_ui->m_bandTableWidget->cellWidget(i, 0);
290 if(bandCheckBox->isChecked())
292 QTableWidgetItem* item =
m_ui->m_bandTableWidget->item(i, 1);
293 QTableWidgetItem* item1 =
m_ui->m_bandTableWidget->item(i, 2);
297 QString valueMin = item->text();
303 QString valueMax = item1->text();
313 for(
int i = 0; i < nBands; ++i)
315 QCheckBox* bandCheckBox = (QCheckBox*)
m_ui->m_bandTableWidget->cellWidget(i, 0);
317 if(bandCheckBox->isChecked())
319 QTableWidgetItem* item =
m_ui->m_bandTableWidget->item(i, 1);
320 QTableWidgetItem* item1 =
m_ui->m_bandTableWidget->item(i, 2);
324 QString valueMin = item->text();
330 QString valueMax = item1->text();
340 for(
int i = 0; i < nBands; ++i)
342 QCheckBox* bandCheckBox = (QCheckBox*)
m_ui->m_bandTableWidget->cellWidget(i, 0);
344 if(bandCheckBox->isChecked())
346 QTableWidgetItem* item =
m_ui->m_bandTableWidget->item(i, 1);
350 QString valueMin = item->text();
354 QTableWidgetItem* item1 =
m_ui->m_bandTableWidget->item(i, 2);
358 QString valueMax = item1->text();
369 QVector<unsigned int> bandsSelected;
371 for(
int i = 0; i < nBands; ++i)
373 QCheckBox* bandCheckBox = (QCheckBox*)
m_ui->m_bandTableWidget->cellWidget(i, 0);
375 if(bandCheckBox->isChecked())
376 bandsSelected.push_back(i);
381 QString bRed = QString::fromStdString(
getChannelSelection()->getRedChannel()->getSourceChannelName());
383 QString bGreen = QString::fromStdString(
getChannelSelection()->getGreenChannel()->getSourceChannelName());
385 QString bBlue = QString::fromStdString(
getChannelSelection()->getBlueChannel()->getSourceChannelName());
389 if(bandsSelected.contains(bRed.toInt()))
392 if(bandsSelected.contains(bGreen.toInt()))
395 if(bandsSelected.contains(bBlue.toInt()))
401 return algoInputParams;
419 std::map<std::string, std::string> info;
420 info[
"FORCE_MEM_DRIVER"] =
"TRUE";
422 m_raster.reset(raster->trim(env, info));
426 if(
m_ui->m_previewCheckBox->isChecked())
436 m_ui->m_contrastTypeComboBox->clear();
457 m_ui->m_bandTableWidget->setRowCount((
int)inputRst->getNumberOfBands());
459 for (std::size_t
b = 0;
b < inputRst->getNumberOfBands(); ++
b)
461 QString bandName(tr(
"Band "));
462 bandName.append(QString::number(
b));
464 QCheckBox* bandCheckBox =
new QCheckBox(bandName,
this);
465 bandCheckBox->setChecked(
true);
467 connect(bandCheckBox, SIGNAL(stateChanged(
int)),
this, SLOT(
onBandChecked()));
469 m_ui->m_bandTableWidget->setCellWidget(static_cast<int>(
b), 0, bandCheckBox);
474 m_ui->m_bandTableWidget->resizeColumnsToContents();
476 m_ui->m_bandTableWidget->selectRow(0);
478 #if (QT_VERSION >= 0x050000) 479 m_ui->m_bandTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
481 m_ui->m_bandTableWidget->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
502 double vmin = std::numeric_limits<double>::max();
503 double vmax = std::numeric_limits<double>::min();
508 double range = vmax - vmin;
509 unsigned int nbits = (
unsigned int)(std::ceil(log(range) / log(2.)));
510 double maxValue = (double)(pow(2.0, (
double)nbits)) - 1;
517 std::map<std::string, std::string> rinfo;
518 rinfo[
"MEM_RASTER_NROWS"] = boost::lexical_cast<std::string>(
m_raster->getNumberOfRows());
519 rinfo[
"MEM_RASTER_NCOLS"] = boost::lexical_cast<std::string>(
m_raster->getNumberOfColumns());
520 rinfo[
"MEM_RASTER_DATATYPE"] = boost::lexical_cast<std::string>(
m_raster->getBandDataType(0));
521 rinfo[
"MEM_RASTER_NBANDS"] = boost::lexical_cast<std::string>(
m_raster->getNumberOfBands());
531 if (algorithmInstance.
initialize(algoInputParams))
533 if (algorithmInstance.
execute(algoOutputParams))
541 if (
m_ui->m_previewCheckBox->isChecked())
550 QMessageBox::warning(
this, tr(
"Warning"), tr(
"Constrast error."));
552 QApplication::restoreOverrideCursor();
566 std::map<std::string, std::string> info;
567 info[
"FORCE_MEM_DRIVER"] =
"TRUE";
570 m_raster.reset(raster->trim(env, info));
574 if(
m_ui->m_previewCheckBox->isChecked())
585 QMessageBox::warning(
this, tr(
"Contrast"), tr(
"File already exists."));
589 if(
m_ui->m_roiRadioButton->isChecked())
593 QMessageBox::warning(
this, tr(
"Contrast"), tr(
"The region of interest informed is invalid."));
607 double vmin = std::numeric_limits<double>::max();
608 double vmax = std::numeric_limits<double>::min();
613 double range = vmax - vmin;
614 unsigned int nbits = (
unsigned int)(std::ceil(log(range) / log(2.)));
615 double maxValue = (double)(pow(2.0, (
double)nbits)) - 1;
632 if (algorithmInstance.
initialize(algoInputParams))
634 if (algorithmInstance.
execute(algoOutputParams))
636 algoOutputParams.
reset();
642 QMessageBox::information(
this, tr(
"Contrast"), tr(
"Contrast enhencement ended sucessfully"));
646 QMessageBox::critical(
this, tr(
"Contrast"), tr(
"Contrast enhencement execution error.") +
649 QApplication::restoreOverrideCursor();
656 QMessageBox::critical(
this, tr(
"Contrast"), tr(
"Contrast enhencement initialization error.") +
659 QApplication::restoreOverrideCursor();
664 catch (
const std::exception& e)
666 QMessageBox::warning(
this, tr(
"Contrast"), e.what());
668 QApplication::restoreOverrideCursor();
674 QMessageBox::warning(
this, tr(
"Contrast"), tr(
"An exception has occurred!"));
676 QApplication::restoreOverrideCursor();
692 canvasInstance.
clear();
708 const std::vector<te::se::Symbolizer*>& symbolizers = rule->
getSymbolizers();
709 assert(!symbolizers.empty());
715 return symbolizer->getChannelSelection();
727 std::unique_ptr<te::da::DataSetType> dsType = layer->getSchema();
729 if (!dsType->hasRaster())
731 QMessageBox::warning(
this, tr(
"Warning"), tr(
"There is no selected raster layer."));
733 m_ui->m_typeGroupBox->setEnabled(
false);
734 m_ui->m_bandsGroupBox->setEnabled(
false);
735 m_ui->m_histogramGroupBox->setEnabled(
false);
736 m_ui->m_histWidget->setEnabled(
false);
737 m_ui->m_histAreaGroupBox->setEnabled(
false);
738 m_ui->m_outputWidget->setEnabled(
false);
742 m_ui->m_bandTableWidget->setRowCount(0);
753 QMessageBox::warning(
this, tr(
"Warning"), tr(
"Layers without Band information!"));
755 m_ui->m_typeGroupBox->setEnabled(
false);
756 m_ui->m_bandsGroupBox->setEnabled(
false);
757 m_ui->m_histogramGroupBox->setEnabled(
false);
758 m_ui->m_histWidget->setEnabled(
false);
759 m_ui->m_histAreaGroupBox->setEnabled(
false);
760 m_ui->m_outputWidget->setEnabled(
false);
764 m_ui->m_bandTableWidget->setRowCount(0);
773 QMessageBox::warning(
this, tr(
"Warning"), tr(
"Layers with raster palette are not able to apply contrast!"));
775 m_ui->m_typeGroupBox->setEnabled(
false);
776 m_ui->m_bandsGroupBox->setEnabled(
false);
777 m_ui->m_histogramGroupBox->setEnabled(
false);
778 m_ui->m_histWidget->setEnabled(
false);
779 m_ui->m_histAreaGroupBox->setEnabled(
false);
780 m_ui->m_outputWidget->setEnabled(
false);
784 m_ui->m_bandTableWidget->setRowCount(0);
793 m_ui->m_typeGroupBox->setEnabled(
true);
794 m_ui->m_bandsGroupBox->setEnabled(
true);
795 m_ui->m_histogramGroupBox->setEnabled(
true);
796 m_ui->m_histWidget->setEnabled(
true);
797 m_ui->m_histAreaGroupBox->setEnabled(
true);
798 m_ui->m_outputWidget->setEnabled(
true);
804 m_ui->m_bandTableWidget->setRowCount(0);
806 m_ui->m_roiRadioButton->setChecked(
true);
810 std::list<te::map::AbstractLayerPtr> layerList;
811 layerList.push_back(layer);
826 m_ui->m_bandTableWidget->setEnabled(
false);
848 if (
m_ui->m_roiRadioButton->isChecked())
859 m_ui->m_bandTableWidget->setEnabled(
true);
863 delete canvasInstance;
878 canvasInstance.setPolygonContourWidth(2);
884 canvasInstance.draw(
m_geom.get());
891 int row =
m_ui->m_bandTableWidget->currentRow();
900 if(
m_ui->m_bandTableWidget->horizontalHeaderItem(2) &&
m_ui->m_bandTableWidget->horizontalHeaderItem(2)->text() == tr(
"Minimum") &&
901 m_ui->m_bandTableWidget->horizontalHeaderItem(3) &&
m_ui->m_bandTableWidget->horizontalHeaderItem(3)->text() == tr(
"Maximum"))
907 list.append(tr(
"Band"));
908 list.append(tr(
"Minimum"));
909 list.append(tr(
"Maximum"));
911 m_ui->m_bandTableWidget->setColumnCount(3);
912 m_ui->m_bandTableWidget->setHorizontalHeaderLabels(list);
914 int nBands =
m_ui->m_bandTableWidget->rowCount();
916 for(
int i = 0; i < nBands; ++i)
919 itemMin->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable);
920 m_ui->m_bandTableWidget->setItem(i, 1, itemMin);
923 itemMax->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable);
924 m_ui->m_bandTableWidget->setItem(i, 2, itemMax);
937 m_ui->m_tipLabel->setText(tr(
"Use left button to set minimum value and right button to define maximum value over the histogram."));
942 list.append(tr(
"Band"));
943 list.append(tr(
"Maximum"));
945 m_ui->m_bandTableWidget->setColumnCount(2);
946 m_ui->m_bandTableWidget->setHorizontalHeaderLabels(list);
949 int nBands =
m_ui->m_bandTableWidget->rowCount();
950 double currentRowMaxValue = 0;
952 for(
int i = 0; i < nBands; ++i)
954 const int bandDataType = raster->getBand( i )->getProperty()->m_type;
957 double bandMaxValue = isRealValuesBand ? 255.0 :
m_maxValue[i];
960 itemMax->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable);
961 m_ui->m_bandTableWidget->setItem(i, 1, itemMax);
965 currentRowMaxValue = bandMaxValue;
976 m_ui->m_tipLabel->setText(tr(
"Use left button to set maximum value over the histogram."));
981 list.append(tr(
"Band"));
982 list.append(tr(
"Mean"));
983 list.append(tr(
"Std Dev"));
985 m_ui->m_bandTableWidget->setColumnCount(3);
986 m_ui->m_bandTableWidget->setHorizontalHeaderLabels(list);
988 int nBands =
m_ui->m_bandTableWidget->rowCount();
990 for(
int i = 0; i < nBands; ++i)
992 QTableWidgetItem* itemMean =
new QTableWidgetItem(
"127");
993 itemMean->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable);
994 m_ui->m_bandTableWidget->setItem(i, 1, itemMean);
996 QTableWidgetItem* itemStdDev =
new QTableWidgetItem(
"50");
997 itemStdDev->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable);
998 m_ui->m_bandTableWidget->setItem(i, 2, itemStdDev);
1010 m_ui->m_tipLabel->setText(tr(
"Use left button to set Mean value and right button to define Std Dev value over the histogram."));
1015 list.append(tr(
"Band"));
1017 m_ui->m_bandTableWidget->setColumnCount(1);
1018 m_ui->m_bandTableWidget->setHorizontalHeaderLabels(list);
1023 m_ui->m_tipLabel->setText(tr(
""));
1031 m_ui->m_bandTableWidget->resizeColumnsToContents();
1032 #if (QT_VERSION >= 0x050000) 1033 m_ui->m_bandTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
1035 m_ui->m_bandTableWidget->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
1041 int contrastType =
m_ui->m_contrastTypeComboBox->itemData(index).toInt();
1048 QCheckBox* bandCheckBox = (QCheckBox*)
m_ui->m_bandTableWidget->cellWidget(row, 0);
1050 if(bandCheckBox->isChecked())
1059 m_lastText =
m_ui->m_bandTableWidget->item(row, column)->text().toUtf8().data();
1067 m_ui->m_bandTableWidget->item(row, column)->text().toDouble(&isNumeric);
1071 m_ui->m_bandTableWidget->item(row, column)->setText(
m_lastText.c_str());
1079 int index =
m_ui->m_contrastTypeComboBox->currentIndex();
1081 int contrastType =
m_ui->m_contrastTypeComboBox->itemData(index).toInt();
1095 int value =
m_ui->m_bandTableWidget->item(row, column)->text().toDouble();
1096 int maxValue =
m_ui->m_bandTableWidget->item(row, 2)->text().toDouble();
1098 if(value > maxValue)
1100 m_ui->m_bandTableWidget->item(row, column)->setText(
m_lastText.c_str());
1108 double value =
m_ui->m_bandTableWidget->item(row, column)->text().toDouble();
1109 double maxValue =
m_ui->m_bandTableWidget->item(row, 2)->text().toDouble();
1111 if(value > maxValue)
1113 m_ui->m_bandTableWidget->item(row, column)->setText(
m_lastText.c_str());
1126 int minValue =
m_ui->m_bandTableWidget->item(row, column)->text().toDouble();
1132 double minValue =
m_ui->m_bandTableWidget->item(row, column)->text().toDouble();
1138 else if(column == 2)
1148 int value =
m_ui->m_bandTableWidget->item(row, column)->text().toDouble();
1149 int minValue =
m_ui->m_bandTableWidget->item(row, 1)->text().toDouble();
1151 if(value < minValue)
1153 m_ui->m_bandTableWidget->item(row, column)->setText(
m_lastText.c_str());
1161 double value =
m_ui->m_bandTableWidget->item(row, column)->text().toDouble();
1162 double minValue =
m_ui->m_bandTableWidget->item(row, 1)->text().toDouble();
1164 if(value < minValue)
1166 m_ui->m_bandTableWidget->item(row, column)->setText(
m_lastText.c_str());
1178 int maxValue =
m_ui->m_bandTableWidget->item(row, column)->text().toDouble();
1184 double maxValue =
m_ui->m_bandTableWidget->item(row, column)->text().toDouble();
1203 int row =
m_ui->m_bandTableWidget->currentRow();
1205 int index =
m_ui->m_contrastTypeComboBox->currentIndex();
1207 int contrastType =
m_ui->m_contrastTypeComboBox->itemData(index).toInt();
1214 int max =
m_ui->m_bandTableWidget->item(row, 2)->text().toDouble();
1219 m_ui->m_bandTableWidget->item(row, 1)->setText(QString::number(value));
1220 m_ui->m_bandTableWidget->setCurrentCell(row, 1);
1226 m_ui->m_bandTableWidget->item(row, 1)->setText(QString::number(value));
1227 m_ui->m_bandTableWidget->setCurrentCell(row, 1);
1233 m_ui->m_bandTableWidget->item(row, 1)->setText(QString::number(value));
1234 m_ui->m_bandTableWidget->setCurrentCell(row, 1);
1252 int row =
m_ui->m_bandTableWidget->currentRow();
1254 int index =
m_ui->m_contrastTypeComboBox->currentIndex();
1256 int contrastType =
m_ui->m_contrastTypeComboBox->itemData(index).toInt();
1263 double max =
m_ui->m_bandTableWidget->item(row, 2)->text().toDouble();
1268 m_ui->m_bandTableWidget->item(row, 1)->setText(QString::number(value));
1269 m_ui->m_bandTableWidget->setCurrentCell(row, 1);
1275 m_ui->m_bandTableWidget->item(row, 1)->setText(QString::number(value));
1276 m_ui->m_bandTableWidget->setCurrentCell(row, 1);
1282 m_ui->m_bandTableWidget->item(row, 1)->setText(QString::number(value));
1283 m_ui->m_bandTableWidget->setCurrentCell(row, 1);
1301 int row =
m_ui->m_bandTableWidget->currentRow();
1303 int index =
m_ui->m_contrastTypeComboBox->currentIndex();
1305 int contrastType =
m_ui->m_contrastTypeComboBox->itemData(index).toInt();
1312 int min =
m_ui->m_bandTableWidget->item(row, 1)->text().toDouble();
1317 m_ui->m_bandTableWidget->item(row, 2)->setText(QString::number(value));
1318 m_ui->m_bandTableWidget->setCurrentCell(row, 2);
1324 if (!
m_ui->m_bandTableWidget->item(row, 1)->text().isEmpty())
1326 double mean =
m_ui->m_bandTableWidget->item(row, 1)->text().toDouble();
1328 double stdDev = std::abs(mean - (
double)value);
1330 m_ui->m_bandTableWidget->item(row, 2)->setText(QString::number(stdDev));
1331 m_ui->m_bandTableWidget->setCurrentCell(row, 2);
1350 int row =
m_ui->m_bandTableWidget->currentRow();
1352 int index =
m_ui->m_contrastTypeComboBox->currentIndex();
1354 int contrastType =
m_ui->m_contrastTypeComboBox->itemData(index).toInt();
1361 double min =
m_ui->m_bandTableWidget->item(row, 1)->text().toDouble();
1366 m_ui->m_bandTableWidget->item(row, 2)->setText(QString::number(value));
1367 m_ui->m_bandTableWidget->setCurrentCell(row, 2);
1373 if (!
m_ui->m_bandTableWidget->item(row, 1)->text().isEmpty())
1375 double mean =
m_ui->m_bandTableWidget->item(row, 1)->text().toDouble();
1377 double stdDev = std::abs(mean - value);
1379 m_ui->m_bandTableWidget->item(row, 2)->setText(QString::number(stdDev));
1380 m_ui->m_bandTableWidget->setCurrentCell(row, 2);
1396 QMessageBox::information(
this, tr(
"Contrast"), tr(
"Output image is not defined."));
1402 QMessageBox::information(
this, tr(
"Contrast"), tr(
"Invalid number of bands."));
1408 QMessageBox::information(
this, tr(
"Contrast"), tr(
"Error to apply contrast."));
1434 m_ui->m_navigatorWidget->setEnabled(
true);
1439 m_ui->m_navigatorWidget->setEnabled(
false);
1451 m_ui->m_navigatorWidget->setEnabled(
false);
1458 if (!reprojectedBBOX.intersects(
m_layer->getExtent()))
1460 QMessageBox::warning(
this, tr(
"Warning"), tr(
"Visible area doesn't intersect with the layer."));
1479 for(
int i = 0; i <=
m_ui->m_bandTableWidget->currentRow(); ++i)
1481 QCheckBox* bandCheckBox = (QCheckBox*)
m_ui->m_bandTableWidget->cellWidget(i, 0);
1483 if(bandCheckBox->isChecked())
1495 int index =
m_ui->m_contrastTypeComboBox->currentIndex();
1497 int contrastType =
m_ui->m_contrastTypeComboBox->itemData(index).toInt();
1504 QTableWidgetItem* item =
m_ui->m_bandTableWidget->item(bandIdx, 1);
1505 QTableWidgetItem* item1 =
m_ui->m_bandTableWidget->item(bandIdx, 2);
1509 double min = item->text().toDouble();
1510 double max = item1->text().toDouble();
1518 QTableWidgetItem* item =
m_ui->m_bandTableWidget->item(bandIdx, 1);
1521 double min = item->text().toDouble();
1528 QTableWidgetItem* item =
m_ui->m_bandTableWidget->item(bandIdx, 1);
1529 QTableWidgetItem* item1 =
m_ui->m_bandTableWidget->item(bandIdx, 2);
1533 double min = item->text().toDouble();
1534 double max = item1->text().toDouble();
1553 if (layer ==
nullptr)
1566 if (
m_ui->m_previewCheckBox->isChecked())
1593 for(
unsigned int i = 0; i < inputRst->getNumberOfBands(); ++i)
1595 QCheckBox* bandCheckBox = (QCheckBox*)
m_ui->m_bandTableWidget->cellWidget(i, 0);
1597 if(bandCheckBox->isChecked())
1614 int index =
m_ui->m_contrastTypeComboBox->currentIndex();
const std::string & getErrorMessage() const
Return the current error message if there is any.
te::gm::Envelope * getExtent()
Returns the geographic extension of the raster data.
TEDATAACCESSEXPORT te::rst::RasterProperty * GetFirstRasterProperty(const DataSetType *dt)
Palette indexes color interpretation.
te::rst::Raster * m_outRasterPtr
A pointer to a valid initiated raster instance where the result must be written, leave NULL to create...
bool intersects(const Envelope &rhs) const
It returns true if the envelopes "spatially intersects".
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
TEMAPEXPORT te::gm::Envelope GetExtent(const std::list< te::map::AbstractLayerPtr > &layers, int srid, bool onlyVisibles)
It calculates the extent of the given layers in the given SRID.
A base class for application events.
The CoverageStyle defines the styling that is to be applied to a subset of Coverage data...
TESEEXPORT Style * CreateCoverageStyle(const std::vector< te::rst::BandProperty * > &properties)
Try creates an appropriate coverage style based on given band properties.
te::map::AbstractLayerPtr m_layer
Pointer to the selected layer.
double m_urx
Upper right corner x-coordinate.
#define TE_OPAQUE
For an RGBA color this is the value of the alpha-channel for totally opaque.
Rule * getRule(std::size_t i) const
This event indicates that the layer has been selected.
virtual void setLayerList(const std::list< te::map::AbstractLayerPtr > &layers)
It sets the layer list to be showed in the Map Display.
TEMAPEXPORT void DrawRaster(te::da::DataSetType *type, te::da::DataSourcePtr ds, Canvas *canvas, const te::gm::Envelope &bbox, int bboxSRID, const te::gm::Envelope &visibleArea, int srid, te::se::CoverageStyle *style, te::map::RasterContrast *rc, const double &scale, bool *cancel)
double m_llx
Lower left corner x-coordinate.
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.
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
std::vector< unsigned int > m_outRasterBands
Bands to be processed from the output raster.
virtual int getSRID() const
It return the Spatial Reference System used by the Map Display.
virtual const te::gm::Envelope & getExtent() const
It returns the world extent showned by the MapDisplay.
boost::ptr_vector< BandSummary > RasterSummary
RasterSummary is just a typedef of a boost::ptr_vector.
virtual AbstractData * clone() const =0
It returns a clone of this object.
The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos...
A base class for values that can be retrieved from the data access module.
Utility functions for the data access module.
const std::vector< Symbolizer * > & getSymbolizers() const
double m_lly
Lower left corner y-coordinate.
rasterPointer reset(te::rst::RasterFactory::make("MEM", new te::rst::Grid(nCols, nLines), bandsProps, std::map< std::string, std::string >(), 0, 0))
TEMAPEXPORT te::rst::Raster * GetRaster(AbstractLayer *layer)
It gets the raster referenced by the given data set layer.
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
int getSRID() const
Returns the raster spatial reference system identifier.
std::unique_ptr< te::rst::Raster > m_createdOutRasterPtr
A pointer to the created output raster instance, or an empty pointer empty if the result must be writ...
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
double m_ury
Upper right corner y-coordinate.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
std::string m_createdOutRasterDSType
Output raster data source type (as described in te::raster::RasterFactory ), leave empty if the resul...
std::vector< te::rst::BandProperty * > & getBandProperties()
Returns a reference to the list of bands definitions.
std::string Convert2String(boost::int16_t value)
It converts a short integer value to a string.
Envelope intersection(const Envelope &rhs) const
It returns an envelope that represents the point set intersection with another envelope.
Contrast output parameters.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
void transform(int oldsrid, int newsrid)
It will transform the coordinates of the Envelope from the old SRS to the new one.
std::map< std::string, std::string > m_createdOutRasterInfo
The necessary information to create the raster (as described in te::raster::RasterFactory), leave empty if the result must be written to the raster pointed m_outRasterPtr.
bool isValid() const
It tells if the rectangle is valid or not.
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope.
ChannelSelection specifies the false-color channel selection for a multi-spectral raster source (such...