TimeSeriesChart.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/TimeSeriesChart.h
22 
23  \brief A class to represent a timeSeries' chart.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_INTERNAL_TIMESERIESCHART_H
27 #define __TERRALIB_QT_WIDGETS_INTERNAL_TIMESERIESCHART_H
28 
29 //TerraLib
30 #include "../Config.h"
31 
32 //QWT
33 #include <qwt_plot_curve.h>
34 
35 //STL
36 #include <vector>
37 #include <set>
38 
39 namespace te
40 {
41 
42  namespace da { class ObjectIdSet; }
43  namespace st { class TimeSeries; }
44  namespace qt
45  {
46  namespace widgets
47  {
48  // Forward declarations
49  class TimeSeriesStyle;
50 
51  /*!
52  \class TimeSeriesChart
53 
54  \brief A class to represent a timeSeries chart.
55  */
56  class TEQTWIDGETSEXPORT TimeSeriesChart : public QwtPlotCurve
57  {
58  public:
59 
60  /*!
61  \brief Constructor
62 
63  It constructs a TimeSeres chart with a default style.
64 
65  \note It will take the ownership of the pointers.
66  \note it will construct a chart with a default style.
67  */
69 
70  /*!
71  \brief Constructor
72 
73  \note It will take the ownership of the pointer "style".
74  \note It will take the ownership of the pointer "data".
75  */
76  TimeSeriesChart(te::st::TimeSeries* data, TimeSeriesStyle* style, size_t size);
77 
78  /*! \brief Destructor. */
79  ~TimeSeriesChart();
80 
81  /*! \brief Returns the chart's type. */
82  virtual int rtti() const;
83 
84  /*!
85  \brief It atttaches a QwtPlot to this Cahrt
86 
87  \param plot The QwtPlot that will be attached to this chart.
88  */
89  void attach(QwtPlot* plot);
90 
91  /*!
92  \brief It returns the chart's timeSeries.
93 
94  \return The chart's timeSeries.
95  */
96  te::st::TimeSeries* getTimeSeries();
97 
98  /*!
99  \brief It sets the chart's timeSeries.
100 
101  \param newHistogram The chart's new scatter.
102  \note It will take the ownership of the pointer "newScatter".
103  */
104  void setTimeSeries(te::st::TimeSeries* newTimeSeries);
105 
106  /*!
107  \brief Returns a clone of the pointer to the timeSeries' style
108 
109  \return A ScatterStyle type pointer to the timeSeries' style.
110  \note The caller will take ownership of the returned pointer.
111  */
112  TimeSeriesStyle* getTimeSeriesStyle();
113 
114  /*!
115  \brief It sets the chart's style.
116 
117  \param newStyle The chart's new style.
118  \note It will take the ownership of the pointer "newStyle".
119  */
120  void setTimeSeriesStyle(TimeSeriesStyle* newStyle);
121 
122  /*!
123  \brief It sets the date format that will be used on the labels.
124 
125  The default format strings are:
126 
127  - Millisecond :hh:mm:ss:zzz\nddd dd MMM yyyy
128  - Second: hh:mm:ss\nddd dd MMM yyyy
129  - Minute: hh:mm\nddd dd MMM yyyy
130  - Hour: hh:mm\nddd dd MMM yyyy
131  - Day: ddd dd MMM yyyy
132  - Week Www yyyy
133  - Month: MMM yyyy
134  - Year: yyyy
135  */
136  void setDateFormat(std::string dateFormat);
137 
138  void setData();
139 
140  private:
141  te::st::TimeSeries* m_timeSeries; //!< The scatter that will be shown on this chart.
142  std::set<std::string> m_dates; //!< The dates that will be plotted on the X axis.
143  TimeSeriesStyle* m_timeSeriesStyle; //!< The symbol that defines the look of a scatter's point.
144  QColor m_selColor; //!< The color used to highlight selected obecjts.
145  };
146  } // end namespace widgets
147  } // end namespace qt
148 } // end namespace te
149 
150 
151 #endif // __TERRALIB_QT_WIDGETS_INTERNAL_TIMESERIESCHART_H
std::set< std::string > m_dates
The dates that will be plotted on the X axis.
URI C++ Library.
TimeSeriesStyle * m_timeSeriesStyle
The symbol that defines the look of a scatter's point.
QColor m_selColor
The color used to highlight selected obecjts.
A class to represent time series.
Definition: TimeSeries.h:66
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
te::st::TimeSeries * m_timeSeries
The scatter that will be shown on this chart.
A class to represent a timeSeries chart.