ChartLayerWidget.h
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/ChartLayerWidget.h
22 
23  \brief A widget used to build a chart.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_CHARTS_INTERNAL_CHARTLAYERWIDGET_H
27 #define __TERRALIB_QT_WIDGETS_CHARTS_INTERNAL_CHARTLAYERWIDGET_H
28 
29 // TerraLib
30 #include "../../../maptools/AbstractLayer.h"
31 #include "../Config.h"
32 
33 // STL
34 #include <map>
35 #include <memory>
36 
37 // QT
38 #include <QWidget>
39 
40 // Forward declaraion
41 namespace Ui { class ChartLayerWidgetForm; }
42 
43 namespace te
44 {
45 // Forward declarations
46  namespace map { class Chart; }
47 
48  namespace qt
49  {
50  namespace widgets
51  {
52  // Forward declarations
53  class ColorPickerToolButton;
54 
55  /*!
56  \class ChartLayerWidget
57 
58  \brief A widget used to build a grouping.
59 
60  \sa
61  */
62  class TEQTWIDGETSEXPORT ChartLayerWidget : public QWidget
63  {
64  Q_OBJECT
65 
66  public:
67 
68  /** @name Initializer Methods
69  * Methods related to instantiation and destruction.
70  */
71  //@{
72 
73  /*! \brief Constructs a basic fill widget which is a child of parent, with widget flags set to f. */
74  ChartLayerWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
75 
76  /*! \brief Destructor. */
78 
79  //@}
80 
81  public:
82 
83  /*! \brief Set a layer. */
84  void setLayer(te::map::AbstractLayerPtr layer);
85 
86  /*!
87  \brief Creates the te::map::Chart object using the interface parameters
88 
89  \return true if the object was build and false in other case.
90 
91  \note This method set in layer the chart object.
92 
93  */
94  bool buildChart();
95 
96  /*!
97  \brief Update the interface with the chart properties
98  */
99  void setChart(te::map::Chart* chart);
100 
101  protected:
102 
103  /*! \brief Internal method to initialize the widget (e.g.: color, combos, icons, etc.) */
104  void initialize();
105 
106  /*! \brief List the layer attributes (from layer schema) */
107  void listAttributes();
108 
109 
110  public slots:
111 
112  /*! \brief Updates the widget form based on internal fill element. */
113  void updateUi();
114 
115  /*!
116  \brief Function used when the user clicked over the add tool button.
117 
118  \note This function adds a new attribute to be used in Chart object.
119  */
120  void onAddToolButtonClicked();
121 
122  /*!
123  \brief Function used when the user clicked over the remove tool button.
124 
125  \note This function removes a selected attribute used in Chart object.
126  */
127  void onRemoveToolButtonClicked();
128 
129  /*!
130  \brief Function used when the user clicked over the table (color column).
131 
132  \note This function gives a new color to a selected attribute.
133  */
134  void onItemClicked(int row, int column);
135 
136  double getMaxValue(te::map::Chart* chart);
137 
138  private:
139 
140  std::auto_ptr<Ui::ChartLayerWidgetForm> m_ui; //!< Widget form.
141  ColorPickerToolButton* m_colorPicker; //!< The color picker used to customise the color of several chart parameters.
142  te::map::AbstractLayerPtr m_layer; //!< TerraLib layer auto ptr
143  std::vector<std::pair<std::string, QColor> > m_chartVec; //!< Chart Vec
144  };
145 
146  } // end namespace widgets
147  } // end namespace qt
148 } // end namespace te
149 
150 #endif // __TERRALIB_QT_WIDGETS_SE_INTERNAL_CHARTLAYERWIDGET_H
A wdiget used to customize a chart's style parameters.
ColorPickerToolButton * m_colorPicker
The color picker used to customise the color of several chart parameters.
A widget used to build a grouping.
std::vector< std::pair< std::string, QColor > > m_chartVec
Chart Vec.
Custom tool button used to pick a color.
te::map::AbstractLayerPtr m_layer
TerraLib layer auto ptr.
This class represents the informations needed to build map charts.
Definition: Chart.h:51
URI C++ Library.
std::auto_ptr< Ui::ChartLayerWidgetForm > m_ui
Widget form.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr