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