MergeDialog.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/vp/qt/MergeDialog.h
22 
23  \brief A dialog merge operation
24 */
25 
26 #ifndef __TERRALIB_VP_INTERNAL_MERGEDIALOG_H
27 #define __TERRALIB_VP_INTERNAL_MERGEDIALOG_H
28 
29 // TerraLib
30 #ifndef Q_MOC_RUN
31 #include "../../dataaccess/datasource/DataSourceInfo.h"
32 #include "../../maptools/AbstractLayer.h"
33 #endif
34 #include "../Config.h"
35 
36 // STL
37 #include <memory>
38 
39 // Qt
40 #include <QDialog>
41 
42 namespace Ui { class MergeDialogForm; }
43 
44 // Forward declarations
45 class QComboBox;
46 
47 namespace te
48 {
49  namespace dt { class Property; }
50  namespace vp
51  {
52 // Forward declarations
53  class LayerTreeModel;
54 
55  class TEVPEXPORT MergeDialog : public QDialog
56  {
57  Q_OBJECT
58 
59  public:
60 
61  MergeDialog(QWidget* parent = 0, Qt::WindowFlags f = 0);
62 
63  ~MergeDialog();
64 
65  /*!
66  \brief Set the layer that can be used
67 
68  \param layers List of AbstractLayerPtr
69  \param selectedLayer Selected AbstractLayerPtr
70  */
71  void setLayers(std::list<te::map::AbstractLayerPtr> layers);
72 
73  /*!
74  \brief Get the generated layer.
75 
76  \return the generated layer.
77  */
78  te::map::AbstractLayerPtr getLayer();
79 
80  private:
81 
82  void updateTargetLayerComboBox();
83 
84  void updateOriginLayerComboBox();
85 
86  void updateAttrTableWidget();
87 
88  QComboBox* getPossibleAttributesComboBox(te::dt::Property* mainProp, std::vector<te::dt::Property*> props);
89 
90  QComboBox* getAllAttributesComboBox(std::vector<te::dt::Property*> props);
91 
92  std::vector<std::pair<std::string, std::string> > getTablePropertiesNames();
93 
94  protected slots:
95 
96  void onTargetLayerComboBoxChanged(int index);
97 
98  void onOriginLayerComboBoxChanged(int index);
99 
100  void onTargetDatasourceToolButtonPressed();
101 
102  void onTargetFileToolButtonPressed();
103 
104  void onOutputGroupBoxToggled(bool on);
105 
106  void onOkPushButtonClicked();
107 
108  void onCancelPushButtonClicked();
109 
110  private:
111 
112  std::auto_ptr<Ui::MergeDialogForm> m_ui;
113 
114  te::da::DataSourceInfoPtr m_outputDatasource; //!< DataSource information.
115  std::list<te::map::AbstractLayerPtr> m_layers; //!< List of layers.
117  bool m_toFile;
118 
121  };
122  } // end namespace vp
123 } // end namespace te
124 
125 #endif // __TERRALIB_VP_INTERNAL_MERGEDIALOG_H
#define TEVPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
std::list< te::map::AbstractLayerPtr > m_layers
List of layers.
Definition: MergeDialog.h:115
std::auto_ptr< Ui::MergeDialogForm > m_ui
Definition: MergeDialog.h:112
te::map::AbstractLayerPtr m_originSelectedLayer
Second layer selected.
Definition: MergeDialog.h:120
It models a property definition.
Definition: Property.h:59
URI C++ Library.
te::map::AbstractLayerPtr m_outputLayer
Generated Layer.
Definition: MergeDialog.h:116
te::map::AbstractLayerPtr m_targetSelectedLayer
Target layer selected.
Definition: MergeDialog.h:119
te::da::DataSourceInfoPtr m_outputDatasource
DataSource information.
Definition: MergeDialog.h:114
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr