All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AbstractAction.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/qt/plugins/attributefill/AbstractAction.h
22 
23  \brief This file defines the abstract class AbstractAction
24 */
25 
26 #ifndef __TE_QT_PLUGINS_ATTRIBUTEFILL_INTERNAL_ABSTRACTACTION_H
27 #define __TE_QT_PLUGINS_ATTRIBUTEFILL_INTERNAL_ABSTRACTACTION_H
28 
29 // TerraLib
30 #include "../../../maptools/AbstractLayer.h"
31 #include "Config.h"
32 
33 // Qt
34 #include <QtCore/QObject>
35 #include <QMenu>
36 #include <QAction>
37 
38 namespace te
39 {
40  namespace qt
41  {
42  namespace plugins
43  {
44  namespace attributefill
45  {
46  /*!
47  \class AbstractAction
48 
49  \brief This is an abstract class used to register actions into Attribute Fill pluging.
50 
51  */
52  class AbstractAction : public QObject
53  {
54  Q_OBJECT
55 
56  public:
57 
58  /*!
59  \brief Constructor.
60 
61  \param menu The parent menu object.
62  */
63  AbstractAction(QMenu* menu);
64 
65  /*!
66  \brief Destructor.
67  */
68  virtual ~AbstractAction();
69 
70  protected slots:
71 
72  /*!
73  \brief Slot function used when a action was selected.
74 
75  \param checked Flag used in case a toggle action.
76  */
77  virtual void onActionActivated(bool checked) = 0;
78 
79  protected:
80 
81  /*!
82  \brief Create and set the actions parameters.
83 
84  \param name The action name.
85 
86  \param pixmap The action pixmap name.
87  */
88  void createAction(std::string name, std::string pixmap = "");
89 
90  /*!
91  \brief Add a new layer into layer explorer widget
92 
93  \param layer The layer auto pointer
94 
95  */
97 
98  /*!
99  \brief Get the selected layer from layer explorer in app
100 
101  \return The layer auto pointer
102 
103  */
105 
106  /*!
107  \brief Get the list of layers from app
108 
109  \return The list pf layer auto pointers
110 
111  */
112  std::list<te::map::AbstractLayerPtr> getLayers();
113 
114  public:
115  QAction* getAction()
116  {
117  return m_action;
118  }
119 
120  protected:
121 
122  QMenu* m_menu; //!< Parent Menu.
123  QAction* m_action; //!< Action used to call the process.
124  };
125 
126  } // end namespace attributefill
127  } // end namespace plugins
128  } // end namespace qt
129 } // end namespace te
130 
131 #endif //__TE_QT_PLUGINS_ATTRIBUTEFILL_INTERNAL_ABSTRACTACTION_H
Configuration flags for the attributefill Qt Widget plugin.
void addNewLayer(te::map::AbstractLayerPtr layer)
Add a new layer into layer explorer widget.
This is an abstract class used to register actions into Attribute Fill pluging.
std::list< te::map::AbstractLayerPtr > getLayers()
Get the list of layers from app.
QAction * m_action
Action used to call the process.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
void createAction(std::string name, std::string pixmap="")
Create and set the actions parameters.
virtual void onActionActivated(bool checked)=0
Slot function used when a action was selected.
te::map::AbstractLayerPtr getCurrentLayer()
Get the selected layer from layer explorer in app.