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  protected slots:
131 
132  /*!
133  \brief Called when the user selects an area of the canvas.
134  Will highlight the data, if possible, depending on the type of chart being displayed (f.e. histogram, scatter, etc).
135  */
136  void onRectPicked(const QRectF &rect);
137 
138  signals:
139 
140  /*!
141  \brief Emmit when objects were selected.
142  */
143  void selected(te::da::ObjectIdSet*, const bool&);
144 
145  /*!
146  \brief Emmit when a clicked with left button was made.
147  */
148  void leftPointSelected(const QPointF& pos);
149 
150  /*!
151  \brief Emmit when a clicked with rigth button was made.
152  */
153  void rigthPointSelected(const QPointF& pos);
154 
155  private:
156 
157  ChartStyle* m_chartStyle; //!< The display's style.
158  QwtPlotGrid* m_grid; //!< The display's grid
159  QwtPlotPanner* m_panner; //!< The display's panner.
160  QwtPlotPicker* m_leftPicker; //!< The display's left button picker.
161  QwtPlotPicker* m_leftPointPicker; //!< The display's left button picker.
162  QwtPlotPicker* m_rigthPointPicker; //!< The display's rigth button picker.
163  QwtPlotMagnifier* m_magnifier; //!< The display's magnifinifier.
164  QwtPlotPicker* m_ctrlPicker; //!< The display's control button picker.
165  QwtPlotPicker* m_shiftPicker; //!< The display's shift button picker.
166  };
167  } // end namespace widgets
168  } // end namespace qt
169 } // end namespace te
170 
171 #endif // __TERRALIB_QT_WIDGETS_INTERNAL_CHARTDISPLAY_H
172 
QwtPlotGrid * m_grid
The display's grid.
Definition: ChartDisplay.h:158
QwtPlotPicker * m_leftPicker
The display's left button picker.
Definition: ChartDisplay.h:160
QwtPlotPanner * m_panner
The display's panner.
Definition: ChartDisplay.h:159
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:164
ChartStyle * m_chartStyle
The display's style.
Definition: ChartDisplay.h:157
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:165
QwtPlotPicker * m_rigthPointPicker
The display's rigth button picker.
Definition: ChartDisplay.h:162
#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:163
QwtPlotPicker * m_leftPointPicker
The display's left button picker.
Definition: ChartDisplay.h:161