TableLinkDialog.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/externaltable/TableLinkDialog.h
22 
23  \brief A Qt dialog that allows users to create a new query layer based on the information of two distinct datasets
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_INTERNAL_TABLELINKDIALOG_H
27 #define __TERRALIB_QT_WIDGETS_INTERNAL_TABLELINKDIALOG_H
28 
29 // TerraLib
30 #include "../../../dataaccess/datasource/DataSource.h"
31 #include "../../../dataaccess/query/Fields.h"
32 #include "../../../maptools/DataSetLayer.h"
33 #include "../Config.h"
34 
35 //QT
36 #include <QDialog>
37 
38 namespace Ui { class TableLinkDialogForm; }
39 
40 namespace te
41 {
42  namespace da { class Join;
43  class Select; }
44 
45  namespace qt
46  {
47  namespace widgets
48  {
49  class DataSetTableView;
50  class FieldsDialog;
51 
52  /*!
53  \class TableLinkDialog
54 
55  \brief This class represents a TableLinkDialog component.
56  */
57  class TEQTWIDGETSEXPORT TableLinkDialog : public QDialog
58  {
59  Q_OBJECT
60 
61  public:
62 
63  /*!
64  \brief Constructor
65 
66  It constructs a TableLinkDialog.
67 
68  \param parent this dialogs's parent
69  \param f Window flags used to configure this dialog
70 
71  */
72  TableLinkDialog(QWidget* parent = 0, Qt::WindowFlags f = 0);
73 
74  /*!
75  \brief Destructor
76  */
77  ~TableLinkDialog();
78 
79  /*!
80  \brief It sets the Datasource that is being used to generate the new Layer.
81 
82  \param datasource The dasource being used.
83  */
84  void setInputLayer(te::map::AbstractLayerPtr inLayer);
85 
86  /*!
87  \brief Returns the generated Join.
88  \note The caller will take ownership of the returned pointer
89  */
90  te::da::Join* getJoin();
91 
92  /*!
93  \brief Returns a new query based on the requested parameters.
94  */
95  te::da::Select getSelectQuery();
96 
97  /*!
98  \brief Returns a new query layer based on the requested parameters.
99  */
100  te::map::AbstractLayerPtr getQueryLayer();
101 
102  public
103 
104  slots:
105 
106  int exec();
107 
108  protected:
109 
110  void getDataSets();
111 
112  void getProperties();
113 
114  protected
115 
116  slots:
117 
118  void done(int r);
119 
120  void onDataCBIndexChanged(int index);
121 
122  /*!
123  \brief Displays or hides the data of the tabular Dataset
124  */
125  void onDataToolButtonnClicked();
126 
127  /*!
128  \brief Displays or hides the widget's used to configure the query's fields.
129  */
130  void onAdvancedToolButtonnClicked();
131 
132  void onOkPushButtonClicked();
133 
134  private:
135 
136  te::map::DataSetLayerPtr m_inputLayer; //!< The layer the will serve as the base for the link.
137  te::da::DataSourcePtr m_ds; //!< The dasource of the layers to be linked.
138  std::auto_ptr<DataSetTableView> m_tabularView; //!< The widget used to preview the data of the tabular dataset.
139  std::auto_ptr<FieldsDialog> m_fieldsDialog; //!< The widget used to select which fields will be added to the query.
140  std::auto_ptr<Ui::TableLinkDialogForm> m_ui; //!< The widget's form.
141  };
142  } // end namespace widgets
143  } // end namespace qt
144 } // end namespace te
145 
146 #endif // __TERRALIB_QT_WIDGETS_INTERNAL_TABLELINKDIALOG_H
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1435
te::da::DataSourcePtr m_ds
The dasource of the layers to be linked.
std::auto_ptr< FieldsDialog > m_fieldsDialog
The widget used to select which fields will be added to the query.
std::auto_ptr< Ui::TableLinkDialogForm > m_ui
The widget's form.
te::map::DataSetLayerPtr m_inputLayer
The layer the will serve as the base for the link.
URI C++ Library.
A Join clause combines two FromItems.
Definition: Join.h:50
std::auto_ptr< DataSetTableView > m_tabularView
The widget used to preview the data of the tabular dataset.
A Select models a query to be used when retrieving data from a DataSource.
Definition: Select.h:65
This class represents a TableLinkDialog component.
boost::intrusive_ptr< DataSetLayer > DataSetLayerPtr
Definition: DataSetLayer.h:146
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr