27 #include "../../../qt/widgets/charts/Utils.h"
28 #include "../../../dataaccess.h"
29 #include "../../../datatype/Property.h"
30 #include "../../../raster.h"
31 #include "../../../raster/RasterSummary.h"
32 #include "../../../raster/RasterSummaryManager.h"
35 #include "ui_HistogramDataWidgetForm.h"
41 m_ui(new Ui::HistogramDataWidgetForm),
51 if(rpos != std::string::npos)
54 std::auto_ptr<te::rst::Raster> raster =
m_dataSet->getRaster(rpos);
59 const std::complex<double>* cmin = rsMin->at(0).m_minVal;
60 const std::complex<double>* cmax = rsMax->at(0).m_maxVal;
62 double min = cmin->real();
63 double max = cmax->real();
65 size_t size = raster->getNumberOfBands();
66 m_ui->m_slicesSpinBox->setMinimum(0);
67 m_ui->m_slicesSpinBox->setValue(0);
69 if (min >= 0 && max <= 255)
70 m_ui->m_slicesSpinBox->setMaximum(255);
72 m_ui->m_slicesSpinBox->setMaximum(max);
74 for (
size_t i = 0; i < size; i++)
76 item = QString::number(i);
77 m_ui->m_propertyComboBox->addItem((QString::fromStdString(
"Band: ") + item));
88 m_ui->m_propertyComboBox->addItem(item);
111 if(rpos != std::string::npos)
119 size_t selectedPropertyIdx = 0;
121 for (
size_t i = 0; i < m_dataSet->getNumProperties(); i++)
123 if(m_ui->m_propertyComboBox->currentText().toStdString() == m_dataSet.get()->getPropertyName(i))
124 selectedPropertyIdx = i;
127 int propType = m_dataSet->getPropertyDataType(selectedPropertyIdx);
144 if(rpos == std::string::npos)
146 int selectedPropertyIdx=
te::da::GetPropertyPos(m_dataSet.get(), m_ui->m_propertyComboBox->currentText().toStdString());
147 int propType = m_dataSet->getPropertyDataType(selectedPropertyIdx);
151 m_ui->m_slicesSpinBox->setEnabled(
false);
155 m_ui->m_slicesSpinBox->setEnabled(
true);
160 std::auto_ptr<te::rst::Raster> raster = m_dataSet->getRaster(rpos);
165 const std::complex<double>* cmin = rsMin->at(m_ui->m_propertyComboBox->currentIndex()).m_minVal;
166 const std::complex<double>* cmax = rsMax->at(m_ui->m_propertyComboBox->currentIndex()).m_maxVal;
168 double min = cmin->real();
169 double max = cmax->real();
171 if (min >= 0 && max <= 255)
172 m_ui->m_slicesSpinBox->setMaximum(255);
174 m_ui->m_slicesSpinBox->setMaximum(max);
176 m_ui->m_slicesSpinBox->setValue(0);
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.
TEQTWIDGETSEXPORT Histogram * createHistogram(te::da::DataSet *dataset, te::da::DataSetType *dataType, int propId, int slices)
Histogram Creator.
virtual std::size_t getNumProperties() const =0
It returns the number of properties that composes an item of the dataset.
A class to represent a Histogram.
A class to represent a histogram.
std::auto_ptr< te::da::DataSet > m_dataSet
The dataset that will be used to generate the histogram graph.
virtual int getPropertyDataType(std::size_t i) const =0
It returns the underlying data type of the property at position pos.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
te::qt::widgets::Histogram * getHistogram()
Returns a pointer to the widget's form.
TEDATAACCESSEXPORT std::size_t GetPropertyPos(const DataSet *dataset, const std::string &name)
void onPropertyComboBoxIndexChanged(QString text)
A class that models the description of a dataset.
HistogramDataWidget(te::da::DataSet *dataSet, te::da::DataSetType *dataType, QWidget *parent=0, Qt::WindowFlags f=0)
Constructor.
~HistogramDataWidget()
Destructor.
std::auto_ptr< Ui::HistogramDataWidgetForm > m_ui
The widget's form.
static RasterSummaryManager & getInstance()
It returns a reference to the singleton instance.
Ui::HistogramDataWidgetForm * getForm()
Returns a pointer to the widget's form.
A dataset is the unit of information manipulated by the data access module of TerraLib.