DataSetTableHorizontalHeader.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 #ifndef TE_QT_WIDGETS_DATASETTABLEHORIZONTALHEADER_H
22 #define TE_QT_WIDGETS_DATASETTABLEHORIZONTALHEADER_H
23 
24 #include "../../../dataaccess/datasource/DataSource.h"
25 
26 #include <QHeaderView>
27 
28 // STL
29 #include <map>
30 #include <string>
31 
32 namespace te
33 {
34  namespace da
35  {
36  class DataSet;
37  }
38 
39  namespace map
40  {
41  class AbstractLayer;
42  }
43 
44  namespace qt
45  {
46  namespace widgets
47  {
48  // Forward declaration
49  class DataSetTableView;
50 
52  {
53  std::string m_dataSourceId; //!< Data Source Id.
54  std::string m_dataSourceType; //!< Data Source Type.
55  std::map<std::string, std::string> m_connInfo; //!< Data Source Connection Info.
56  std::string m_layerId; //!< Layer Id.
57  std::string m_layerName; //!< Layer Name.
58  std::string m_layerTitle; //!< Layer Title.
59  std::string m_layerType; //!< Layer Type.
60  size_t m_fieldNumber; //!< Field Number.
61  std::string m_fieldName; //!< Field Name.
62  size_t m_fieldType; //!< Field Type.
63  };
64 
65  class DataSetTableHorizontalHeader : public QHeaderView
66  {
67  Q_OBJECT
68 
69  public:
70  /*!
71  \brief Constructor.
72 
73  \param parent DataSetTableView parent.
74  */
76 
77  /*!
78  \brief Sets the drag drop.
79 
80  \param b True: does the drag drop. False: do not drag drop.
81  */
82  void setDragDrop(bool b);
83 
84  /*!
85  \brief Gets the drag drop flag.
86 
87  \return True: is drag drop. False: not is drag drop.
88  */
89  bool getDragDrop();
90 
91  /*!
92  \brief Sets accept drop.
93 
94  \param b True: accept drop. False: not accept drop.
95  */
96  void setAcceptDrop(bool b);
97 
98  /*!
99  \brief Gets accept drop flag.
100 
101  \return True: accept drop. False: not accept drop.
102  */
103  bool getAcceptDrop();
104 
105  /*!
106  \brief Sets the layer to get drag and drop information.
107 
108  \param layer Pointer to the layer to be presented.
109  */
110  void setLayer(const te::map::AbstractLayer* layer);
111 
112  /*!
113  \brief Sets the data set to get drag and drop information.
114 
115  \param layer Pointer to the layer to be presented.
116  */
117  void setDataSet(te::da::DataSet* dset);
118 
119  signals:
120 
121  /*!
122  \brief Signal emitted when the drop event runs.
123 
124  \param firstFieldName Field name from first table.
125  \param secondFieldName Field name from the secont table.
126  */
127  void linkTable(std::string firstFieldName, std::string secondFieldName);
128 
129  /*!
130  \brief Signal emitted when the drop event runs.
131 
132  \param firstInfo Link information from the first table.
133  \param secondInfo Link information from the second table.
134  */
135  void linkTable(const LinkTableInfo& firstInfo, const LinkTableInfo& secondInfo);
136 
137  protected:
138  /*!
139  \brief Handles the mouse pres event e initiates the drag and drop if the flag is active.
140 
141  \param e The mouse event.
142  */
143  void mousePressEvent(QMouseEvent* e);
144 
145  /*!
146  \brief Handles the drag enter event.
147 
148  \param e The drag enter event.
149  */
150  void dragEnterEvent(QDragEnterEvent *e);
151 
152  /*!
153  \brief Handles the drag move event.
154 
155  \param e The drag move event.
156  */
157  void dragMoveEvent(QDragMoveEvent *e);
158 
159  /*!
160  \brief Handles the drop Event.
161 
162  \param e The drag enter event.
163  */
164  void dropEvent(QDropEvent *e);
165 
166  /*!
167  \brief It gets the layer data source.
168 
169  \param layer The layer from which we obtain the source.
170  */
172 
173  protected:
174  DataSetTableView* m_view; //!< data set table view pointer.
175  bool m_doDragDrop; //!< True: do drag and drop. False: do not drag and drop.
176  bool m_acceptDrop; //!< True: accept drop. False: not accept drop.
177  const te::map::AbstractLayer* m_layer; //!< To get information for drag and drop.
178  te::da::DataSet* m_dset; //!< To get information for drag and drop.
179  LinkTableInfo m_firstLinkInfo; //!< First link info.
180  LinkTableInfo m_secondLinkInfo; //!< Second link info.
181  std::map<std::string, std::string> m_connInfo; //!< connection info used for QMimeData.
182  };
183 
184  } // namespace widgets
185  } // namespace qt
186 } // namespace te
187 
188 #endif // TE_QT_WIDGETS_DATASETTABLEHORIZONTALHEADER_H
void setDragDrop(bool b)
Sets the drag drop.
DataSetTableView * m_view
data set table view pointer.
void setAcceptDrop(bool b)
Sets accept drop.
bool m_doDragDrop
True: do drag and drop. False: do not drag and drop.
void linkTable(std::string firstFieldName, std::string secondFieldName)
Signal emitted when the drop event runs.
This is the base class for layers.
Definition: AbstractLayer.h:76
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1435
const te::map::AbstractLayer * m_layer
To get information for drag and drop.
std::string m_dataSourceId
Data Source Id.
void mousePressEvent(QMouseEvent *e)
Handles the mouse pres event e initiates the drag and drop if the flag is active. ...
DataSetTableHorizontalHeader(DataSetTableView *view)
Constructor.
void setLayer(const te::map::AbstractLayer *layer)
Sets the layer to get drag and drop information.
te::da::DataSet * m_dset
To get information for drag and drop.
void dragEnterEvent(QDragEnterEvent *e)
Handles the drag enter event.
URI C++ Library.
void dragMoveEvent(QDragMoveEvent *e)
Handles the drag move event.
std::map< std::string, std::string > m_connInfo
connection info used for QMimeData.
bool getDragDrop()
Gets the drag drop flag.
void dropEvent(QDropEvent *e)
Handles the drop Event.
bool getAcceptDrop()
Gets accept drop flag.
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
std::string m_dataSourceType
Data Source Type.
std::map< std::string, std::string > m_connInfo
Data Source Connection Info.
A customized table view for te::map::AbstractLayer objects. Uses a te::qt::widgets::DataSetModel as i...
void setDataSet(te::da::DataSet *dset)
Sets the data set to get drag and drop information.
te::da::DataSourcePtr GetDataSource(const te::map::AbstractLayer *layer)
It gets the layer data source.
bool m_acceptDrop
True: accept drop. False: not accept drop.