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