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 m_ui->m_slicesSpinBox->setValue(255);
119 for (
size_t i = 0; i < size; i++)
121 item = QString::number(i);
122 m_ui->m_propertyComboBox->addItem((QString::fromStdString(
"Band: ") + item), QVariant::fromValue(i));
132 m_ui->m_propertyComboBox->addItem(item, QVariant::fromValue(i));
141 m_ui->m_summaryComboBox->show();
142 m_ui->m_summaryLabel->show();
146 m_ui->m_summaryComboBox->hide();
147 m_ui->m_summaryLabel->hide();
168 if(rpos != std::string::npos)
170 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);
176 size_t selectedPropertyIdx = 0;
178 for (
size_t i = 0; i < m_dataSet->getNumProperties(); i++)
180 if(m_ui->m_propertyComboBox->currentText().toStdString() == m_dataSet.get()->getPropertyName(i))
182 selectedPropertyIdx = i;
186 int propType = m_dataSet->getPropertyDataType(selectedPropertyIdx);
187 int stat = m_ui->m_summaryComboBox->itemData(m_ui->m_summaryComboBox->currentIndex()).toInt();
203 m_ui->m_propertyComboBox->setCurrentIndex(m_ui->m_propertyComboBox->findData(propId));
204 m_ui->m_propertyComboBox->setEnabled(
false);
210 if(rpos == std::string::npos)
212 size_t selectedPropertyIdx=
te::da::GetPropertyPos(m_dataSet.get(), m_ui->m_propertyComboBox->currentText().toStdString());
213 int propType = m_dataSet->getPropertyDataType(selectedPropertyIdx);
217 m_ui->m_slicesSpinBox->setEnabled(
false);
221 m_ui->m_slicesSpinBox->setEnabled(
true);
226 std::auto_ptr<te::rst::Raster> raster = m_dataSet->getRaster(rpos);
231 const std::complex<double>* cmin = rsMin->at(m_ui->m_propertyComboBox->currentIndex()).m_minVal;
232 const std::complex<double>* cmax = rsMax->at(m_ui->m_propertyComboBox->currentIndex()).m_maxVal;
234 double min = cmin->real();
235 double max = cmax->real();
237 if (min >= 0 && max <= 255)
238 m_ui->m_slicesSpinBox->setMaximum(255);
240 m_ui->m_slicesSpinBox->setMaximum(max);
242 m_ui->m_slicesSpinBox->setValue(255);
249 m_ui->m_summaryComboBox->show();
250 m_ui->m_summaryLabel->show();
254 m_ui->m_summaryComboBox->hide();
255 m_ui->m_summaryLabel->hide();
261 return m_ui->m_summaryComboBox->currentText().toStdString();
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.