Loading...
Searching...
No Matches
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
35namespace 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. */
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
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 */
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 */
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 */
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 */
131
132 /*!
133 \brief Highlights the objects identified by \a oids
134
135 \param oids The identifiers of plotitems to be highlighted.
136 */
138
139 /*!
140 \brief Highlights the intervals identified by \a point
141
142 \param point The point to be highlighted.
143 */
145
146 /*!
147 \brief Highlights the intervals contained by \a rectangle
148
149 \param rect The rectangle containing the intervals to be highlighted.
150 */
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
A class that models the description of a dataset.
Definition: DataSetType.h:73
This class represents a set of unique ids created in the same context. i.e. from the same data set.
Definition: ObjectIdSet.h:56
void setHistogramStyle(te::qt::widgets::HistogramStyle *newStyle)
It sets the chart's style.
te::qt::widgets::Histogram * getHistogram()
It returns the chart's histogram.
void setSelectionColor(QColor selColor)
color used to hgihlight selected objects on this chart.
QwtPlotHistogram * m_selection
The PlotItems to be highlighted when a selection occurs;.
void setHistogram(te::qt::widgets::Histogram *newHistogram)
It sets the chart's histogram.
virtual int rtti() const
Returns the chart's type.
HistogramChart(Histogram *data, te::qt::widgets::HistogramStyle *style=0)
Constructor.
te::da::ObjectIdSet * highlight(QPointF point)
Highlights the intervals identified by point.
te::qt::widgets::HistogramStyle * m_histogramStyle
The histogram's style as displayed by this widget.
te::qt::widgets::HistogramStyle * getHistogramStyle()
Returns a clone of the pointer to the histogram's style.
void setScaleDraw(StringScaleDraw *newScaleDraw)
It sets the chart's scale draw.
void attach(QwtPlot *plot)
It atttaches a QwtPlot to this Cahrt.
void highlight(const te::da::ObjectIdSet *oids, te::da::DataSetType *dataType)
Highlights the objects identified by oids.
StringScaleDraw * getScaleDraw()
It returns the chart's scale draw.
StringScaleDraw * m_histogramScaleDraw
Scale draw that defines how a label will be displayed on this chart.
Histogram * m_histogram
The histogram that will be shown on this chart.
te::da::ObjectIdSet * highlight(QRectF rect)
Highlights the intervals contained by rectangle.
A class to represent a Histogram.
Definition: Histogram.h:57
TerraLib.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63