All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ChartDisplayWidget.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/ChartDisplayWidget.cpp
22 
23  \brief A dialog used to display a set of charts.
24 */
25 
26 //Terralib
27 #include "../../../dataaccess.h"
28 #include "../../../dataaccess/dataset/ObjectIdSet.h"
29 #include "../../../datatype/Property.h"
30 #include "ChartDisplay.h"
31 #include "ChartDisplayWidget.h"
32 #include "ChartProperties.h"
33 #include "ChartStyle.h"
34 #include "ui_ChartDisplayWidgetForm.h"
35 
36 //QWT
37 #include <qwt_plot_seriesitem.h>
38 
39 te::qt::widgets::ChartDisplayWidget::ChartDisplayWidget(QwtPlotSeriesItem* chart, int type, te::qt::widgets::ChartDisplay* display, QWidget* parent, Qt::WindowFlags f)
40  : QWidget(parent, f),
41  m_ui(new Ui::ChartDisplayWidgetForm),
42  m_chart(chart),
43  m_type(type),
44  m_display(display)
45 {
46  m_ui->setupUi(this);
47 
48  QGridLayout* layout = new QGridLayout(m_ui->m_plotFrame);
49  layout->addWidget(m_display);
50 
51 // connect signal and slots
52  connect(m_ui->m_settingsToolButton, SIGNAL(clicked()), this, SLOT(onSettingsToolButtonnClicked()));
53  connect (m_display, SIGNAL(selected(te::da::ObjectIdSet*, const bool&)), SLOT(selectionChanged(te::da::ObjectIdSet*, const bool&)));
54 }
55 
57 {
58  delete m_chart;
59 }
60 
62 {
63  return m_chart;
64 }
65 
66 void te::qt::widgets::ChartDisplayWidget::setChart(QwtPlotSeriesItem* newChart)
67 {
68  m_chart = newChart;
69  m_display->replot();
70 }
71 
73 {
74  return m_display;
75 }
76 
78 {
79  m_display = newDisplay;
80 
81  if(this->parentWidget())
82  this->parentWidget()->setWindowTitle(m_display->getStyle()->getTitle());
83 
84  m_display->replot();
85 }
86 
88 {
89  return m_type;
90 }
91 
92 
94 {
95  m_display->highlightOIds(oids, dataType);
96 }
97 
99 {
100  te::qt::widgets::ChartProperties dlg(this, this->parentWidget());
101  dlg.exec();
102 }
103 
105 {
106  emit selected(oids, add);
107 }
108 
110 {
111  m_display->setSelectionColor(selColor);
112 }
ChartDisplayWidget(QwtPlotSeriesItem *chart, int type, te::qt::widgets::ChartDisplay *display, QWidget *parent=0, Qt::WindowFlags f=0)
Constructor.
A dialog used to customize a graphic's parameters.
void onSettingsToolButtonnClicked()
Called when the user clicks on the Settings tool button.
QwtPlotSeriesItem * getChart()
Returns a pointer to the chart being displayed.
void setChart(QwtPlotSeriesItem *newChart)
It sets the chart that will be displayed
A class that models the description of a dataset.
Definition: DataSetType.h:72
void selected(te::da::ObjectIdSet *, const bool &)
Emmit when objects were selected.
void setSelectionColor(QColor selColor)
color used to hgihlight selected objects on this display.
ChartDisplay * m_display
The display that will be used to plot the chart.
void highlightOIds(const te::da::ObjectIdSet *oids, te::da::DataSetType *dataType)
Highlights the objects identified by oids.
te::qt::widgets::ChartDisplay * getDisplay()
Returns a pointer to the display being used.
void selectionChanged(te::da::ObjectIdSet *oids, const bool &add)
Called when objects were selected.
This class represents a set of unique ids created in the same context. i.e. from the same data set...
Definition: ObjectIdSet.h:55
A class to represent a chart display.
Definition: ChartDisplay.h:65
A widget used to display a set of charts.
A class used to define a chartDisplay's style.
A dialog used to customize a graphic's parameters, weather it is about it's data or it's visual style...
void setDisplay(te::qt::widgets::ChartDisplay *newDisplay)
It sets the display that will be used
A class to represent a chart display.
std::auto_ptr< Ui::ChartDisplayWidgetForm > m_ui
The widget form.