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