ChartDisplay.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/ChartDisplay.h
22 
23  \brief A class to represent a chart display
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_INTERNAL_CHARTDISPLAY_H
27 #define __TERRALIB_QT_WIDGETS_INTERNAL_CHARTDISPLAY_H
28 
29 //TerraLib
30 #include "../Config.h"
31 
32 //QWT
33 #include <qwt_plot.h>
34 
35 //STL
36 #include <string>
37 
38 //QWT Forward declarations
39 class QwtPlotGrid;
40 class QwtPlotPanner;
41 class QwtPlotPicker;
42 class QwtPlotMagnifier;
43 
44 namespace te
45 {
46  namespace color { class RGBAColor; }
47  namespace da { class ObjectIdSet; class DataSetType;}
48  namespace se { class Stroke; class Fill; class Font; }
49 
50  namespace qt
51  {
52  namespace widgets
53  {
54 
55  //Forward declaration
56  class ChartStyle;
57 
58  /*!
59  \class ChartDisplay
60 
61  \brief A class to represent a chart display
62 
63  \ingroup widgets
64  */
65  class TEQTWIDGETSEXPORT ChartDisplay : public QwtPlot
66  {
67 
68  Q_OBJECT
69 
70  public:
71 
72  /*!
73  \brief Constructor
74 
75  It constructs a ChartDisplay with the given title and style.
76 
77  \param parent this widget's parent
78  \param title this widget's title.
79 
80  \note it will take the ownership of the pointer "style". If style is null, the display will be constructed with a default style.
81  */
82  ChartDisplay(QWidget* parent=NULL, QString title = "", ChartStyle* style = 0);
83 
84  /*!
85  \brief Destructor
86  */
87  ~ChartDisplay();
88 
89  /*!
90  \brief Returns a pointer to the display's style
91 
92  \return A ChartStyle type pointer to the display's style.
93  \note The caller will not take ownership of the returned pointer.
94  */
95  te::qt::widgets::ChartStyle* getStyle();
96 
97  /*!
98  \brief It sets the display's style
99 
100  \param newStyle The new style.
101  \note It will take ownership of the given pointer
102  */
103  void setStyle(te::qt::widgets::ChartStyle* newStyle);
104 
105  /*!
106  \brief Highlights the objects identified by \a oids
107 
108  \param oids The identifiers of plotitems to be highlighted.
109  */
110  void highlightOIds(const te::da::ObjectIdSet* oids, te::da::DataSetType* dataType);
111 
112  /*!
113  \brief color used to hgihlight selected objects on this display.
114 
115  \param selColor The color used to hgihlight selected objects on this display.
116 
117  */
118  void setSelectionColor(QColor selColor);
119 
120  /*!
121  \brief Updates the general display settings according to the ChartStyle.
122  The adjusted properties are:
123  Title;
124  Axis titles (x and Y);
125  Weather to display the grid or not;
126  Background color;
127  */
128  void adjustDisplay();
129 
130  /*!
131  \brief Enables or disables all the tools used to execute certain mouse actions.
132  Such as selection, pan and zoomn;
133  */
134  void enableTools(bool enabled);
135 
136  /*!
137  \brief Enables or disables the tools used to execute selection functions.
138  */
139  void enablePickers(bool enabled);
140 
141  /*!
142  \brief Enables or disables the tool used to execute zoom functions.
143  */
144  void enableMagnifier(bool enabled);
145 
146  /*!
147  \brief Enables or disables the tool used to execute pan functions.
148  */
149  void enablePan(bool enabled);
150 
151  /*!
152  \brief Enables or disables the pickers used tbroadcast point selection signals.
153  */
154  void enablePointPickers(bool enabled);
155 
156  protected slots:
157 
158  /*!
159  \brief Called when the user selects an area of the canvas.
160  Will highlight the data, if possible, depending on the type of chart being displayed (f.e. histogram, scatter, etc).
161  */
162  void onRectPicked(const QRectF &rect);
163 
164  signals:
165 
166  /*!
167  \brief Emmit when objects were selected.
168  */
169  void selected(te::da::ObjectIdSet*, const bool&);
170 
171  /*!
172  \brief Emmit when a clicked with left button was made.
173  */
174  void leftPointSelected(const QPointF& pos);
175 
176  /*!
177  \brief Emmit when a clicked with rigth button was made.
178  */
179  void rigthPointSelected(const QPointF& pos);
180 
181  private:
182 
183  ChartStyle* m_chartStyle; //!< The display's style.
184  QwtPlotGrid* m_grid; //!< The display's grid
185  QwtPlotPanner* m_panner; //!< The display's panner.
186  QwtPlotPicker* m_leftPicker; //!< The display's left button picker.
187  QwtPlotPicker* m_leftPointPicker; //!< The display's left button picker.
188  QwtPlotPicker* m_rigthPointPicker; //!< The display's rigth button picker.
189  QwtPlotMagnifier* m_magnifier; //!< The display's magnifinifier.
190  QwtPlotPicker* m_ctrlPicker; //!< The display's control button picker.
191  QwtPlotPicker* m_shiftPicker; //!< The display's shift button picker.
192  };
193  } // end namespace widgets
194  } // end namespace qt
195 } // end namespace te
196 
197 #endif // __TERRALIB_QT_WIDGETS_INTERNAL_CHARTDISPLAY_H
198 
QwtPlotGrid * m_grid
The display's grid.
Definition: ChartDisplay.h:184
QwtPlotPicker * m_leftPicker
The display's left button picker.
Definition: ChartDisplay.h:186
QwtPlotPanner * m_panner
The display's panner.
Definition: ChartDisplay.h:185
A class that models the description of a dataset.
Definition: DataSetType.h:72
QwtPlotPicker * m_ctrlPicker
The display's control button picker.
Definition: ChartDisplay.h:190
ChartStyle * m_chartStyle
The display's style.
Definition: ChartDisplay.h:183
This class represents a set of unique ids created in the same context. i.e. from the same data set...
Definition: ObjectIdSet.h:55
URI C++ Library.
A class to represent a chart display.
Definition: ChartDisplay.h:65
QwtPlotPicker * m_shiftPicker
The display's shift button picker.
Definition: ChartDisplay.h:191
QwtPlotPicker * m_rigthPointPicker
The display's rigth button picker.
Definition: ChartDisplay.h:188
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
QwtPlotMagnifier * m_magnifier
The display's magnifinifier.
Definition: ChartDisplay.h:189
QwtPlotPicker * m_leftPointPicker
The display's left button picker.
Definition: ChartDisplay.h:187