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 widgets
66  {
67  class HelpToolButton;
68  }
69 
70  namespace plugins
71  {
72  namespace edit
73  {
74  /*!
75  \class ToolBar
76 
77  \brief The main toolbar of TerraLib Edit Qt plugin.
78  */
79  class ToolBar : public QObject
80  {
81  Q_OBJECT
82 
83  public:
84 
85  ToolBar(QObject* parent = 0);
86 
88 
89  QToolBar* get() const;
90 
91  void updateLayer(te::map::AbstractLayer* layer, const bool& stashed);
92 
93  public slots:
94 
95  void onEditActivated(bool checked);
96 
97  protected slots:
98 
100 
101  void onVertexToolActivated(bool checked);
102 
103  void onCreatePolygonToolActivated(bool checked);
104 
105  void onCreateLineToolActivated(bool checked);
106 
107  void onMoveGeometryToolActivated(bool checked);
108 
110 
111  void onAggregateAreaToolActivated(bool checked);
112 
113  void onSubtractAreaToolActivated(bool checked);
114 
115  void onDeleteGeometryToolActivated(bool checked);
116 
117  void onMergeGeometriesToolActivated(bool checked);
118 
119  void onCreateUndoViewActivated(bool checked);
120 
122 
123  void onSplitPolygonToolActivated(bool checked);
124 
125  void onFeatureAttributesActivated(bool checked);
126 
128 
129  void onCreatePointToolActivated(bool checked);
130 
131  void onDeletePartToolActivated(bool checked);
132 
134 
135  void onDigitStepComboBoxChanged(int index);
136 
137  void onActionChanged(QAction* action);
138 
139  void onRotateGeometryToolActivated(bool checked);
140 
141  Q_SIGNALS:
142 
143  /*! This signal is emitted when the layer selection changed. */
145 
147 
149 
151 
152  void updateDelegate(const bool& add);
153 
154  protected:
155 
156  void enableCurrentTool(const bool& enable);
157 
159 
160  QToolBar* m_toolBar;
161  QAction* m_editAction;
162  QAction* m_saveAction;
180  QList<QAction*> m_tools;
182  QUndoView* m_undoView;
183  QAction* m_currentAction;
185 
187 
189 
191 
193 
195 
196  void enableActionsByGeomType(QList<QAction*> acts, const bool& enable);
197 
198  bool isToolChanged(QAction* action);
199 
200  void resetTool(QAction* action);
201 
202  public:
203 
205 
206  bool isEnabled();
207 
208  protected:
209 
210  te::map::AbstractLayerPtr getLayer(const std::string& id);
211  void initialize();
213  void createAction(QAction*& action, const QString& tooltip, const QString& icon, bool checkable, bool enabled, const QString& objName, const char* member);
215  };
216 
217  } // end namespace edit
218  } // end namespace plugins
219  } // end namespace qt
220 } // end namespace te
221 
222 #endif //__TERRALIB_QT_PLUGINS_EDIT_INTERNAL_TOOLBAR_H
This is the base class for layers.
Definition: AbstractLayer.h:78
A connector of the te::qt::widgets::MapDisplay class to the Application Framework.
Definition: MapDisplay.h:84
The main toolbar of TerraLib Edit Qt plugin.
Definition: ToolBar.h:80
QAction * m_mergeGeometriesToolAction
Definition: ToolBar.h:175
void updateLayer(te::map::AbstractLayer *layer, const bool &stashed)
void onDeletePartToolActivated(bool checked)
void enableCurrentTool(const bool &enable)
void onFeatureAttributesActivated(bool checked)
te::map::AbstractLayerPtr getLayer(const std::string &id)
QAction * m_featureAttributesAction
Definition: ToolBar.h:173
void enableActionsByGeomType(QList< QAction * > acts, const bool &enable)
void onSubtractAreaToolActivated(bool checked)
te::edit::GeometriesUpdateTool * m_currentTool
Definition: ToolBar.h:186
QAction * m_deleteGeometryToolAction
Definition: ToolBar.h:170
QAction * m_aggregateAreaToolAction
Definition: ToolBar.h:171
QList< QAction * > m_tools
Definition: ToolBar.h:180
void onAggregateAreaToolActivated(bool checked)
QAction * m_splitPolygonToolAction
Definition: ToolBar.h:174
te::qt::widgets::HelpToolButton * m_helpToolButton
Definition: ToolBar.h:184
void onCreateUndoViewActivated(bool checked)
te::map::AbstractLayerPtr getSelectedLayer()
void onCreateLineToolActivated(bool checked)
void onEditActivated(bool checked)
void onSplitPolygonToolActivated(bool checked)
bool dataSrcIsPrepared(const te::map::AbstractLayerPtr &layer)
void onCreatePolygonToolActivated(bool checked)
void onMergeGeometriesToolActivated(bool checked)
QAction * m_moveGeometryToolAction
Definition: ToolBar.h:167
void onMoveGeometryToolActivated(bool checked)
QAction * m_subtractAreaToolAction
Definition: ToolBar.h:172
QComboBox * m_digitStepComboBox
Definition: ToolBar.h:181
void layerSelectedObjectsChanged(const te::map::AbstractLayerPtr &layer)
void updateDelegate(const bool &add)
void onDeleteGeometryToolActivated(bool checked)
void onRotateGeometryToolActivated(bool checked)
void onActionChanged(QAction *action)
void onDigitStepComboBoxChanged(int index)
ToolBar(QObject *parent=0)
void setCurrentTool(te::edit::GeometriesUpdateTool *tool, te::qt::af::MapDisplay *display)
void createAction(QAction *&action, const QString &tooltip, const QString &icon, bool checkable, bool enabled, const QString &objName, const char *member)
void triggered(te::qt::af::evt::Event *e)
QAction * m_rotateGeometryToolAction
Definition: ToolBar.h:168
QAction * m_createPolygonToolAction
Definition: ToolBar.h:165
void stashed(te::map::AbstractLayer *layer)
void onVertexToolActivated(bool checked)
void resetTool(QAction *action)
bool isToolChanged(QAction *action)
void onResetVisualizationToolActivated(bool checked)
void onCreatePointToolActivated(bool checked)
Tool button that uses te::qt::widgets::HelpManager on its mouse pressed implementation.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
TerraLib.
#define slots
A base class for application events.
Definition: Event.h:60
Proxy configuration file for TerraView (see terraview_config.h).