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