VectorProcessingOperationDialog.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 src/terralib/vp/qt/VectorProcessingOperationDialog.h
22  *
23  * \brief Implements a dialog used to execute a vector processing operation
24  */
25 
26 #ifndef __TERRALIB_VP_QT_INTERNAL_VECTORPROCESSINGOPERATIONDIALOG_H
27 #define __TERRALIB_VP_QT_INTERNAL_VECTORPROCESSINGOPERATIONDIALOG_H
28 
29 #include "../Config.h"
30 
31  // TerraLib Includes
32 #include "../../maptools/AbstractLayer.h"
33 #include "../OperationThreadManagerListener.h"
34 
35 // STL Includes
36 #include <memory>
37 
38  // Qt Includes
39 #include <QDialog>
40 #include <QPixmap>
41 
42 namespace Ui { class VectorProcessingOperationDialogForm; }
43 
44 class CurrentExecutionImpl;
45 
46 namespace te
47 {
48  namespace common
49  {
50  class TaskProgress;
51  }
52 
53  namespace da
54  {
55  class DataAccess;
56  }
57 
58  namespace qt
59  {
60  namespace widgets
61  {
62  class ProgressViewerTaskWidget;
63  }
64  }
65 
66  namespace vp
67  {
68  class AbstractOperation;
69  class OperationThreadManager;
70  enum class ProgressState;
71  enum class OperationResult;
72 
73  namespace qt
74  {
75  class InputDataAccessWidget;
76  class OutputDataAccessWidget;
77  class SpecificParametersWidget;
78 
80  {
81  Q_OBJECT
82 
83  signals:
84 
85  void processingStateChangedSignal(const te::vp::ProgressState& newState);
86 
87  void processingFinishedSignal(const te::vp::OperationResult& result);
88 
89  public:
90 
91  void processingStateChanged(const te::vp::ProgressState& newState) override
92  {
93  emit processingStateChangedSignal(newState);
94  }
95 
96  void processingFinished(const te::vp::OperationResult& result) override
97  {
98  emit processingFinishedSignal(result);
99  }
100  };
101 
102 
103  /*!
104  \class VectorProcessingOperationDialog
105 
106  \brief Implements a dialog used to execute a vector processing operation
107  */
109  {
110  Q_OBJECT
111 
112  public:
113 
114  /*!
115  \brief Constructor.
116  */
117  VectorProcessingOperationDialog(QWidget* parent = 0, Qt::WindowFlags f = 0);
118 
119  /*!
120  \brief Destructor.
121  */
123 
124  public:
125 
126  /*!
127  \brief Returns the internal widget
128 
129  \return Pointer to Qt Widget InputDataAccessItemWidgetForm
130  */
131  Ui::VectorProcessingOperationDialogForm* getForm() const;
132 
133  /*!
134  \brief Inits the dialog by setting the the operation to be executed in interface and the list of available input layers
135 
136  \param operation Pointer to a TerraLib VP operation
137  \param layers The list of available input layers
138 
139  \note NOT take the ownership of this object
140  */
141  void init(const std::string& operationName, const std::list<te::map::AbstractLayerPtr>& layers);
142 
143  te::vp::OperationResult getResult() const;
144 
145  std::list<te::map::AbstractLayerPtr> getOutputLayers();
146 
147  void keyPressEvent(QKeyEvent* event);
148 
149  protected:
150 
151  void setDialogOnExecution(bool onExecution);
152 
153  protected slots:
154 
155  void onProcessingStateChanged(const te::vp::ProgressState& newState);
156 
157  void onProcessingFinished(const te::vp::OperationResult& result);
158 
159  void taskCancelled();
160 
161  void onClose();
162 
163  /*!
164  \brief Interface tool button to execute the vectorial process operation
165  */
166  void onExecuteOperationToolButtonPressed();
167 
168  private:
169 
170  std::unique_ptr<Ui::VectorProcessingOperationDialogForm> m_ui; //!< Pointer to Qt widget
171 
172  te::vp::qt::InputDataAccessWidget* m_inputDataWidget; //!< TerraLib Qt component used to get input data access
173 
174  te::vp::qt::OutputDataAccessWidget* m_outputDataWidget; //!< TerraLib Qt component used to get output data access
175 
176  te::vp::qt::SpecificParametersWidget* m_specificParamsWidget; //!< TerraLib Qt component with specific parameters for each operation
177 
178  std::string m_operationName; //!< The name of the operation to be created and executed
179 
180  te::qt::widgets::ProgressViewerTaskWidget* m_progressViewer; //!< TerraLib Qt component to represent a progress viewer
181 
182  QtOperationThreadManagerListener m_processListener; //!< A listener to the status of the execution
183 
184  std::unique_ptr< CurrentExecutionImpl > m_run; //!< The implementation of one execution
185 
186  std::vector< std::unique_ptr<te::da::DataAccess> > m_vecOverallOutputDataAccess; //!< Stores all the outputs considering all the executions
187  };
188  } // end namespace qt
189  } // end namespace qt
190 } // end namespace qt
191 
192 
193 #endif // __TERRALIB_VP_QT_INTERNAL_VECTORPROCESSINGOPERATIONDIALOG_H
194 
#define TEVPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
#define slots
Implements a dialog used to execute a vector processing operation.
QtOperationThreadManagerListener m_processListener
A listener to the status of the execution.
A progress viewer for a unique task.
Implements a widget used to return a set of Data Access object.
std::unique_ptr< CurrentExecutionImpl > m_run
The implementation of one execution.
std::string m_operationName
The name of the operation to be created and executed.
TerraLib.
Abstract class used do define a component to set specific parameters for each operation.
te::vp::qt::OutputDataAccessWidget * m_outputDataWidget
TerraLib Qt component used to get output data access.
void processingStateChanged(const te::vp::ProgressState &newState) override
void processingFinished(const te::vp::OperationResult &result) override
te::qt::widgets::ProgressViewerTaskWidget * m_progressViewer
TerraLib Qt component to represent a progress viewer.
std::unique_ptr< Ui::VectorProcessingOperationDialogForm > m_ui
Pointer to Qt widget.
te::vp::qt::SpecificParametersWidget * m_specificParamsWidget
TerraLib Qt component with specific parameters for each operation.
te::vp::qt::InputDataAccessWidget * m_inputDataWidget
TerraLib Qt component used to get input data access.
std::vector< std::unique_ptr< te::da::DataAccess > > m_vecOverallOutputDataAccess
Stores all the outputs considering all the executions.