27 #include "../../af/ApplicationController.h" 28 #include "../../../common/Exception.h" 29 #include "../../../common/STLUtils.h" 30 #include "../../../dataaccess/dataset/DataSet.h" 31 #include "../../../dataaccess/utils/Utils.h" 32 #include "../../../geometry/CurvePolygon.h" 33 #include "../../../geometry/Enums.h" 34 #include "../../../geometry/Point.h" 35 #include "../../../geometry/Polygon.h" 36 #include "../../../geometry/Utils.h" 37 #include "../../../maptools/MarkRendererManager.h" 38 #include "../../../maptools/Utils.h" 39 #include "../../../raster/PositionIterator.h" 40 #include "../../../raster/Raster.h" 41 #include "../../../rp/MixtureModel.h" 42 #include "../../../rp/MixtureModelLinearStrategy.h" 43 #include "../../../rp/MixtureModelPCAStrategy.h" 44 #include "../../../se/Fill.h" 45 #include "../../../se/Mark.h" 46 #include "../../../se/Stroke.h" 47 #include "../../../se/Utils.h" 48 #include "../canvas/Canvas.h" 49 #include "../canvas/MapDisplay.h" 55 #include "../../widgets/tools/PointPicker.h" 57 #include "ui_MixtureModelWizardPageForm.h" 60 #include <QAbstractItemModel> 61 #include <QPushButton> 62 #include <QColorDialog> 63 #include <QFileDialog> 64 #include <QGridLayout> 65 #include <QMessageBox> 68 #include <boost/lexical_cast.hpp> 69 #include <boost/property_tree/ptree.hpp> 70 #include <boost/property_tree/json_parser.hpp> 71 #include <boost/uuid/random_generator.hpp> 72 #include <boost/uuid/uuid_io.hpp> 79 #include <qwt_symbol.h> 82 #define PATTERN_SIZE 12 86 m_ui(new
Ui::MixtureModelWizardPageForm),
94 m_ui->m_loadToolButton->setIcon(QIcon::fromTheme(
"document-open"));
95 m_ui->m_saveToolButton->setIcon(QIcon::fromTheme(
"document-save"));
107 QObject::connect(
m_ui->m_typeComboBox, SIGNAL(currentIndexChanged(
const QString &)),
this, SLOT(
onMixturetypeChanged()));
109 m_ui->m_noDataValueLineEdit->setValidator(
new QDoubleValidator(
this));
122 connect(
m_ui->m_allRadioButton, SIGNAL(toggled(
bool)),
this, SLOT(
onallEnabled(
bool)));
125 QGridLayout* layout =
new QGridLayout(
m_ui->m_navigatorWidget);
128 layout->setContentsMargins(0, 0, 0, 0);
129 layout->setSizeConstraint(QLayout::SetMinimumSize);
137 this->setTitle(tr(
"Mixture Model"));
138 this->setSubTitle(tr(
"Select the type of mixture model and set their specific parameters."));
140 m_ui->m_removeToolButton->setIcon(QIcon::fromTheme(
"edit-deletetool"));
147 m_chartStyle->
setTitle(tr(
"Spectral Curves"));
148 m_chartStyle->
setAxisX(tr(
"Wave Lenght"));
149 m_chartStyle->
setAxisY(tr(
"Answer"));
156 m_graphic->setOrientation(Qt::Horizontal);
157 m_graphic->attach(m_chartDisplay);
166 m_ui->m_colorToolButton->setIcon(px);
184 std::map<std::string, MixModelComponent>::iterator it =
m_components.begin();
187 delete (*it).second.m_geomGeo;
188 delete (*it).second.m_geomGrid;
189 (*it).second.m_values.clear();
197 if(
m_ui->m_componentTreeWidget->selectedItems().size() == 0)
200 int nBands =
m_ui->m_bandTableWidget->rowCount();
202 bool isChecked =
false;
204 std::size_t count = 0;
205 for(
int i = 0; i < nBands; ++i)
207 QCheckBox* checkBox = (QCheckBox*)
m_ui->m_bandTableWidget->cellWidget(i, 0);
209 if(checkBox->isChecked())
229 while (
m_ui->m_bandTableWidget->rowCount())
230 m_ui->m_bandTableWidget->removeRow(0);
257 int idx =
m_ui->m_typeComboBox->currentIndex();
258 int type =
m_ui->m_typeComboBox->itemData(idx).toInt();
276 unsigned selectedBands = 0;
277 std::vector<bool> selectedBandsVector;
279 for (
int i = 0; i <
m_ui->m_bandTableWidget->rowCount(); ++i)
281 QCheckBox* bandCheckBox = (QCheckBox*)
m_ui->m_bandTableWidget->cellWidget(i, 0);
283 if (bandCheckBox->isChecked())
285 selectedBandsVector.push_back(
true);
290 QComboBox *sensorComboBox = (QComboBox*)
m_ui->m_bandTableWidget->cellWidget(i, 1);
291 algoInputParams.
m_inputSensorBands.push_back(std::string(sensorComboBox->currentText().toUtf8().data()));
294 selectedBandsVector.push_back(
false);
298 std::map<std::string, MixModelComponent>::iterator it =
m_components.begin();
299 std::vector<double> components;
305 for (
unsigned int i = 0; i < selectedBandsVector.size(); i++)
306 if (selectedBandsVector[i])
307 components.push_back(it->second.m_values[i]);
309 algoInputParams.
m_components[it->second.m_name] = components;
314 if (
m_ui->m_noDataValueCheckBox->isChecked() && !
m_ui->m_noDataValueLineEdit->text().isEmpty())
320 return algoInputParams;
325 return m_ui->m_decomposeCheckBox->isChecked();
337 return algoOutputParams;
342 boost::property_tree::ptree pt;
343 std::map<std::string, MixModelComponent >::iterator it =
m_components.begin();
344 boost::property_tree::ptree children;
345 boost::property_tree::ptree
bands;
346 boost::property_tree::ptree srid;
348 for (
int b = 0;
b <
m_ui->m_bandTableWidget->rowCount();
b++)
350 QCheckBox* bandCheckBox = (QCheckBox*)
m_ui->m_bandTableWidget->cellWidget(
b, 0);
351 QComboBox *sensorComboBox = (QComboBox*)
m_ui->m_bandTableWidget->cellWidget(
b, 1);
353 boost::property_tree::ptree
band;
355 band.put(
"band", boost::lexical_cast<std::string>(
b));
356 band.put(
"use", bandCheckBox->isChecked() ?
"true" :
"false");
357 band.put(
"sensor", sensorComboBox->currentText().toUtf8().data());
359 bands.push_back(std::make_pair(
"Band", band));
362 pt.add_child(
"Band_Sensors", bands);
366 pt.put(
"SRID", inputRst->getSRID());
370 boost::property_tree::ptree child;
372 child.put(
"name", it->second.m_name);
374 boost::property_tree::ptree coordGrid;
375 boost::property_tree::ptree coordGeo;
376 std::string type = it->second.m_geomGeo->getGeometryType();
380 coordGrid.put(
"xGrid", pgrid->
getX());
381 coordGrid.put(
"yGrid", pgrid->
getY());
382 child.push_back(std::make_pair(
"coordGrid", coordGrid));
385 coordGeo.put(
"xGeo", pgeo->
getX());
386 coordGeo.put(
"yGeo", pgeo->
getY());
387 child.push_back(std::make_pair(
"coordGeo", coordGeo));
394 boost::property_tree::ptree ptgrid, ptgeo;
396 for (
size_t pt = 0; pt < npts; pt++)
398 boost::property_tree::ptree val;
399 val.put(
"xGrid", lgrid->
getPointN(pt)->getX());
400 val.put(
"yGrid", lgrid->
getPointN(pt)->getY());
401 ptgrid.push_back(std::make_pair(
"", val));
403 child.add_child(
"geomGrid", ptgrid);
408 for (
size_t pt = 0; pt < npts; pt++)
410 boost::property_tree::ptree val;
411 val.put(
"xGeo", lgeo->
getPointN(pt)->getX());
412 val.put(
"yGeo", lgeo->
getPointN(pt)->getY());
413 ptgeo.push_back(std::make_pair(
"", val));
415 child.add_child(
"geomCoord", ptgeo);
418 child.put(
"Color", it->second.m_color.getColor());
419 children.push_back(std::make_pair(
"Component", child));
424 pt.add_child(
"MixModel_Components", children);
433 if (algorithmInstance.
initialize(algoInputParams))
438 boost::property_tree::ptree matrix_node;
441 boost::property_tree::ptree row;
444 boost::property_tree::ptree cell;
446 row.push_back(std::make_pair(
"", cell));
448 matrix_node.push_back(std::make_pair(
"", row));
451 boost::property_tree::ptree child;
453 pt.add_child(
"Mixture Model", child);
454 pt.add_child(
"Transform Matrix", matrix_node);
458 boost::property_tree::json_parser::write_json(
m_json_out, pt);
467 boost::property_tree::ptree pt;
468 boost::property_tree::json_parser::read_json(fileName, pt);
470 int nBands =
m_ui->m_bandTableWidget->rowCount();
474 for(boost::property_tree::ptree::value_type &v: pt.get_child(
"Band_Sensors"))
476 std::string
band = v.second.get<std::string>(
"band");
477 std::string used = v.second.get<std::string>(
"use");
478 std::string sensor = v.second.get<std::string>(
"sensor");
480 int row = std::atoi(band.c_str());
484 QCheckBox* bandCheckBox = (QCheckBox*)
m_ui->m_bandTableWidget->cellWidget(row, 0);
485 QComboBox *sensorComboBox = (QComboBox*)
m_ui->m_bandTableWidget->cellWidget(row, 1);
487 bandCheckBox->setChecked(used.compare(
"true") == 0);
488 int index = sensorComboBox->findText(sensor.c_str());
490 sensorComboBox->setCurrentIndex(index);
494 catch (
const std::exception&)
496 std::cout << std::endl <<
"Old mixture file" << std::endl;
499 int srid = pt.get(
"SRID", 0);
503 srid = inputRst->getSRID();
506 for(boost::property_tree::ptree::value_type &v: pt.get_child(
"MixModel_Components"))
508 std::string name = v.second.get<std::string>(
"name");
509 std::vector<te::gm::Point*> pointsVecg, pointsVecc;
512 m_ui->m_componentLineEdit->setText(name.c_str());
514 if (v.second.find(
"geomCoord") != v.second.not_found())
516 for(boost::property_tree::ptree::value_type &c: v.second.get_child(
"geomCoord"))
518 double x = c.second.get<
double>(
"xGeo");
519 double y = c.second.get<
double>(
"yGeo");
523 for (std::size_t i = 0; i < pointsVecc.size(); i++)
531 if (v.second.find(
"coordGeo") != v.second.not_found())
533 double xGeo = v.second.get<
double>(
"coordGeo.xGeo");
534 double yGeo = v.second.get<
double>(
"coordGeo.yGeo");
543 std::list<te::map::AbstractLayerPtr>::iterator it =
m_layers.begin();
555 std::string color = v.second.get<std::string>(
"Color");
557 m_color = QColor(c_color.getRed(), c_color.getGreen(), c_color.getBlue(), c_color.getAlpha());
574 int idx =
m_ui->m_typeComboBox->currentIndex();
575 m_type =
m_ui->m_typeComboBox->itemData(idx).toInt();
578 for(boost::property_tree::ptree::value_type &v: pt.get_child(
"Mixture Model"))
580 std::string method = v.second.data();
587 boost::numeric::ublas::matrix<double> matrix = boost::numeric::ublas::matrix<double>(matrix_size, matrix_size);
589 for(boost::property_tree::ptree::value_type &v: pt.get_child(
"Transform Matrix"))
592 for (boost::property_tree::ptree::value_type &cell : v.second)
594 matrix(x,y) = cell.second.get_value<
double>();
604 catch (
const std::exception&)
606 std::cout << std::endl <<
"Old mixture file" << std::endl;
610 catch(boost::property_tree::json_parser::json_parser_error &je)
612 QString errmsg = tr(
"Error parsing: ") + je.filename().c_str() +
": " + je.message().c_str();
613 QMessageBox::warning(
this, tr(
"Warning"), errmsg);
618 QString errmsg = e.
what();
619 QMessageBox::warning(
this, tr(
"Warning"), errmsg);
620 m_ui->m_componentTreeWidget->clear();
627 m_json_out = QFileDialog::getSaveFileName(
this, tr(
"Save MixModel Components"),
"",
"JSON File (*.json)").toUtf8().data();
635 std::string fileName = QFileDialog::getOpenFileName(
this, tr(
"Load MixModel Components"),
"",
"JSON File (*.json)").toUtf8().data();
637 if(!fileName.empty())
660 double x = pt->
getX();
661 double y = pt->
getY();
663 QString comp(
m_ui->m_componentLineEdit->text());
667 QMessageBox::warning(
this, tr(
"Mixture Model"), tr(
"First edit component name"));
672 std::list<te::map::AbstractLayerPtr>::iterator it =
m_layers.begin();
675 std::unique_ptr<te::da::DataSet>
ds =it->get()->getData();
679 std::unique_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
681 int srid = inputRst->getSRID();
698 if (currentColumn < 0 || currentColumn >= (
int) inputRst->getNumberOfColumns())
700 if (currentRow < 0 || currentRow >= (
int) inputRst->getNumberOfRows())
704 QString className = comp;
707 std::vector<double> componentsVector;
710 for(
unsigned b = 0 ;
b < inputRst->getNumberOfBands();
b++)
712 inputRst->getValue(currentColumn, currentRow, value,
b);
713 QString bName(it->get()->getTitle().c_str());
714 bName.append(tr(
" Band "));
715 bName.append(QString::number(
b));
716 componentsVector.push_back(value);
721 mmc.
m_name = className.toUtf8().data();
729 std::map<std::string, MixModelComponent > ::iterator it =
m_components.find(className.toUtf8().data());
734 m_components.insert(std::map<std::string, MixModelComponent >::value_type(className.toUtf8().data(), mmc));
748 std::list<te::map::AbstractLayerPtr>::iterator it =
m_layers.begin();
764 std::list<te::map::AbstractLayerPtr>::iterator it =
m_layers.begin();
777 if(
m_ui->m_componentLineEdit->text().isEmpty())
780 std::string comp =
m_ui->m_componentLineEdit->text().toUtf8().data();
781 std::map<std::string, MixModelComponent>::iterator it =
m_components.find(comp);
785 QTreeWidgetItemIterator itqt(
m_ui->m_componentTreeWidget);
787 if (comp.compare((*itqt)->text(0).toUtf8().data()) == 0)
790 int x =
m_ui->m_componentTreeWidget->indexOfTopLevelItem(item);
791 if (x >= 0 && x < m_ui->m_componentTreeWidget->topLevelItemCount())
793 item =
m_ui->m_componentTreeWidget->takeTopLevelItem(x);
794 if (item)
delete item;
796 delete (*it).second.m_geomGeo;
797 delete (*it).second.m_geomGrid;
798 (*it).second.m_values.clear();
821 canvasInstance.
clear();
828 m_ui->m_typeComboBox->clear();
831 m_ui->m_typeComboBox->addItem(tr(
"PCA - Principal Component Analysis"),
MIXMODEL_PCA);
842 std::map<std::string, te::rp::SpectralSensorParams > ::iterator it_sen;
843 QStringList sensorNames;
846 sensorNames.append((it_sen->first).c_str());
849 std::list<te::map::AbstractLayerPtr>::iterator it =
m_layers.begin();
854 std::unique_ptr<te::da::DataSet>
ds = it->get()->getData();
858 std::unique_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
862 m_ui->m_bandTableWidget->setRowCount(newrow);
866 for(
unsigned b = 0 ;
b < inputRst->getNumberOfBands();
b++)
868 m_ui->m_bandTableWidget->insertRow(newrow);
870 QString bName(it->get()->getTitle().c_str());
871 bName.append(tr(
" Band "));
873 bName.append(QString::number(
b));
875 QCheckBox* bandCheckBox =
new QCheckBox(bName,
this);
877 connect(bandCheckBox, SIGNAL(stateChanged(
int)),
this, SIGNAL(completeChanged()));
879 QComboBox* sensorDescriptionComboBox =
new QComboBox(
this);
880 sensorDescriptionComboBox->addItems(sensorNames);
882 sensorFindButton->setFixedSize(20, 20);
883 sensorFindButton->setText(
"...");
885 m_ui->m_bandTableWidget->setCellWidget(newrow, 0, bandCheckBox);
886 m_ui->m_bandTableWidget->setCellWidget(newrow, 1, sensorDescriptionComboBox);
887 m_ui->m_bandTableWidget->setCellWidget(newrow, 2, sensorFindButton);
888 #if (QT_VERSION >= 0x050000) 889 m_ui->m_bandTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
891 m_ui->m_bandTableWidget->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
897 connect(sensorDescriptionComboBox, SIGNAL(currentIndexChanged(
const QString &)),
this, SLOT(
onBandItemClicked()));
900 bandCheckBox->setChecked(
true);
901 double max = inputRst->getBand(
b)->getMaxValue(
true).real();
921 std::map<std::string, MixModelComponent>::iterator it =
m_components.begin();
927 std::string type = it->second.m_geomGeo->getGeometryType();
937 canvasInstance.setPointColor(it->second.m_color);
941 canvasInstance.setPointWidth(30);
944 canvasInstance.draw(&point);
960 canvasInstance.setPolygonContourColor(red);
963 canvasInstance.setPolygonContourColor(black);
965 te::color::RGBAColor polcolor(it->second.m_color.getRed(), it->second.m_color.getGreen(), it->second.m_color.getBlue(), opacity);
966 canvasInstance.setPolygonFillColor(polcolor);
967 canvasInstance.setPolygonContourWidth(1);
969 canvasInstance.draw(&pol);
975 catch (
const std::exception&)
977 std::cout << std::endl <<
"Points out" << std::endl;
985 m_ui->m_componentTreeWidget->clear();
987 std::map<std::string, MixModelComponent>::iterator it;
989 unsigned int nBands =
m_ui->m_bandTableWidget->rowCount();
993 QBrush brush(QColor(it->second.m_color.getRed(), it->second.m_color.getGreen(), it->second.m_color.getBlue(), 255));
995 compItem->setText(0, it->first.c_str());
996 compItem->setForeground(0, brush);
997 m_ui->m_componentTreeWidget->addTopLevelItem(compItem);
998 m_ui->m_componentTreeWidget->setCurrentItem(compItem);
1000 for (
unsigned int i = 0; i < nBands; ++i)
1002 QCheckBox* checkBox = (QCheckBox*)
m_ui->m_bandTableWidget->cellWidget(i, 0);
1003 if (checkBox && checkBox->isChecked())
1005 QComboBox* comboBox = (QComboBox*)
m_ui->m_bandTableWidget->cellWidget(i, 1);
1007 item->setText(0, comboBox->currentText());
1008 if (i < it->second.m_values.size())
1009 item->setText(1, QString::number(it->second.m_values[i] /
m_maxValue[i]));
1011 item->setText(1, QString::number(0.0));
1012 item->setForeground(0, brush);
1013 item->setForeground(1, brush);
1014 m_ui->m_componentTreeWidget->setCurrentItem(item);
1015 m_ui->m_componentTreeWidget->resizeColumnToContents(0);
1016 m_ui->m_componentTreeWidget->resizeColumnToContents(1);
1027 emit completeChanged();
1036 if (!item->childCount())
1044 m_ui->m_componentLineEdit->setText(item->text(0));
1046 std::map<std::string, MixModelComponent>::iterator it =
m_components.find(item->text(0).toStdString());
1049 m_color = QColor(it->second.m_color.getRed(), it->second.m_color.getGreen(), it->second.m_color.getBlue(), it->second.m_color.getAlpha());
1052 m_ui->m_colorToolButton->setIcon(px);
1072 if (
m_ui->m_selectedRadioButton->isChecked())
1074 m_chartStyle->
setTitle(
m_ui->m_componentLineEdit->text());
1077 m_chartStyle->
setTitle(tr(
"Spectral Curves"));
1079 m_chartStyle->
setAxisX(tr(
"Wave Lenght"));
1080 m_chartStyle->
setAxisY(tr(
"Answer"));
1088 for (std::map<std::string, MixModelComponent > ::iterator it =
m_components.begin(); it !=
m_components.end(); it++)
1090 if (
m_ui->m_selectedRadioButton->isChecked())
1092 if (it->first.compare(
m_ui->m_componentLineEdit->text().toStdString()) != 0)
1096 graphic->setOrientation(Qt::Horizontal);
1097 QVector<QPointF> values;
1099 for (
unsigned int ii = 0; ii < it->second.m_values.size(); ++ii)
1101 QCheckBox* bandCheckBox = (QCheckBox*)
m_ui->m_bandTableWidget->cellWidget(ii, 0);
1102 if (bandCheckBox->isChecked())
1104 QComboBox* sensor = (QComboBox*)
m_ui->m_bandTableWidget->cellWidget(ii, 1);
1107 for (
int iv = 0; iv < values.size(); ++iv)
1109 if (values[iv].x() > wave)
1111 values.insert(iv, QPointF(wave, it->second.m_values[ii]/
m_maxValue[ii]));
1117 values.push_back(QPointF(wave, it->second.m_values[ii]/
m_maxValue[ii]));
1121 graphic->setSamples(values);
1124 CurvePen.setColor(QColor(it->second.m_color.getRed(), it->second.m_color.getGreen(), it->second.m_color.getBlue()));
1126 CurvePen.setWidth(0);
1127 graphic->setPen(CurvePen);
1129 graphic->attach(m_chartDisplay);
1161 QString comp(
m_ui->m_componentLineEdit->text());
1163 std::map<std::string, MixModelComponent>::iterator itc =
m_components.find(comp.toUtf8().data());
1165 m_color = QColor(itc->second.m_color.getRed(), itc->second.m_color.getGreen(),itc->second.m_color.getBlue(),itc->second.m_color.getAlpha());
1171 itc->second.m_color.
setColor(newcolor.getColor());
1176 m_ui->m_colorToolButton->setIcon(px);
1210 m_comp =
m_ui->m_componentLineEdit->text().toStdString();
1212 if (m_comp.length() == 0)
1214 QMessageBox::warning(
this, tr(
"Mixture Model"), tr(
"First edit component name"));
1220 std::vector<double> allvalues;
1223 std::list<te::map::AbstractLayerPtr>::iterator it =
m_layers.begin();
1226 std::unique_ptr<te::da::DataSet>
ds = it->get()->getData();
1230 std::unique_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
1234 if (inputRst->getSRID() != it->get()->getSRID())
1235 inputRst->getGrid()->setSRID(it->get()->getSRID());
1238 std::string className(m_comp);
1240 std::vector<double> componentsVector;
1246 for (std::size_t nb = 0; nb < inputRst->getNumberOfBands(); nb++)
1247 allvalues.push_back(0);
1249 std::vector<double>::iterator itv, ita;
1252 std::vector<double> values;
1253 int currentColumn = itRaster.
getColumn();
1254 int currentRow = itRaster.getRow();
1256 if (currentColumn < 0 || currentColumn >= (
int)inputRst->getNumberOfColumns())
1258 if (currentRow < 0 || currentRow >= (
int)inputRst->getNumberOfRows())
1261 inputRst->getValues(currentColumn, currentRow, values);
1262 for (itv = values.begin(), ita = allvalues.begin(); itv != values.end(), ita != allvalues.end(); itv++, ita++)
1267 for (ita = allvalues.begin(); ita != allvalues.end(); ita++)
1270 for (
unsigned b = 0;
b < inputRst->getNumberOfBands();
b++)
1272 QString bName(it->get()->getTitle().c_str());
1273 bName.append(tr(
" Band "));
1274 bName.append(QString::number(
b));
1275 componentsVector.push_back(allvalues[
b]);
1282 for (std::size_t i = 0; i < lr->
getNPoints(); i++)
1287 lrg->
setX(i, currentColumn);
1288 lrg->
setY(i, currentRow);
1300 std::map<std::string, MixModelComponent > ::iterator it =
m_components.find(className);
1304 m_components.insert(std::map<std::string, MixModelComponent >::value_type(className, mmc));
1323 QComboBox *sensorComboBox = (QComboBox*)
m_ui->m_bandTableWidget->cellWidget(row, 1);
1327 sensorComboBox->clear();
1331 std::map<std::string, te::rp::SpectralSensorParams > ::iterator it_sen;
1332 QStringList sensorNames;
1335 sensorNames.append((it_sen->first).c_str());
1337 sensorComboBox->addItems(sensorNames);
1340 int index = sensorComboBox->findText(sensor);
1341 sensorComboBox->setCurrentIndex(index);
te::color::RGBAColor ** m_rgbaMark
component color
std::list< te::map::AbstractLayerPtr > m_layers
list of input layers
void oncomponentChanged()
double GetMediumWavelength(std::string sensor)
void onMixturetabChanged(int)
This file defines a class for a MixtureModel Wizard page.
void setX(std::size_t i, const double &x)
It sets the n-th x coordinate value.
void setColor(const std::string &hexColor)
It sets the color using a two hexadecimal RGB-encoded color.
std::map< std::string, te::rp::SpectralSensorParams > m_SensorParams
map with sensor parameters
Raster decomposition using mixture model.
void transform(int srid)
It converts the coordinate values of the geometry to the new spatial reference system.
te::gm::Geometry * m_geomGeo
component coordinates in geografic coordinates
te::rp::MixtureModel::InputParameters getInputParams()
virtual const char * what() const
It outputs the exception message.
std::vector< double > m_values
raster values
std::map< std::string, SpectralSensorParams > getSensorParams()
Returns a map with spectral sensors parameters defined in SpectralSensor.json file.
This class implements the strategy to iterate with spatial restriction, the iteration occurs inside a...
Curve * getExteriorRing() const
It returns the exterior ring of this CurvePolygon.
double m_urx
Upper right corner x-coordinate.
std::unique_ptr< Point > getPointN(std::size_t i) const
It returns the specified point in this LineString.
void fillMixtureModelTypes()
void onGeomAquired(te::gm::Polygon *poly)
boost::numeric::ublas::matrix< double > m_transfMatrix
Transformation matrix;.
An utility struct for representing 2D coordinates.
static te::dt::Date ds(2010, 01, 01)
void onRemoveToolButtonClicked()
void onMapDisplayExtentChanged()
te::gm::Geometry * m_geomGrid
component coordinades in raster lineXcolumn
double m_normalMax
Upper limit to normalized.
void onMixturetypeChanged()
Principal Components Mixture Model.
double m_normalMin
Lower limit to normalized.
te::qt::widgets::ChartDisplayWidget * m_displayWidget
void saveMixtureModelComponents()
int m_type
algorithm mixture model type (MIXMODEL_LINEAR or MIXMODEL_PCA)
void onComponentItemClicked(QTreeWidgetItem *item, int column)
void onselectedEnabled(bool)
A LinearRing is a LineString that is both closed and simple.
void Free(std::vector< T * > *v)
This function can be applied to a pointer to a vector of pointers.
int getSRID() const _NOEXCEPT_OP(true)
It returns the Spatial Reference System ID associated to this geometric object.
double m_llx
Lower left corner x-coordinate.
static PolygonIterator end(const te::rst::Raster *r, const te::gm::Polygon *p)
Returns an iterator referring to after the end of the iterator.
void PlotSpectralSignature()
void onLoadToolButtonClicked()
const double & getY() const
It returns the Point y-coordinate value.
static MarkRendererManager & getInstance()
It returns a reference to the singleton instance.
bool m_normalizeOutput
A flag to indicate that output raster will be normalized , default [0, 1].
A point with x and y coordinate values.
const Envelope * getMBR() const _NOEXCEPT_OP(true)
It returns the minimum bounding rectangle for the geometry in an internal representation.
virtual bool isValid() const _NOEXCEPT_OP(false)
It tells if the geometry is well formed.
An Envelope defines a 2D rectangular region.
std::map< std::string, MixModelComponent > m_components
The map of selected components.
bool contains(const Envelope &rhs) const
It returns true if this envelope "spatially contains" the rhs envelope.
virtual int getSRID() const
It return the Spatial Reference System used by the Map Display.
mydialect insert("+", new te::da::BinaryOpEncoder("+"))
te::gm::Geometry * m_geom
Current geometry/envelope component.
TERASTEREXPORT int Round(double val)
Round a double value to a integer value.
void setActionGroup(QActionGroup *actionGroup)
void onSensorToolButtonClicked(int)
std::vector< double > m_maxValue
vector to store maximum value of each band
void transform(int srid) _NOEXCEPT_OP(false)
It converts the coordinate values of the point to the new spatial reference system.
bool generateTransformMatrix(boost::numeric::ublas::matrix< double > &matrix)
Generates a Transform Matrix.
virtual const te::gm::Envelope & getExtent() const
It returns the world extent showned by the MapDisplay.
te::se::Mark * m_mark
component point mark type
std::size_t getNPoints() const
It returns the number of points (vertexes) in the linestring.
void oncolorToolButtonClicked()
CurvePolygon is a planar surface defined by 1 exterior boundary and 0 or more interior boundaries...
virtual AbstractData * clone() const =0
It returns a clone of this object.
A Fill specifies the pattern for filling an area geometry.
void addGeometryComponent()
QSignalMapper m_ButtonSignalMapper
TESEEXPORT Mark * CreateMark(const std::string &wellKnownName, Stroke *stroke, Fill *fill)
Creates a mark.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
std::string m_json_out
Json filename to save components.
MixtureModelWizardPage(QWidget *parent=0)
double m_lly
Lower left corner y-coordinate.
TESEEXPORT Stroke * CreateStroke(const std::string &color, const std::string &width)
Creates a stroke.
std::unique_ptr< Ui::MixtureModelWizardPageForm > m_ui
te::rp::MixtureModel::OutputParameters getOutputParams()
TEMAPEXPORT te::rst::Raster * GetRaster(AbstractLayer *layer)
It gets the raster referenced by the given data set layer.
MixtureModel output parameters.
void onPointPicked(double x, double y)
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
double m_ury
Upper right corner y-coordinate.
Defines component attributes.
A Stroke specifies the appearance of a linear geometry.
void onEnvelopeAcquired(te::gm::Envelope env)
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
void set(std::list< te::map::AbstractLayerPtr > layers)
This method is used to set the selected layer for mixture model operation.
std::string m_comp
Current component.
te::qt::widgets::SensorManagerDialog * m_sensorManagerDialog
Dialog to select/edit spectral sensors.
QColor m_color
Current component color.
void setPointN(std::size_t i, const Point &p)
It sets the value of the specified point to this new one.
std::list< te::map::AbstractLayerPtr > get()
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
bool m_createErrorRaster
A flag to indicate that output raster will include the error bands.
void setY(std::size_t i, const double &y)
It sets the n-th y coordinate value.
A dialog used to manage Spectral Sensors.
bool initialize(const AlgorithmInputParameters &inputParams)
Initializes model with paramters defined in inputParams.
unsigned int getColumn() const
Returns the current column in iterator.
void setMapDisplay(te::qt::widgets::MapDisplay *mapDisplay)
void loadMixtureModelComponents(const std::string &fileName)
void transform(int oldsrid, int newsrid)
It will transform the coordinates of the Envelope from the old SRS to the new one.
~MixtureModelWizardPage()
std::unique_ptr< te::qt::widgets::RpToolsWidget > m_navigator
const double & getX() const
It returns the Point x-coordinate value.
bool isValid() const
It tells if the rectangle is valid or not.
te::qt::widgets::MapDisplay * m_mapDisplay
te::color::RGBAColor m_color
color
void onSaveToolButtonClicked()
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope.
TESEEXPORT Fill * CreateFill(const std::string &color, const std::string &opacity)
Creates a fill.
void setRingN(std::size_t i, Curve *r)
It sets the informed position ring to the new one.