DataSetSelectorWidget.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/dataset/selector/DataSetSelectorWidget.h
22 
23  \brief A wizard for selecting datasets from a data source.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_DATASET_SELECTOR_INTERNAL_DATASETSELECTORWIDGET_H
27 #define __TERRALIB_QT_WIDGETS_DATASET_SELECTOR_INTERNAL_DATASETSELECTORWIDGET_H
28 
29 // TerraLib
30 #include "../../../../dataaccess/dataset/DataSetType.h"
31 #include "../../../../dataaccess/datasource/DataSourceInfo.h"
32 #include "../../Config.h"
33 
34 // STL
35 #include <list>
36 #include <memory>
37 #include <set>
38 
39 // Qt
40 #include <QWidget>
41 
42 namespace Ui { class DataSetSelectorWidgetForm; }
43 
44 namespace te
45 {
46  namespace qt
47  {
48  namespace widgets
49  {
50  class DataSetDisplay;
51  class DataSetItem;
52  class DataSetGroupItem;
53  class DataSetTableView;
54  class DataSetTreeView;
55 
56  /*!
57  \class DataSetSelectorWidget
58 
59  \brief A wizard for selecting datasets from a data source.
60 
61  \ingroup widgets
62  */
64  {
65  Q_OBJECT
66 
67  public:
68 
69  DataSetSelectorWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
70 
72 
73  void set(const te::da::DataSourceInfoPtr& ds, bool useCheckableItems = false);
74 
75  void setMapPreviewVisible(bool visible);
76 
77  void setMapPreviewEnabled(bool enabled);
78 
79  void setDataPreviewVisible(bool visible);
80 
81  void setDataPreviewEnabled(bool enabled);
82 
83  void setNumPreviewRows(int nrows);
84 
85  std::list<te::da::DataSetTypePtr> getCheckedDataSets() const;
86 
87  bool hasCheckedDataSets() const;
88 
89  std::list<std::string> getCheckedGeomProperties() const;
90 
91  std::list<te::da::DataSetTypePtr> getSelectedDataSets() const;
92 
93  bool hasSelectedDataSets() const;
94 
95  std::list<std::string> getSelectedGeomProperties() const;
96 
97  DataSetTreeView* getTreeView() const;
98 
99  protected:
100 
101  void previewMap(const te::da::DataSetTypePtr& dataset);
102 
103  void previewData(const te::da::DataSetTypePtr& dataset);
104 
105  protected slots:
106 
107  void onDataSetToggled(DataSetItem* item);
108 
109  void onDataSetClicked(DataSetItem* item);
110 
111  void onDataSetGroupToggled(DataSetGroupItem* item);
112 
113  void onMapPreviewToggled(bool on);
114 
115  void onDataPreviewToggled(bool on);
116 
117  private:
118 
120  {
121  bool operator()(const te::da::DataSetTypePtr& first, const te::da::DataSetTypePtr& second) const;
122  };
123 
124  std::map<te::da::DataSetTypePtr, std::string, DataSetComparer> m_checkedDatasets;
125  std::auto_ptr<Ui::DataSetSelectorWidgetForm> m_ui;
126  std::auto_ptr<te::qt::widgets::DataSetDisplay> m_mapPreview;
127  std::auto_ptr<DataSetTableView> m_tblView;
128  std::auto_ptr<DataSetTreeView> m_datasetTreeView;
131  };
132 
133  } // end namespace widgets
134  } // end namespace qt
135 } // end namespace te
136 
137 #endif // __TERRALIB_QT_WIDGETS_DATASET_SELECTOR_INTERNAL_DATASETSELECTORWIDGET_H
138 
boost::shared_ptr< DataSetType > DataSetTypePtr
Definition: DataSetType.h:653
std::auto_ptr< DataSetTreeView > m_datasetTreeView
std::map< te::da::DataSetTypePtr, std::string, DataSetComparer > m_checkedDatasets
URI C++ Library.
A tree view for datasets of a data source.
std::auto_ptr< DataSetTableView > m_tblView
A wizard for selecting datasets from a data source.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
std::auto_ptr< te::qt::widgets::DataSetDisplay > m_mapPreview
std::auto_ptr< Ui::DataSetSelectorWidgetForm > m_ui
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr