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