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 #ifndef Q_MOC_RUN
31 #include "../../../dataaccess/datasource/DataSource.h"
32 #include "../../../dataaccess/query/Fields.h"
33 #include "../../../maptools/DataSetLayer.h"
34 #endif
35 #include "../Config.h"
36 
37 //QT
38 #include <QDialog>
39 
40 namespace Ui { class TableLinkDialogForm; }
41 
42 namespace te
43 {
44  namespace da { class Join;
45  class Select; }
46 
47  namespace qt
48  {
49  namespace widgets
50  {
51  class DataSetTableView;
52 
53  /*!
54  \class TableLinkDialog
55 
56  \brief This class represents a TableLinkDialog component.
57  */
58  class TEQTWIDGETSEXPORT TableLinkDialog : public QDialog
59  {
60  Q_OBJECT
61 
62  public:
63 
64  /*!
65  \brief Constructor
66 
67  It constructs a TableLinkDialog.
68 
69  \param parent this dialogs's parent
70  \param f Window flags used to configure this dialog
71 
72  */
73  TableLinkDialog(QWidget* parent = 0, Qt::WindowFlags f = 0);
74 
75  /*!
76  \brief Destructor
77  */
78  ~TableLinkDialog();
79 
80  /*!
81  \brief It sets the Datasource that is being used to generate the new Layer.
82 
83  \param datasource The dasource being used.
84  */
85  void setInputLayer(te::map::AbstractLayerPtr inLayer);
86 
87  /*!
88  \brief Returns the generated Join.
89  \note The caller will take ownership of the returned pointer
90  */
91  te::da::Join* getJoin();
92 
93  /*!
94  \brief Returns a new query based on the requested parameters.
95  */
96  te::da::Select getSelectQuery();
97 
98  /*!
99  \brief Returns a new query layer based on the requested parameters.
100  */
101  te::map::AbstractLayerPtr getQueryLayer();
102 
103  public
104 
105  slots:
106 
107  int exec();
108 
109  protected:
110 
111  void getDataSets();
112 
113  void getProperties();
114 
115  protected
116 
117  slots:
118 
119  void done(int r);
120 
121  void onDataCBIndexChanged(int index);
122 
123  /*!
124  \brief Displays or hides the data of the tabular Dataset
125  */
126  void onDataToolButtonnClicked();
127 
128  void onOkPushButtonClicked();
129 
130  private:
131 
132  //No copy allowed
133  TableLinkDialog(const TableLinkDialog& rhs);
134  TableLinkDialog& operator=(const TableLinkDialog& rhs);
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::vector<std::string> m_properties; //!< The name of the properties that the output layer will contain
139  std::vector<std::string> m_keyProps; //!< The name of the properties that form the primary key
140  std::auto_ptr<DataSetTableView> m_tabularView; //!< The widget used to preview the data of the tabular dataset.
141  std::auto_ptr<Ui::TableLinkDialogForm> m_ui; //!< The widget's form.
142  };
143  } // end namespace widgets
144  } // end namespace qt
145 } // end namespace te
146 
147 #endif // __TERRALIB_QT_WIDGETS_INTERNAL_TABLELINKDIALOG_H
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1438
te::da::DataSourcePtr m_ds
The dasource of the layers to be linked.
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.
std::vector< std::string > m_properties
The name of the properties that the output layer will contain.
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
std::vector< std::string > m_keyProps
The name of the properties that form the primary key.