All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ScatterDialog.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/qt/widgets/charts/ScatterCreatorDialog.cpp
22 
23  \brief A widget used to define the basic parameters of a new Scatter chart.
24 */
25 
26 //Terralib
27 
28 #include "../../../common/progress/ProgressManager.h"
29 #include "../../../dataaccess.h"
30 #include "../../../datatype/Property.h"
31 #include "../../../qt/widgets/progress/ProgressViewerDialog.h"
32 #include "../../../se/Graphic.h"
33 #include "../se/Symbol.h"
34 #include "ChartDisplay.h"
35 #include "ChartDisplayWidget.h"
36 #include "ChartStyle.h"
37 #include "Scatter.h"
38 #include "ScatterChart.h"
39 #include "ScatterDataWidget.h"
40 #include "ScatterDialog.h"
41 #include "ScatterStyle.h"
42 #include "ui_ScatterDialogForm.h"
43 #include "ui_ScatterDataWidgetForm.h"
44 
45 //QT
46 #include <QDockWidget>
47 
48 //QWT
49 #include <qwt_symbol.h>
50 
51 te::qt::widgets::ScatterDialog::ScatterDialog(te::da::DataSet* dataSet, te::da::DataSetType* dataType, QWidget* parent, Qt::WindowFlags f)
52  : QDialog(parent, f),
53  m_ui(new Ui::ScatterDialogForm)
54 {
55  m_ui->setupUi(this);
56 
57  // Scatter data Widget
58  m_scatterDataWidget = new te::qt::widgets::ScatterDataWidget(dataSet, dataType, this, 0);
59 
60  // Adjusting...
61  QGridLayout* layout = new QGridLayout(m_ui->m_dataWidgetFrame);
62  layout->addWidget(m_scatterDataWidget);
63  this->layout()->setSizeConstraint(QLayout::SetFixedSize);
64 
65 // connect signal and slots
66  connect(m_ui->m_okPushButton, SIGNAL(clicked()), this, SLOT(onOkPushButtonClicked()));
67 
68  m_ui->m_helpPushButton->setPageReference("widgets/charts/scatter/scatter.html");
69 
70 }
71 
73 {
74  delete m_scatterDataWidget;
75 }
76 
78 {
79  return m_displayWidget;
80 }
81 
83 {
84  QApplication::setOverrideCursor(Qt::WaitCursor);
85 
86  te::qt::widgets::ScatterChart* chart = new te::qt::widgets::ScatterChart(m_scatterDataWidget->getScatter());
87 
88  //Creating and adjusting the chart Display's style.
90  chartStyle->setTitle(QString::fromStdString("Scatter"));
91 
92  if(m_scatterDataWidget->getForm()->m_summaryComboBox->currentText() != "None")
93  chartStyle->setAxisX(m_scatterDataWidget->getForm()->m_summaryComboBox->currentText() + ": " + m_scatterDataWidget->getForm()->m_propertyXComboBox->currentText());
94  else
95  chartStyle->setAxisX(m_scatterDataWidget->getForm()->m_propertyXComboBox->currentText());
96 
97  chartStyle->setAxisY(m_scatterDataWidget->getForm()->m_propertyYComboBox->currentText());
98 
99  //Adjusting the chart Display
100  te::qt::widgets::ChartDisplay* chartDisplay = new te::qt::widgets::ChartDisplay(0, QString::fromStdString("Scatter"), chartStyle);
101  chartDisplay->adjustDisplay();
102  chart->attach(chartDisplay);
103  chartDisplay->show();
104  chartDisplay->replot();
105 
106  //Adjusting the chart widget
107  m_displayWidget = new te::qt::widgets::ChartDisplayWidget(chart, te::qt::widgets::SCATTER_CHART, chartDisplay, this->parentWidget());
108 
109  QApplication::restoreOverrideCursor();
110  this->accept();
111 }
void adjustDisplay()
Updates the general display settings according to the ChartStyle. The adjusted properties are: Title;...
te::qt::widgets::ChartDisplayWidget * getDisplayWidget()
Returns a pointer to the generated ChartDisplayWidget.
A widget used to adjust a scatter's input data.
A class used to define the style of a scatter's chart.
A class that models the description of a dataset.
Definition: DataSetType.h:72
ScatterDialog(te::da::DataSet *dataSet, te::da::DataSetType *dataType, QWidget *parent=0, Qt::WindowFlags f=0)
Constructor.
std::auto_ptr< Ui::ScatterDialogForm > m_ui
The dialog form.
Definition: ScatterDialog.h:95
A class to represent a chart display.
Definition: ChartDisplay.h:65
A class to represent a scatter chart.
Definition: ScatterChart.h:55
A class to represent a scatter's chart.
A class to represent a scatter.
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
A wdiget used to display a chart.
A widget used to display a set of charts.
A class used to define a chartDisplay's style.
ScatterDataWidget * m_scatterDataWidget
The scatter's data widget used to configure the basic parameters of the new scatter.
Definition: ScatterDialog.h:96
A class to represent a chart display.