ToolBar.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/edit/ToolBar.h
22 
23  \brief The main toolbar of TerraLib Edit Qt plugin.
24 */
25 
26 #ifndef __TERRALIB_QT_PLUGINS_EDIT_INTERNAL_TOOLBAR_H
27 #define __TERRALIB_QT_PLUGINS_EDIT_INTERNAL_TOOLBAR_H
28 
29 // TerraLib
30 #ifndef Q_MOC_RUN
31 #include "../../../maptools/AbstractLayer.h"
32 #endif
33 #include "Config.h"
34 
35 // Qt
36 #include <QAction>
37 #include <QIcon>
38 #include <QList>
39 #include <QToolBar>
40 #include <QUndoView>
41 
42 // STL
43 #include <string>
44 
45 namespace te
46 {
47  namespace edit
48  {
49  class GeometriesUpdateTool;
50  }
51 
52  namespace qt
53  {
54  namespace af
55  {
56  class MapDisplay;
57 
58  namespace evt
59  {
60  struct Event;
61  }
62  }
63 
64  namespace plugins
65  {
66  namespace edit
67  {
68  /*!
69  \class ToolBar
70 
71  \brief The main toolbar of TerraLib Edit Qt plugin.
72  */
73  class ToolBar : public QObject
74  {
75  Q_OBJECT
76 
77  public:
78 
79  ToolBar(QObject* parent = 0);
80 
81  ~ToolBar();
82 
83  QToolBar* get() const;
84 
85  void updateLayer(te::map::AbstractLayer* layer, const bool& stashed);
86 
87  public slots:
88 
89  void onEditActivated(bool checked);
90 
91  protected slots:
92 
93  void onSaveActivated();
94 
95  void onVertexToolActivated(bool checked);
96 
97  void onCreatePolygonToolActivated(bool checked);
98 
99  void onCreateLineToolActivated(bool checked);
100 
101  void onMoveGeometryToolActivated(bool checked);
102 
103  void onSnapOptionsActivated();
104 
105  void onAggregateAreaToolActivated(bool checked);
106 
107  void onSubtractAreaToolActivated(bool checked);
108 
109  void onDeleteGeometryToolActivated(bool checked);
110 
111  void onMergeGeometriesToolActivated(bool checked);
112 
113  void onCreateUndoViewActivated(bool checked);
114 
115  void onToolDeleted();
116 
117  void onSplitPolygonToolActivated(bool checked);
118 
119  void onFeatureAttributesActivated(bool checked);
120 
121  Q_SIGNALS:
122 
123  /*! This signal is emitted when the layer selection changed. */
124  void layerSelectedObjectsChanged(const te::map::AbstractLayerPtr& layer);
125 
126  void triggered(te::qt::af::evt::Event* e);
127 
128  void stashed(te::map::AbstractLayer* layer);
129 
130  void geometriesEdited();
131 
132  protected:
133 
134  void enableCurrentTool(const bool& enable);
135 
136  void setCurrentTool(te::edit::GeometriesUpdateTool* tool, te::qt::af::MapDisplay* display);
137 
138  QToolBar* m_toolBar;
139  QAction* m_editAction;
140  QAction* m_saveAction;
152  QList<QAction*> m_tools;
153  QUndoView* m_undoView;
154 
156 
158 
160 
161  void enableActionsByGeomType(QList<QAction*> acts, const bool& enable);
162 
163  public:
164  te::map::AbstractLayerPtr getSelectedLayer();
165 
166  protected:
167  te::map::AbstractLayerPtr getLayer(const std::string& id);
168  void initialize();
169  void initializeActions();
170  void createAction(QAction*& action, const QString& tooltip, const QString& icon, bool checkable, bool enabled, const QString& objName, const char* member);
171  bool datasourceIsValid(const te::map::AbstractLayerPtr& layer);
172  };
173 
174  } // end namespace edit
175  } // end namespace plugins
176  } // end namespace qt
177 } // end namespace te
178 
179 #endif //__TERRALIB_QT_PLUGINS_EDIT_INTERNAL_TOOLBAR_H
The main toolbar of TerraLib Edit Qt plugin.
Definition: ToolBar.h:73
QAction * m_subtractAreaToolAction
Definition: ToolBar.h:148
QAction * m_aggregateAreaToolAction
Definition: ToolBar.h:147
This is the base class for layers.
Definition: AbstractLayer.h:76
A base class for application events.
Definition: Event.h:59
A connector of the te::qt::widgets::MapDisplay class to the Application Framework.
Definition: MapDisplay.h:81
te::edit::GeometriesUpdateTool * m_currentTool
Definition: ToolBar.h:155
URI C++ Library.
Configuration flags for the TerraLib Edit plugin.
QAction * m_featureAttributesAction
Definition: ToolBar.h:149
QAction * m_createPolygonToolAction
Definition: ToolBar.h:142
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
QAction * m_deleteGeometryToolAction
Definition: ToolBar.h:146
QAction * m_moveGeometryToolAction
Definition: ToolBar.h:144
QList< QAction * > m_tools
Definition: ToolBar.h:152