ChartProperties.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/ChartProperties.cpp
22 
23  \brief A dialog used to customize a Chart's parameters, weather it is about it's data or it's visual style
24 */
25 //Terralib
26 
27 #include "ChartDisplay.h"
28 #include "ChartDisplayWidget.h"
29 #include "ChartProperties.h"
30 #include "ChartStyleFrameFactory.h"
31 #include "ChartWidget.h"
32 #include "ChartWidgetFactory.h"
33 #include "HistogramFrameFactory.h"
34 #include "ScatterFrameFactory.h"
35 #include "TimeSeriesFrameFactory.h"
36 #include "ui_ChartPropertiesDialogForm.h"
37 
38 //QWT
39 #include <qwt_plot_seriesitem.h>
40 
42  : QDialog(parent),
43  m_ui(new Ui::ChartPropertiesDialogForm),
44  m_curComp(nullptr),
45  m_chartWidget(chartWidget)
46 {
47  m_ui->setupUi(this);
48 
49  //init factories
50  switch (m_chartWidget->getType())
51  {
54  break;
57  break;
60  break;
61  }
62 
64 
65  std::vector<std::string> vec;
68 
69  while(it != d.end())
70  {
71  vec.push_back(it->first);
72  ++it;
73  }
74 
75  for(size_t i = 0; i < vec.size(); i++)
76  {
77  m_ui->m_componentsListWidget->addItem(vec[i].c_str());
78  }
79  m_ui->m_componentsListWidget->setFocus();
80  m_ui->m_tabWidget->clear();
81  m_curComp = te::qt::widgets::ChartWidgetFactory::make("Chart Style", m_ui->m_tabWidget);
82  m_ui->m_tabWidget->addTab(m_curComp, QString::fromUtf8("Chart Style"));
84  m_ui->m_componentsListWidget->setCurrentRow(0);
85  m_ui->m_helpPushButton->setPageReference("widgets/charts/style/style.html");
86 
87  connect(m_ui->m_componentsListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(onItemClicked(QListWidgetItem*)));
88  connect(m_ui->m_applyPushButton, SIGNAL(clicked()), this, SLOT(onApplyButtonClicked()));
89 }
90 
92 {
93  delete m_curComp;
94 }
95 
96 void te::qt::widgets::ChartProperties::onItemClicked(QListWidgetItem * current)
97 {
98  std::string value = current->text().toUtf8().data();
99  delete m_curComp;
103  m_ui->m_tabWidget->clear();
104  m_ui->m_tabWidget->addTab(m_curComp, QString::fromUtf8(value.c_str()));
105  m_curComp->show();
106 }
107 
109 {
110  if(m_ui->m_componentsListWidget->currentItem()->text() == "Chart Style")
111  {
113  }
114  else
115  {
117  }
118  this->close();
119 }
void onApplyButtonClicked()
Called when the user clicks on the apply button. It will set the configurations to the ChartDisplayWi...
virtual QwtPlotSeriesItem * getChart()
Returns a pointer to the chart being configured.
Definition: ChartWidget.cpp:37
ChartDisplayWidget * m_chartWidget
QwtPlotSeriesItem * getChart()
Returns a pointer to the chart being displayed.
void setChart(QwtPlotSeriesItem *newChart)
It sets the chart that will be displayed
A factory to build the timeSeries frame object.
ChartProperties(te::qt::widgets::ChartDisplayWidget *chartWidget, QWidget *parent=0)
Constructor.
static dictionary_type & getDictionary()
It returns a reference to the internal dictionary of concrete factories.
virtual void setDisplay(te::qt::widgets::ChartDisplay *newDisplay)
It sets the ChartDisplay being configured.
Definition: ChartWidget.cpp:54
A factory to build the Chart frame object.
void onItemClicked(QListWidgetItem *current)
Called when the user clicks on one of the items available at the list.
static te::qt::widgets::ChartWidget * make(const std::string &cwType)
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator const_iterator
te::qt::widgets::ChartDisplay * getDisplay()
Returns a pointer to the display being used.
virtual te::qt::widgets::ChartDisplay * getDisplay()
Returns a pointer to the display being configured.
Definition: ChartWidget.cpp:43
static te::dt::DateTime d(2010, 8, 9, 15, 58, 39)
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator end() const
It returns an iterator to the end of the container.
A base widget to be used on the chart settings.
std::unique_ptr< Ui::ChartPropertiesDialogForm > m_ui
A wdiget used to display a chart.
A factory to build the histogram frame object.
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator begin() const
It returns an iterator to the first stored factory.
A widget used to display a set of charts.
A dialog used to customize a graphic&#39;s parameters, weather it is about it&#39;s data or it&#39;s visual style...
void setDisplay(te::qt::widgets::ChartDisplay *newDisplay)
It sets the display that will be used
A factory to build widget objects.
A class to represent a chart display.
This class represents a dictionary of factories.
A factory to build the scatter frame object.
virtual void setChart(QwtPlotSeriesItem *newChart)
It sets the chart being configured.
Definition: ChartWidget.cpp:48