HistogramChart.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/HistogramChart.h
22 
23  \brief A class to represent a histogram chart.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_INTERNAL_HISTOGRAMCHART_H
27 #define __TERRALIB_QT_WIDGETS_INTERNAL_HISTOGRAMCHART_H
28 
29 //TerraLib
30 #include "../Config.h"
31 
32 //QWT
33 #include <qwt_plot_histogram.h>
34 
35 namespace te
36 {
37 
38  namespace da { class ObjectIdSet; class DataSetType;}
39  namespace qt
40  {
41  namespace widgets
42  {
43  // Forward declarations
44  class Histogram;
45  class HistogramStyle;
46  class StringScaleDraw;
47 
48  /*!
49  \class HidtogramChart
50 
51  \brief A class to represent a histogram chart.
52  */
53  class TEQTWIDGETSEXPORT HistogramChart : public QwtPlotHistogram
54  {
55  public:
56 
57  /*!
58  \brief Constructor
59 
60  It constructs a histogram chart .
61 
62  \note It will take the ownership of the pointer "data".
63  \note it will take the ownership of the pointer "style". If style is null, the chart will be constructed with a default style.
64  */
66 
67  /*! \brief Destructor. */
68  ~HistogramChart();
69 
70  /*! \brief Returns the chart's type. */
71  virtual int rtti() const;
72 
73  /*!
74  \brief It returns the chart's scale draw.
75 
76  \return The chart's scale draw.
77  \note The caller will not take ownership of the returned pointer.
78  */
79 
80  StringScaleDraw* getScaleDraw();
81 
82  /*!
83  \brief It sets the chart's scale draw.
84 
85  \param new_labels The new chart's scale draw.
86  \note It will take the ownership of the pointer "newScaleDraw".
87  */
88 
89  void setScaleDraw( StringScaleDraw* newScaleDraw);
90 
91  /*!
92  \brief It atttaches a QwtPlot to this Cahrt
93 
94  \param plot The QwtPlot that will be attached to this chart.
95 
96  \note If the histogram's data contains string labels, this function will define how they are drawn
97  */
98  void attach(QwtPlot* plot);
99 
100  /*!
101  \brief It returns the chart's histogram.
102 
103  \return The chart's histogram.
104  \note The caller will not take ownership of the returned pointer.
105  */
106  te::qt::widgets::Histogram* getHistogram();
107 
108  /*!
109  \brief It sets the chart's histogram.
110 
111  \param newHistogram The chart's new histogram.
112  \note It will take the ownership of the pointer "newHistogram".
113  */
114  void setHistogram(te::qt::widgets::Histogram* newHistogram);
115 
116  /*!
117  \brief Returns a clone of the pointer to the histogram's style
118 
119  \return A HistogramStyle type pointer to the histogram's style.
120  \note The caller will take ownership of the returned pointer.
121  */
122  te::qt::widgets::HistogramStyle* getHistogramStyle();
123 
124  /*!
125  \brief It sets the chart's style.
126 
127  \param newStyle The chart's new style.
128  \note It will take the ownership of the pointer "newStyle".
129  */
130  void setHistogramStyle(te::qt::widgets::HistogramStyle* newStyle);
131 
132  /*!
133  \brief Highlights the objects identified by \a oids
134 
135  \param oids The identifiers of plotitems to be highlighted.
136  */
137  void highlight(const te::da::ObjectIdSet* oids, te::da::DataSetType* dataType);
138 
139  /*!
140  \brief Highlights the intervals identified by \a point
141 
142  \param point The point to be highlighted.
143  */
144  te::da::ObjectIdSet* highlight(QPointF point);
145 
146  /*!
147  \brief Highlights the intervals contained by \a rectangle
148 
149  \param rect The rectangle containing the intervals to be highlighted.
150  */
151  te::da::ObjectIdSet* highlight(QRectF rect);
152 
153  /*!
154  \brief color used to hgihlight selected objects on this chart.
155 
156  \param selColor The color used to hgihlight selected objects on this chart.
157 
158  */
159  void setSelectionColor(QColor selColor);
160 
161  void setData();
162 
163 
164  private:
165 
166  Histogram* m_histogram; //!< The histogram that will be shown on this chart.
167  StringScaleDraw* m_histogramScaleDraw; //!< Scale draw that defines how a label will be displayed on this chart.
168  te::qt::widgets::HistogramStyle* m_histogramStyle; //!< The histogram's style as displayed by this widget.
169  QwtPlotHistogram* m_selection; //!< The PlotItems to be highlighted when a selection occurs;
170 
171  };
172  } // end namespace widgets
173  } // end namespace qt
174 } // end namespace te
175 
176 #endif // __TERRALIB_QT_WIDGETS_INTERNAL_HISTOGRAMCHART_H
StringScaleDraw * m_histogramScaleDraw
Scale draw that defines how a label will be displayed on this chart.
A class that models the description of a dataset.
Definition: DataSetType.h:72
Histogram * m_histogram
The histogram that will be shown on this chart.
A class to represent a Histogram.
Definition: Histogram.h:56
te::qt::widgets::HistogramStyle * m_histogramStyle
The histogram's style as displayed by this widget.
This class represents a set of unique ids created in the same context. i.e. from the same data set...
Definition: ObjectIdSet.h:55
QwtPlotHistogram * m_selection
The PlotItems to be highlighted when a selection occurs;.
URI C++ Library.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63