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 #include <QActionGroup>
56 
57 // STL
58 #include <memory>
59 #include <string>
60 
61 // wtss.cxx
62 #include <wtss-cxx/data_types.hpp>
63 
64 namespace cxx = wtss::cxx;
65 
66 namespace Ui
67 {
68  class WtssDialogForm;
69 }
70 
71 namespace te
72 {
73  namespace qt
74  {
75  namespace plugins
76  {
77  namespace wtss
78  {
80  {
84  };
85 
86  class WtssDialog : public QDialog
87  {
88  Q_OBJECT
89 
90  public:
91 
92  WtssDialog(QWidget* parent = 0, Qt::WindowFlags f = 0);
93 
94  ~WtssDialog();
95 
96  void setMapDisplay(te::qt::widgets::MapDisplay* mapDisplay);
97 
98  void setActionGroup(QActionGroup* actionGroup);
99 
100  protected slots:
101 
102  void onServerAddButtonClicked();
103 
104  void onServerRemoveButtonClicked();
105 
106  void onServerRefreshButtonClicked();
107 
108  void onItemChecked(QTreeWidgetItem* item);
109 
110  void onHideButtonClicked();
111 
112  void onHelpButtonClicked();
113 
114  void onImportGraphClicked();
115 
116  void onExportGraphClicked();
117 
118  void onQueryButtonClicked();
119 
120  void onAddCoordToList(QListWidgetItem* coordSelected);
121 
122  void onGetPointCoordinate(QPointF& coord);
123 
124  void onPointPickerToggled(bool checked);
125 
126  signals:
127 
128  void close();
129 
130  private:
131 
132  void loadSettings();
133 
134  void addServer(QString server);
135 
136  void addCoverage(QTreeWidgetItem* serverItem, QJsonObject j_server);
137 
138  void addAtributes(QTreeWidgetItem* coverageItem,
139  QJsonObject j_coverage);
140 
141  bool validateQuery();
142 
143  void doTimeseriesQuery(cxx::timeseries_query_t query);
144 
145  void convertToTimeSeries(cxx::timeseries_query_result_t result);
146 
147  void plotTimeSeries();
148 
149  void enablePointPicker();
150 
151  void addMarker(double x, double y);
152 
153  QColor randomColor();
154 
155  void addLocation(double x, double y);
156 
157  void clearCanvas();
158 
159  void closeEvent(QCloseEvent* e);
160 
161  private:
162 
163  std::unique_ptr<Ui::WtssDialogForm> m_ui;
164 
165  bool dirty;
166 
168 
170 
172 
173  QJsonObject j_config;
174 
175  cxx::timeseries_query_result_t m_result;
176 
177  std::string m_lastQueriedServer;
178 
180 
182 
183  QVector<te::qt::widgets::TimeSeriesChart*> m_timeSeriesChartVec;
184 
185  std::vector<te::st::TimeSeries*> m_timeSeriesVec;
186 
188 
189  QActionGroup* m_actionGroup;
190 
191  QAction* m_pickerAction;
192  };
193  }
194  }
195  } // end namespace tl
196 } // end namespace wtss
197 
198 #endif // __TERRALIB_QT_PLUGINS_WTSS_WTSSDIALOG_H
#define slots
cxx::timeseries_query_result_t m_result
Definition: WtssDialog.h:175
std::vector< te::st::TimeSeries * > m_timeSeriesVec
Definition: WtssDialog.h:185
te::qt::widgets::ChartDisplay * m_chartDisplay
Definition: WtssDialog.h:181
A widget to control the display of a set of layers.
Definition: MapDisplay.h:71
te::qt::widgets::MapDisplay * m_mapDisplay
Definition: WtssDialog.h:179
URI C++ Library.
A class to represent a chart display.
Definition: ChartDisplay.h:65
std::unique_ptr< Ui::WtssDialogForm > m_ui
Definition: WtssDialog.h:163
te::color::RGBAColor ** m_rgbaMarker
Definition: WtssDialog.h:187
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57
QVector< te::qt::widgets::TimeSeriesChart * > m_timeSeriesChartVec
Definition: WtssDialog.h:183