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