DissolveDialog.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/DissolveDialog.h
22 
23  \brief A dialog dissolve operation
24 */
25 
26 #ifndef __TERRALIB_VP_INTERNAL_DISSOLVEDIALOG_H
27 #define __TERRALIB_VP_INTERNAL_DISSOLVEDIALOG_H
28 
29 // TerraLib
30 #ifndef Q_MOC_RUN
31 #include "../../dataaccess/datasource/DataSourceInfo.h"
32 #include "../../datatype/Property.h"
33 #include "../../maptools/AbstractLayer.h"
34 #endif
35 
36 #include "../../statistics/core/Enums.h"
37 
38 #include "../AlgorithmParams.h"
39 #include "../Config.h"
40 #include "../Enums.h"
41 
42 // STL
43 #include <list>
44 #include <map>
45 #include <memory>
46 
47 // Qt
48 #include <QDialog>
49 
50 namespace Ui { class DissolveDialogForm; }
51 
52 // Forward declarations
53 class QListWidgetItem;
54 class QModelIndex;
55 class QTreeWidgetItem;
56 
57 namespace te
58 {
59  namespace vp
60  {
61 // Forward declarations
62  class LayerTreeModel;
63 
64  class TEVPEXPORT DissolveDialog : public QDialog
65  {
66  Q_OBJECT
67 
68  public:
69 
70  DissolveDialog(QWidget* parent = 0, Qt::WindowFlags f = 0);
71 
72  ~DissolveDialog();
73 
74  /*!
75  \brief Set the layer that can be used
76 
77  \param layers List of AbstractLayerPtr
78  \param selectedLayer Selected AbstractLayerPtr
79  */
80  void setLayers(std::list<te::map::AbstractLayerPtr> layers);
81 
82  /*!
83  \brief Get the Grouping Functions Type based on selected QListWidgetItem.
84 
85  \return Map with Properties and Grouping Functions Type.
86  */
87  std::map<te::dt::Property*, std::vector<te::stat::StatisticalSummary> > getStatisticalSummary();
88 
89  /*!
90  \brief Get the selected property based on selected QListWidgetItem using the name of property.
91 
92  \return a property.
93  */
94  te::dt::Property* getSelectedPropertyByName(std::string propertyName);
95 
96  /*!
97  \brief Get the selected properties based on selected QListWidgetItem.
98 
99  \return a Vector with selected properties.
100  */
101  std::vector<std::string> getSelectedPropertyNames();
102 
103  /*!
104  \brief Verify if the output result is a collection or single geometry.
105 
106  \return bool isCollection.
107  */
108  bool isCollection();
109 
110  /*!
111  \brief Get the generated layer.
112 
113  \return the generated layer.
114  */
115  te::map::AbstractLayerPtr getLayer();
116 
117  /*!
118  \brief Get warning messages.
119 
120  \return a vector of warnings.
121  */
122  std::vector<std::string> getWarnings();
123 
124  /*!
125  \brief Set Statistical Summary Type for combobox 'm_selectAllComboBox' and 'm_rejectAllComboBox' based on a enum.
126  */
127  void setStatisticalSummary();
128 
129  /*!
130  \brief Map Statistical Summary Type enum for an intuitive name.
131  */
132  void setStatisticalSummaryMap();
133 
134  /*!
135  \brief Set Grouping Functions Type for 'm_outputListWidget' based on Selected Layer.
136  */
137  void setFunctionsByLayer(std::vector<te::dt::Property*> properties);
138 
139  protected slots:
140 
141  void onLayerComboBoxChanged(int index);
142 
143  void onFilterLineEditTextChanged(const QString& text);
144 
145  void onAdvanced(bool visible);
146 
147  void onMultiGeometryChecked(bool checked);
148 
149  void onSelectAllComboBoxChanged(int index);
150 
151  void onRejectAllComboBoxChanged(int index);
152 
153  void onOutputListWidgetClicked(QListWidgetItem * item);
154 
155  void onTargetDatasourceToolButtonPressed();
156 
157  void onTargetFileToolButtonPressed();
158 
159  void onOkPushButtonClicked();
160 
161  void onCancelPushButtonClicked();
162 
163  private:
164 
165  typedef std::map<te::stat::StatisticalSummary, std::string> StaticalSummaryMap;
166 
167  std::auto_ptr<Ui::DissolveDialogForm> m_ui; //!< DialogForm
168  std::list<te::map::AbstractLayerPtr> m_layers; //!< List of layers.
169  te::map::AbstractLayerPtr m_inputLayer; //!< Layer used for dissolve
170 
171  std::vector<te::vp::InputParams> m_inputParams; //!< A vector of input parameters.
172  te::vp::AlgorithmParams* m_params; //!< Algorithm parameters.
173 
174  std::vector<te::dt::Property*> m_properties; //!< Properties related to the selected Layer
175  StaticalSummaryMap m_StatisticalSummaryMap; //!< Maping of Statistical Summary enum
176 
177  te::da::DataSourceInfoPtr m_outputDatasource; //!< DataSource information.
178  te::map::AbstractLayerPtr m_layer; //!< Generated Layer.
179 
180  bool m_toFile; //!< The output file is in a file.
181  std::vector<std::string> m_warnings; //!< Warnings during the operation.
182  };
183  } // end namespace vp
184 } // end namespace te
185 
186 #endif // __TERRALIB_VP_INTERNAL_DISSOLVEDIALOG_H
#define TEVPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
te::vp::AlgorithmParams * m_params
Algorithm parameters.
te::map::AbstractLayerPtr m_inputLayer
Layer used for dissolve.
std::vector< std::string > m_warnings
Warnings during the operation.
It models a property definition.
Definition: Property.h:59
std::auto_ptr< Ui::DissolveDialogForm > m_ui
DialogForm.
std::map< te::stat::StatisticalSummary, std::string > StaticalSummaryMap
URI C++ Library.
te::map::AbstractLayerPtr m_layer
Generated Layer.
std::list< te::map::AbstractLayerPtr > m_layers
List of layers.
std::vector< te::vp::InputParams > m_inputParams
A vector of input parameters.
bool m_toFile
The output file is in a file.
StaticalSummaryMap m_StatisticalSummaryMap
Maping of Statistical Summary enum.
std::vector< te::dt::Property * > m_properties
Properties related to the selected Layer.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
te::da::DataSourceInfoPtr m_outputDatasource
DataSource information.
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr