All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HistogramChart.h
Go to the documentation of this file.
1 /* Copyright (C) 2010-2013 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; }
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);
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 color used to hgihlight selected objects on this chart.
148 
149  \param selColor The color used to hgihlight selected objects on this chart.
150 
151  */
152  void setSelectionColor(QColor selColor);
153 
154  private:
155 
156  Histogram* m_histogram; //!< The histogram that will be shown on this chart.
157  StringScaleDraw* m_histogramScaleDraw; //!< Scale draw that defines how a label will be displayed on this chart.
158  te::qt::widgets::HistogramStyle* m_histogramStyle; //!< The histogram's style as displayed by this widget.
159  QwtPlotHistogram* m_selection; //!< The PlotItems to be highlighted when a selection occurs;
160 
161  };
162  } // end namespace widgets
163  } // end namespace qt
164 } // end namespace te
165 
166 #endif // __TERRALIB_QT_WIDGETS_INTERNAL_HISTOGRAMCHART_H
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:101
This class represents a set of unique ids created in the same context. i.e. from the same data set...
Definition: ObjectIdSet.h:53
A class to represent a Histogram.
Definition: Histogram.h:56
Histogram * m_histogram
The histogram that will be shown on this chart.
te::qt::widgets::HistogramStyle * m_histogramStyle
The histogram&#39;s style as displayed by this widget.
StringScaleDraw * m_histogramScaleDraw
Scale draw that defines how a label will be displayed on this chart.
QwtPlotHistogram * m_selection
The PlotItems to be highlighted when a selection occurs;.