27 #include "../../../qt/widgets/charts/Utils.h"
28 #include "../../../dataaccess.h"
29 #include "../../../datatype/Property.h"
30 #include "../../../raster.h"
31 #include "../../../raster/RasterSummaryManager.h"
32 #include "../../../statistics/core/Enums.h"
33 #include "../../../statistics/core/Utils.h"
36 #include "ui_HistogramDataWidgetForm.h"
42 ui->m_summaryComboBox->clear();
44 size_t selectedPropertyIdx = 0;
47 if(ui->m_propertyComboBox->currentText().toStdString() == dataSet->
getPropertyName(i))
48 selectedPropertyIdx = i;
55 ui->m_summaryComboBox->addItem(QString::fromStdString(
"None"), QVariant(-1));
63 ui->m_summaryComboBox->addItem(QString::fromStdString(
"None"), QVariant(-1));
79 ui->m_summaryComboBox->setCurrentIndex(0);
84 m_ui(new Ui::HistogramDataWidgetForm),
94 if(rpos != std::string::npos)
97 std::auto_ptr<te::rst::Raster> raster =
m_dataSet->getRaster(rpos);
102 const std::complex<double>* cmin = rsMin->at(0).m_minVal;
103 const std::complex<double>* cmax = rsMax->at(0).m_maxVal;
105 double min = cmin->real();
106 double max = cmax->real();
108 size_t size = raster->getNumberOfBands();
109 m_ui->m_slicesSpinBox->setMinimum(0);
110 m_ui->m_slicesSpinBox->setValue(30);
112 if (min >= 0 && max <= 255)
113 m_ui->m_slicesSpinBox->setMaximum(255);
115 m_ui->m_slicesSpinBox->setMaximum(max);
117 for (
size_t i = 0; i < size; i++)
119 item = QString::number(i);
120 m_ui->m_propertyComboBox->addItem((QString::fromStdString(
"Band: ") + item), QVariant::fromValue(i));
130 m_ui->m_propertyComboBox->addItem(item, QVariant::fromValue(i));
139 m_ui->m_summaryComboBox->show();
140 m_ui->m_summaryLabel->show();
144 m_ui->m_summaryComboBox->hide();
145 m_ui->m_summaryLabel->hide();
166 if(rpos != std::string::npos)
168 histogram =
te::qt::widgets::createHistogram(m_dataSet.get(), m_dataType.get(), m_ui->m_propertyComboBox->itemData(m_ui->m_propertyComboBox->currentIndex()).toInt(), m_ui->m_slicesSpinBox->value(), -1);
174 size_t selectedPropertyIdx = 0;
176 for (
size_t i = 0; i < m_dataSet->getNumProperties(); i++)
178 if(m_ui->m_propertyComboBox->currentText().toStdString() == m_dataSet.get()->getPropertyName(i))
180 selectedPropertyIdx = i;
184 int propType = m_dataSet->getPropertyDataType(selectedPropertyIdx);
185 int stat = m_ui->m_summaryComboBox->itemData(m_ui->m_summaryComboBox->currentIndex()).toInt();
201 m_ui->m_propertyComboBox->setCurrentIndex(m_ui->m_propertyComboBox->findData(propId));
202 m_ui->m_propertyComboBox->setEnabled(
false);
208 if(rpos == std::string::npos)
210 int selectedPropertyIdx=
te::da::GetPropertyPos(m_dataSet.get(), m_ui->m_propertyComboBox->currentText().toStdString());
211 int propType = m_dataSet->getPropertyDataType(selectedPropertyIdx);
215 m_ui->m_slicesSpinBox->setEnabled(
false);
219 m_ui->m_slicesSpinBox->setEnabled(
true);
224 std::auto_ptr<te::rst::Raster> raster = m_dataSet->getRaster(rpos);
229 const std::complex<double>* cmin = rsMin->at(m_ui->m_propertyComboBox->currentIndex()).m_minVal;
230 const std::complex<double>* cmax = rsMax->at(m_ui->m_propertyComboBox->currentIndex()).m_maxVal;
232 double min = cmin->real();
233 double max = cmax->real();
235 if (min >= 0 && max <= 255)
236 m_ui->m_slicesSpinBox->setMaximum(255);
238 m_ui->m_slicesSpinBox->setMaximum(max);
240 m_ui->m_slicesSpinBox->setValue(30);
247 m_ui->m_summaryComboBox->show();
248 m_ui->m_summaryLabel->show();
252 m_ui->m_summaryComboBox->hide();
253 m_ui->m_summaryLabel->hide();
TEDATAACCESSEXPORT bool HasLinkedTable(te::da::DataSetType *type)
It checks if the datasettype has a linked table.
A class that models the description of a dataset.
TEDATAACCESSEXPORT std::size_t GetPropertyPos(const DataSet *dataset, const std::string &name)
A class to represent a histogram.
static RasterSummaryManager & getInstance()
It returns a reference to the singleton instance.
virtual std::string getPropertyName(std::size_t i) const =0
It returns the property name at position pos.
boost::ptr_vector< BandSummary > RasterSummary
RasterSummary is just a typedef of a boost::ptr_vector.
TESTATEXPORT std::string GetStatSummaryFullName(const int &e)
Get the statistical parameter full name ffrom its enumerator.
virtual std::size_t getNumProperties() const =0
It returns the number of properties that composes an item of the dataset.
A dataset is the unit of information manipulated by the data access module of TerraLib.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
virtual int getPropertyDataType(std::size_t i) const =0
It returns the underlying data type of the property at position pos.