27 #include "../../dataaccess/dataset/DataSet.h"
28 #include "../../dataaccess/utils/Utils.h"
29 #include "../../datatype/Enums.h"
30 #include "../../datatype/Property.h"
31 #include "../core/Config.h"
32 #include "../core/Exception.h"
33 #include "../core/NumericStatisticalSummary.h"
34 #include "../core/StringStatisticalSummary.h"
35 #include "../core/SummaryFunctions.h"
36 #include "../core/Utils.h"
38 #include "ui_StatisticsDialogForm.h"
41 #include <QListWidget>
42 #include <QMessageBox>
45 #include <boost/lexical_cast.hpp>
49 m_ui(new Ui::StatisticsDialogForm),
68 int propType = m_dset->getPropertyDataType(index);
70 m_ui->m_datasourceTypeTitleLabel->setText(
"Statistics: " + QString(prop.c_str()));
81 m_ui->m_statTableWidget->setRowCount(0);
83 m_ui->m_statTableWidget->insertRow(0);
85 QTableWidgetItem* itemValue =
new QTableWidgetItem(QString(ss.
m_minVal.c_str()));
86 m_ui->m_statTableWidget->setItem(0, 0, itemParameter);
87 m_ui->m_statTableWidget->setItem(0, 1, itemValue);
89 m_ui->m_statTableWidget->insertRow(1);
91 itemValue =
new QTableWidgetItem(QString(ss.
m_maxVal.c_str()));
92 m_ui->m_statTableWidget->setItem(1, 0, itemParameter);
93 m_ui->m_statTableWidget->setItem(1, 1, itemValue);
95 m_ui->m_statTableWidget->insertRow(2);
97 itemValue =
new QTableWidgetItem(QString(QString(boost::lexical_cast<std::string>(m_dset->size()).c_str())));
98 m_ui->m_statTableWidget->setItem(2, 0, itemParameter);
99 m_ui->m_statTableWidget->setItem(2, 1, itemValue);
101 m_ui->m_statTableWidget->insertRow(3);
103 itemValue =
new QTableWidgetItem(QString(QString(boost::lexical_cast<std::string>(values.size()).c_str())));
104 m_ui->m_statTableWidget->setItem(3, 0, itemParameter);
105 m_ui->m_statTableWidget->setItem(3, 1, itemValue);
108 QMessageBox::information(
this,
"Warning",
"The input vector of values is empty.");
120 m_ui->m_statTableWidget->insertRow(0);
122 QTableWidgetItem* itemValue =
new QTableWidgetItem(QString(boost::lexical_cast<std::string>(ss.
m_minVal).c_str()));
123 m_ui->m_statTableWidget->setItem(0, 0, itemParameter);
124 m_ui->m_statTableWidget->setItem(0, 1, itemValue);
126 m_ui->m_statTableWidget->insertRow(1);
128 itemValue =
new QTableWidgetItem(QString(boost::lexical_cast<std::string>(ss.
m_maxVal).c_str()));
129 m_ui->m_statTableWidget->setItem(1, 0, itemParameter);
130 m_ui->m_statTableWidget->setItem(1, 1, itemValue);
132 m_ui->m_statTableWidget->insertRow(2);
134 itemValue =
new QTableWidgetItem(QString(boost::lexical_cast<std::string>(m_dset->size()).c_str()));
135 m_ui->m_statTableWidget->setItem(2, 0, itemParameter);
136 m_ui->m_statTableWidget->setItem(2, 1, itemValue);
138 m_ui->m_statTableWidget->insertRow(3);
140 itemValue =
new QTableWidgetItem(QString(boost::lexical_cast<std::string>(values.size()).c_str()));
141 m_ui->m_statTableWidget->setItem(3, 0, itemParameter);
142 m_ui->m_statTableWidget->setItem(3, 1, itemValue);
144 m_ui->m_statTableWidget->insertRow(4);
146 itemValue =
new QTableWidgetItem(QString(boost::lexical_cast<std::string>(ss.
m_mean).c_str()));
147 m_ui->m_statTableWidget->setItem(4, 0, itemParameter);
148 m_ui->m_statTableWidget->setItem(4, 1, itemValue);
150 m_ui->m_statTableWidget->insertRow(5);
152 itemValue =
new QTableWidgetItem(QString(boost::lexical_cast<std::string>(ss.
m_sum).c_str()));
153 m_ui->m_statTableWidget->setItem(5, 0, itemParameter);
154 m_ui->m_statTableWidget->setItem(5, 1, itemValue);
156 m_ui->m_statTableWidget->insertRow(6);
158 itemValue =
new QTableWidgetItem(QString(boost::lexical_cast<std::string>(ss.
m_stdDeviation).c_str()));
159 m_ui->m_statTableWidget->setItem(6, 0, itemParameter);
160 m_ui->m_statTableWidget->setItem(6, 1, itemValue);
162 m_ui->m_statTableWidget->insertRow(7);
164 itemValue =
new QTableWidgetItem(QString(boost::lexical_cast<std::string>(ss.
m_variance).c_str()));
165 m_ui->m_statTableWidget->setItem(7, 0, itemParameter);
166 m_ui->m_statTableWidget->setItem(7, 1, itemValue);
168 m_ui->m_statTableWidget->insertRow(8);
170 itemValue =
new QTableWidgetItem(QString(boost::lexical_cast<std::string>(ss.
m_skewness).c_str()));
171 m_ui->m_statTableWidget->setItem(8, 0, itemParameter);
172 m_ui->m_statTableWidget->setItem(8, 1, itemValue);
174 m_ui->m_statTableWidget->insertRow(9);
176 itemValue =
new QTableWidgetItem(QString(boost::lexical_cast<std::string>(ss.
m_kurtosis).c_str()));
177 m_ui->m_statTableWidget->setItem(9, 0, itemParameter);
178 m_ui->m_statTableWidget->setItem(9, 1, itemValue);
180 m_ui->m_statTableWidget->insertRow(10);
182 itemValue =
new QTableWidgetItem(QString(boost::lexical_cast<std::string>(ss.
m_amplitude).c_str()));
183 m_ui->m_statTableWidget->setItem(10, 0, itemParameter);
184 m_ui->m_statTableWidget->setItem(10, 1, itemValue);
186 m_ui->m_statTableWidget->insertRow(11);
188 itemValue =
new QTableWidgetItem(QString(boost::lexical_cast<std::string>(ss.
m_median).c_str()));
189 m_ui->m_statTableWidget->setItem(11, 0, itemParameter);
190 m_ui->m_statTableWidget->setItem(11, 1, itemValue);
192 m_ui->m_statTableWidget->insertRow(12);
194 itemValue =
new QTableWidgetItem(QString(boost::lexical_cast<std::string>(ss.
m_varCoeff).c_str()));
195 m_ui->m_statTableWidget->setItem(12, 0, itemParameter);
196 m_ui->m_statTableWidget->setItem(12, 1, itemValue);
198 m_ui->m_statTableWidget->insertRow(13);
201 itemValue =
new QTableWidgetItem(QString(
""));
205 for(std::size_t i = 0; i < ss.
m_mode.size(); ++i)
206 value +=
", "+ boost::lexical_cast<std::string>(ss.
m_mode[i]);
209 itemValue =
new QTableWidgetItem(QString(value.c_str()));
211 m_ui->m_statTableWidget->setItem(13, 0, itemParameter);
212 m_ui->m_statTableWidget->setItem(13, 1, itemValue);
216 QMessageBox::information(
this,
"Warning",
"The input vector of values is empty.");
218 m_ui->m_statTableWidget->resizeColumnToContents(0);
223 QMessageBox::information(
this,
"Save",
"Under development - It should save the result...");
TESTATEXPORT void GetNumericStatisticalSummary(std::vector< double > &values, te::stat::NumericStatisticalSummary &ss, double nullVal)
A structure to hold the set of statistics from a set of numerical values.
void setStatistics(te::da::DataSet *dataSet, const std::string prop)
std::vector< double > m_mode
void onCancelPushButtonClicked()
TEDATAACCESSEXPORT int GetPropertyIndex(te::da::DataSet *dataSet, const std::string propName)
TESTATEXPORT std::vector< double > GetNumericData(te::da::DataSet *dataSet, const std::string propName)
Returns the values of a numeric type property in a vector of values.
TESTATEXPORT std::vector< std::string > GetStringData(te::da::DataSet *dataSet, const std::string propName)
Returns the values of a string type property in a vector of values.
TESTATEXPORT std::string GetStatSummaryFullName(const int &e)
Get the statistical parameter full name ffrom its enumerator.
TESTATEXPORT void GetStringStatisticalSummary(std::vector< std::string > &values, te::stat::StringStatisticalSummary &ss)
A dataset is the unit of information manipulated by the data access module of TerraLib.
A structure to hold the set of statistics from a set of categorical (sample) values.
std::auto_ptr< Ui::StatisticsDialogForm > m_ui
StatisticsDialog(QWidget *parent=0, Qt::WindowFlags f=0)
void onSavePushButtonClicked()