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 <QComboBox>
38 #include <QIcon>
39 #include <QList>
40 #include <QToolBar>
41 #include <QUndoView>
42 
43 // STL
44 #include <string>
45 
46 namespace te
47 {
48  namespace edit
49  {
50  class GeometriesUpdateTool;
51  }
52 
53  namespace qt
54  {
55  namespace af
56  {
57  class MapDisplay;
58 
59  namespace evt
60  {
61  struct Event;
62  }
63  }
64 
65  namespace plugins
66  {
67  namespace edit
68  {
69  /*!
70  \class ToolBar
71 
72  \brief The main toolbar of TerraLib Edit Qt plugin.
73  */
74  class ToolBar : public QObject
75  {
76  Q_OBJECT
77 
78  public:
79 
80  ToolBar(QObject* parent = 0);
81 
82  ~ToolBar();
83 
84  QToolBar* get() const;
85 
86  void updateLayer(te::map::AbstractLayer* layer, const bool& stashed);
87 
88  public slots:
89 
90  void onEditActivated(bool checked);
91 
92  protected slots:
93 
94  void onSaveActivated();
95 
96  void onVertexToolActivated(bool checked);
97 
98  void onCreatePolygonToolActivated(bool checked);
99 
100  void onCreateLineToolActivated(bool checked);
101 
102  void onMoveGeometryToolActivated(bool checked);
103 
104  void onSnapOptionsActivated();
105 
106  void onAggregateAreaToolActivated(bool checked);
107 
108  void onSubtractAreaToolActivated(bool checked);
109 
110  void onDeleteGeometryToolActivated(bool checked);
111 
112  void onMergeGeometriesToolActivated(bool checked);
113 
114  void onCreateUndoViewActivated(bool checked);
115 
116  void onToolDeleted();
117 
118  void onSplitPolygonToolActivated(bool checked);
119 
120  void onFeatureAttributesActivated(bool checked);
121 
122  void onResetVisualizationToolActivated(bool checked);
123 
124  void onCreatePointToolActivated(bool checked);
125 
126  void onDeletePartToolActivated(bool checked);
127 
128  void onCreateLayerActivated();
129 
130  void onDigitStepComboBoxChanged(int index);
131 
132  void onActionChanged(QAction* action);
133 
134  void onRotateGeometryToolActivated(bool checked);
135 
136  Q_SIGNALS:
137 
138  /*! This signal is emitted when the layer selection changed. */
139  void layerSelectedObjectsChanged(const te::map::AbstractLayerPtr& layer);
140 
141  void triggered(te::qt::af::evt::Event* e);
142 
143  void stashed(te::map::AbstractLayer* layer);
144 
145  void geometriesEdited();
146 
147  void updateDelegate(const bool& add);
148 
149  protected:
150 
151  void enableCurrentTool(const bool& enable);
152 
153  void setCurrentTool(te::edit::GeometriesUpdateTool* tool, te::qt::af::MapDisplay* display);
154 
155  QToolBar* m_toolBar;
156  QAction* m_editAction;
157  QAction* m_saveAction;
175  QList<QAction*> m_tools;
177  QUndoView* m_undoView;
178  QAction* m_currentAction;
179 
181 
183 
185 
187 
189 
190  void enableActionsByGeomType(QList<QAction*> acts, const bool& enable);
191 
192  bool isToolChanged(QAction* action);
193 
194  void resetTool(QAction* action);
195 
196  public:
197 
198  te::map::AbstractLayerPtr getSelectedLayer();
199 
200  bool isEnabled();
201 
202  protected:
203 
204  te::map::AbstractLayerPtr getLayer(const std::string& id);
205  void initialize();
206  void initializeActions();
207  void createAction(QAction*& action, const QString& tooltip, const QString& icon, bool checkable, bool enabled, const QString& objName, const char* member);
208  bool dataSrcIsPrepared(const te::map::AbstractLayerPtr& layer);
209  };
210 
211  } // end namespace edit
212  } // end namespace plugins
213  } // end namespace qt
214 } // end namespace te
215 
216 #endif //__TERRALIB_QT_PLUGINS_EDIT_INTERNAL_TOOLBAR_H
QAction * m_rotateGeometryToolAction
Definition: ToolBar.h:163
#define slots
The main toolbar of TerraLib Edit Qt plugin.
Definition: ToolBar.h:74
QAction * m_subtractAreaToolAction
Definition: ToolBar.h:167
QAction * m_aggregateAreaToolAction
Definition: ToolBar.h:166
QAction * m_mergeGeometriesToolAction
Definition: ToolBar.h:170
This is the base class for layers.
Definition: AbstractLayer.h:77
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:83
QComboBox * m_digitStepComboBox
Definition: ToolBar.h:176
te::edit::GeometriesUpdateTool * m_currentTool
Definition: ToolBar.h:180
URI C++ Library.
Configuration flags for the TerraLib Edit plugin.
QAction * m_featureAttributesAction
Definition: ToolBar.h:168
QAction * m_createPolygonToolAction
Definition: ToolBar.h:160
QAction * m_splitPolygonToolAction
Definition: ToolBar.h:169
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
QAction * m_deleteGeometryToolAction
Definition: ToolBar.h:165
QAction * m_moveGeometryToolAction
Definition: ToolBar.h:162
QList< QAction * > m_tools
Definition: ToolBar.h:175