27 #include "../../../dataaccess/dataset/DataSet.h" 28 #include "../../../dataaccess/dataset/DataSetType.h" 29 #include "../../../dataaccess/utils/Utils.h" 30 #include "../../../maptools/Utils.h" 31 #include "../../../qt/widgets/charts/Utils.h" 32 #include "../../../raster.h" 33 #include "../../../raster/RasterSummaryManager.h" 34 #include "../../../statistics/core/Enums.h" 35 #include "../../../statistics/core/Utils.h" 36 #include "../utils/ScopedCursor.h" 39 #include "ui_HistogramDataWidgetForm.h" 43 ui->m_summaryComboBox->clear();
45 size_t selectedPropertyIdx = 0;
48 if(ui->m_propertyComboBox->currentText().toUtf8().data() == dataSet->
getPropertyName(i))
49 selectedPropertyIdx = i;
56 ui->m_summaryComboBox->addItem(QString::fromUtf8(
"None"), QVariant(-1));
62 ui->m_summaryComboBox->addItem(QString::fromUtf8(
"None"), QVariant(-1));
75 ui->m_summaryComboBox->setCurrentIndex(0);
80 m_ui(new
Ui::HistogramDataWidgetForm),
86 std::unique_ptr<te::da::DataSet> dataset =
m_layer->getData();
87 std::unique_ptr<te::da::DataSetType> dataType =
m_layer->getSchema();
89 if(dataType->hasRaster())
91 m_ui->m_readAllcheckBox->show();
99 const std::complex<double>* cmin = rsMin->at(0).m_minVal;
100 const std::complex<double>* cmax = rsMax->at(0).m_maxVal;
102 double min = cmin->real();
103 double max = cmax->real();
105 size_t size = raster->getNumberOfBands();
106 m_ui->m_slicesSpinBox->setMinimum(0);
108 int type = raster->getBandDataType(0);
112 if (min >= 0 && max <= 255)
113 m_ui->m_slicesSpinBox->setMaximum(255);
115 m_ui->m_slicesSpinBox->setMaximum(max);
118 for (
size_t i = 0; i < size; i++)
120 item = QString::number(i);
121 m_ui->m_propertyComboBox->addItem((QString::fromUtf8(
"Band: ") + item), QVariant::fromValue(i));
126 m_ui->m_readAllcheckBox->hide();
127 for (std::size_t i = 0; i < dataset->getNumProperties(); i++)
131 item = QString::fromUtf8(dataset->getPropertyName(i).c_str());
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();
164 std::unique_ptr<te::da::DataSet> dataset =
m_layer->getData();
165 std::unique_ptr<te::da::DataSetType> dataType =
m_layer->getSchema();
168 if(dataType->hasRaster())
171 m_ui->m_slicesSpinBox->value(), -1,
m_ui->m_readAllcheckBox->isChecked());
177 size_t selectedPropertyIdx = 0;
179 for (
size_t i = 0; i < dataset->getNumProperties(); i++)
181 if(
m_ui->m_propertyComboBox->currentText().toUtf8().data() == dataset->getPropertyName(i))
183 selectedPropertyIdx = i;
187 int propType = dataset->getPropertyDataType(selectedPropertyIdx);
188 int stat =
m_ui->m_summaryComboBox->itemData(
m_ui->m_summaryComboBox->currentIndex()).toInt();
204 m_ui->m_propertyComboBox->setCurrentIndex(
m_ui->m_propertyComboBox->findData(propId));
205 m_ui->m_propertyComboBox->setEnabled(
false);
212 std::unique_ptr<te::da::DataSet> dataset =
m_layer->getData();
213 std::unique_ptr<te::da::DataSetType> dataType =
m_layer->getSchema();
215 if(!dataType->hasRaster())
218 int propType = dataset->getPropertyDataType(selectedPropertyIdx);
222 m_ui->m_slicesSpinBox->setEnabled(
false);
226 m_ui->m_slicesSpinBox->setEnabled(
true);
236 const std::complex<double>* cmin = rsMin->at(
m_ui->m_propertyComboBox->currentIndex()).m_minVal;
237 const std::complex<double>* cmax = rsMax->at(
m_ui->m_propertyComboBox->currentIndex()).m_maxVal;
239 double min = cmin->real();
240 double max = cmax->real();
242 if (min >= 0 && max <= 255)
243 m_ui->m_slicesSpinBox->setMaximum(255);
245 m_ui->m_slicesSpinBox->setMaximum(max);
247 m_ui->m_slicesSpinBox->setValue(255);
254 m_ui->m_summaryComboBox->show();
255 m_ui->m_summaryLabel->show();
259 m_ui->m_summaryComboBox->hide();
260 m_ui->m_summaryLabel->hide();
266 if (state == Qt::Checked)
267 m_ui->m_slicesSpinBox->setEnabled(
true);
268 else if(state == Qt::CheckState::Unchecked)
269 m_ui->m_slicesSpinBox->setEnabled(
false);
274 return m_ui->m_summaryComboBox->currentText().toUtf8().data();
TEDATAACCESSEXPORT bool HasLinkedTable(te::da::DataSetType *type)
It checks if the datasettype has a linked table.
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 int getPropertyDataType(std::size_t i) const =0
It returns the underlying data type of the property 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.
TEMAPEXPORT te::rst::Raster * GetRaster(AbstractLayer *layer)
It gets the raster referenced by the given data set layer.
A dataset is the unit of information manipulated by the data access module of TerraLib.
virtual std::size_t getNumProperties() const =0
It returns the number of properties that composes an item of the dataset.
virtual std::string getPropertyName(std::size_t i) const =0
It returns the property name at position pos.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr