ScatterChart.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/ScatterChart.h
22 
23  \brief A class to represent a scatter's chart.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_INTERNAL_SCATTERCHART_H
27 #define __TERRALIB_QT_WIDGETS_INTERNAL_SCATTERCHART_H
28 
29 //TerraLib
30 #include "../Config.h"
31 
32 //QWT
33 #include <qwt_plot_curve.h>
34 
35 //STL
36 #include <vector>
37 
38 namespace te
39 {
40 
41  namespace da { class ObjectIdSet; }
42  namespace qt
43  {
44  namespace widgets
45  {
46  // Forward declarations
47  class Scatter;
48  class ScatterStyle;
49 
50  /*!
51  \class ScatterChart
52 
53  \brief A class to represent a scatter chart.
54  */
55  class TEQTWIDGETSEXPORT ScatterChart : public QwtPlotCurve
56  {
57  public:
58 
59  /*!
60  \brief Constructor
61 
62  It constructs a scatter chart with a default mark and size.
63 
64  \note It will take the ownership of the pointers.
65  \note it will construct a chart with a default style.
66  */
67  ScatterChart(Scatter* data);
68 
69  /*!
70  \brief Constructor
71 
72  \note It will take the ownership of the pointer "style".
73  \note It will take the ownership of the pointer "data".
74  */
75  ScatterChart(Scatter* data, ScatterStyle* style, size_t size);
76 
77  /*! \brief Destructor. */
78  ~ScatterChart();
79 
80  /*! \brief Returns the chart's type. */
81  virtual int rtti() const;
82 
83  /*!
84  \brief It returns the chart's scatter.
85 
86  \return The chart's scatter.
87  */
88  te::qt::widgets::Scatter* getScatter();
89 
90  /*!
91  \brief It sets the chart's scatter.
92 
93  \param newHistogram The chart's new scatter.
94  \note It will take the ownership of the pointer "newScatter".
95  */
96  void setScatter(te::qt::widgets::Scatter* newScatter);
97 
98  /*!
99  \brief Returns a clone of the pointer to the scatter's style
100 
101  \return A ScatterStyle type pointer to the scatter's style.
102  \note The caller will take ownership of the returned pointer.
103  */
104  ScatterStyle* getScatterStyle();
105 
106  /*!
107  \brief It sets the chart's style.
108 
109  \param newStyle The chart's new style.
110  \note It will take the ownership of the pointer "newStyle".
111  */
112  void setScatterStyle(ScatterStyle* newStyle);
113 
114  /*!
115  \brief Highlights the objects identified by \a oids
116 
117  \param oids The identifiers of plotitems to be highlighted.
118  */
119  void highlight(const te::da::ObjectIdSet* oids);
120 
121  /*!
122  \brief Highlights the intervals identified by \a point
123 
124  \param point The point to be highlighted.
125  */
126  te::da::ObjectIdSet* highlight(QPointF point);
127 
128  /*!
129  \brief Highlights the intervals contained by \a rectangle
130 
131  \param rect The rectangle containing the intervals to be highlighted.
132  */
133  te::da::ObjectIdSet* highlight(QRectF rect);
134 
135  /*!
136  \brief color used to hgihlight selected objects on this chart.
137 
138  \param selColor The color used to hgihlight selected objects on this chart.
139 
140  */
141  void setSelectionColor(QColor selColor);
142 
143  void setData();
144 
145  private:
146  Scatter* m_scatter; //!< The scatter that will be shown on this chart.
147  ScatterStyle* m_scatterStyle; //!< The symbol that defines the look of a scatter's point.
148  QColor m_selColor; //!< The color used to highlight selected obecjts.
149  QwtPlotCurve* m_selection; //!< The PlotItems to be highlighted when a selection occurs;
150  };
151  } // end namespace widgets
152  } // end namespace qt
153 } // end namespace te
154 
155 #endif // __TERRALIB_QT_WIDGETS_INTERNAL_SCATTERCHART_H
156 
ScatterStyle * m_scatterStyle
The symbol that defines the look of a scatter's point.
Definition: ScatterChart.h:147
A class to represent a scatter.
Definition: Scatter.h:51
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.
QwtPlotCurve * m_selection
The PlotItems to be highlighted when a selection occurs;.
Definition: ScatterChart.h:149
A class to represent a scatter chart.
Definition: ScatterChart.h:55
QColor m_selColor
The color used to highlight selected obecjts.
Definition: ScatterChart.h:148
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
Scatter * m_scatter
The scatter that will be shown on this chart.
Definition: ScatterChart.h:146