WtssDialog.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
3 
4  This file is part of the TerraLib - a Framework for building GIS enabled
5  applications.
6 
7  TerraLib is free software: you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation, either version 3 of the License,
10  or (at your option) any later version.
11 
12  TerraLib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with TerraLib. See COPYING. If not, write to
19  TerraLib Team at <terralib-team@terralib.org>.
20 */
21 
22 /*!
23  \file terralib/qt/plugins/wtss/WtssDialog.h
24 
25  \brief Configuration dialog for Web Time Series Services plugin.
26 
27  \author Matheus Cavassan Zaglia
28  */
29 
30 #ifndef __TERRALIB_QT_PLUGINS_WTSS_WTSSDIALOG_H
31 #define __TERRALIB_QT_PLUGINS_WTSS_WTSSDIALOG_H
32 
33 // TerraLib
34 #ifndef Q_MOC_RUN
35 #include "../../../common.h"
36 #include "../../../datatype/Date.h"
37 #include "../../../se/Mark.h"
38 #include "../../../st/core/timeseries/TimeSeries.h"
39 #include "../../widgets/canvas/Canvas.h"
40 #include "../../widgets/canvas/MapDisplay.h"
41 #include "../../widgets/charts/ChartDisplay.h"
42 #include "../../widgets/charts/ChartDisplayWidget.h"
43 #include "../../widgets/charts/ChartStyle.h"
44 #include "../../widgets/charts/TimeSeriesChart.h"
45 #endif
46 
47 // QT
48 #include <QColor>
49 #include <QDialog>
50 #include <QGridLayout>
51 #include <QListWidgetItem>
52 #include <QObject>
53 #include <QTreeWidget>
54 #include <QtGui>
55 
56 // STL
57 #include <memory>
58 #include <string>
59 
60 // wtss.cxx
61 #include <wtss-cxx/data_types.hpp>
62 
63 namespace cxx = wtss::cxx;
64 
65 namespace Ui
66 {
67  class WtssDialogForm;
68 }
69 
70 namespace te
71 {
72  namespace qt
73  {
74  namespace plugins
75  {
76  namespace wtss
77  {
79  {
83  };
84 
85  class WtssDialog : public QDialog
86  {
87  Q_OBJECT
88 
89  public:
90 
91  WtssDialog(QWidget* parent = 0, Qt::WindowFlags f = 0);
92 
93  ~WtssDialog();
94 
96 
97  std::vector<te::st::TimeSeries*> getTimeSeries();
98 
99  protected slots:
100 
102 
104 
106 
107  void onItemChecked(QTreeWidgetItem* item);
108 
109  void onHideButtonClicked();
110 
111  void onHelpButtonClicked();
112 
113  void onImportGraphClicked();
114 
115  void onExportGraphClicked();
116 
117  void onQueryButtonClicked();
118 
119  void onAddCoordToList(QListWidgetItem* coordSelected);
120 
121  void onGetPointCoordinate(QPointF& coord);
122 
123  signals:
124 
125  void pointPicked(QPointF& coord);
126 
127  void close();
128 
129  private:
130 
131  void loadSettings();
132 
133  void serverSettings();
134 
135  void dateSettings();
136 
137  void addServer(QString server);
138 
139  void addCoverage(QTreeWidgetItem* serverItem, QJsonObject j_server);
140 
141  void addAtributes(QTreeWidgetItem* coverageItem,
142  QJsonObject j_coverage);
143 
144  bool validateQuery();
145 
146  void doTimeseriesQuery(cxx::timeseries_query_t query);
147 
148  void convertToTimeSeries(cxx::timeseries_query_result_t result);
149 
150  void plotTimeSeries();
151 
152  void defineDisplay();
153 
154  void defineMarker();
155 
156  void enablePointPicker();
157 
158  void setPointPicked(QPointF& coord);
159 
160  void addMarker(double x, double y);
161 
162  QColor randomColor();
163 
164  void addLocation(double x, double y);
165 
166  void clearCanvas();
167 
168  void closeEvent(QCloseEvent* e);
169 
170  private:
171 
172  std::auto_ptr<Ui::WtssDialogForm> m_ui;
173 
174  bool dirty;
175 
177 
179 
181 
182  QJsonObject j_config;
183 
184  cxx::timeseries_query_result_t m_result;
185 
186  std::string m_lastQueriedServer;
187 
189 
191 
192  std::vector<te::st::TimeSeries*> m_timeSeriesVec;
193 
195 
196  };
197  }
198  }
199  } // end namespace tl
200 } // end namespace wtss
201 
202 #endif // __TERRALIB_QT_PLUGINS_WTSS_WTSSDIALOG_H
void doTimeseriesQuery(cxx::timeseries_query_t query)
void onGetPointCoordinate(QPointF &coord)
cxx::timeseries_query_result_t m_result
Definition: WtssDialog.h:184
void addServer(QString server)
std::vector< te::st::TimeSeries * > m_timeSeriesVec
Definition: WtssDialog.h:192
te::qt::widgets::ChartDisplay * m_chartDisplay
Definition: WtssDialog.h:190
void addCoverage(QTreeWidgetItem *serverItem, QJsonObject j_server)
void addLocation(double x, double y)
std::auto_ptr< Ui::WtssDialogForm > m_ui
Definition: WtssDialog.h:172
void convertToTimeSeries(cxx::timeseries_query_result_t result)
A widget to control the display of a set of layers.
Definition: MapDisplay.h:69
void setPointPicked(QPointF &coord)
void setMapDisplay(te::qt::widgets::MapDisplay *mapDisplay)
te::qt::widgets::MapDisplay * m_mapDisplay
Definition: WtssDialog.h:188
URI C++ Library.
void addMarker(double x, double y)
A class to represent a chart display.
Definition: ChartDisplay.h:65
void pointPicked(QPointF &coord)
void onItemChecked(QTreeWidgetItem *item)
te::color::RGBAColor ** m_rgbaMarker
Definition: WtssDialog.h:194
void closeEvent(QCloseEvent *e)
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57
WtssDialog(QWidget *parent=0, Qt::WindowFlags f=0)
std::vector< te::st::TimeSeries * > getTimeSeries()
void onAddCoordToList(QListWidgetItem *coordSelected)
void addAtributes(QTreeWidgetItem *coverageItem, QJsonObject j_coverage)