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  void onResetVisualizationToolActivated(bool checked);
122 
123  void onCreatePointToolActivated(bool checked);
124 
125  void onDeletePartToolActivated(bool checked);
126 
127  void onCreateLayerActivated();
128 
129  Q_SIGNALS:
130 
131  /*! This signal is emitted when the layer selection changed. */
133 
135 
136  void stashed(te::map::AbstractLayer* layer);
137 
138  void geometriesEdited();
139 
140  protected:
141 
142  void enableCurrentTool(const bool& enable);
143 
145 
146  QToolBar* m_toolBar;
147  QAction* m_editAction;
148  QAction* m_saveAction;
165  QList<QAction*> m_tools;
166  QUndoView* m_undoView;
167 
169 
171 
173 
175 
176  void enableActionsByGeomType(QList<QAction*> acts, const bool& enable);
177 
178  public:
179 
181 
182  bool isEnabled();
183 
184  protected:
185 
186  te::map::AbstractLayerPtr getLayer(const std::string& id);
187  void initialize();
188  void initializeActions();
189  void createAction(QAction*& action, const QString& tooltip, const QString& icon, bool checkable, bool enabled, const QString& objName, const char* member);
190  bool dataSrcIsPrepared(const te::map::AbstractLayerPtr& layer);
191  };
192 
193  } // end namespace edit
194  } // end namespace plugins
195  } // end namespace qt
196 } // end namespace te
197 
198 #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:157
bool dataSrcIsPrepared(const te::map::AbstractLayerPtr &layer)
QAction * m_aggregateAreaToolAction
Definition: ToolBar.h:156
QAction * m_mergeGeometriesToolAction
Definition: ToolBar.h:160
This is the base class for layers.
Definition: AbstractLayer.h:76
A base class for application events.
Definition: Event.h:59
void onMoveGeometryToolActivated(bool checked)
A connector of the te::qt::widgets::MapDisplay class to the Application Framework.
Definition: MapDisplay.h:80
void onCreatePointToolActivated(bool checked)
void onResetVisualizationToolActivated(bool checked)
te::map::AbstractLayerPtr getSelectedLayer()
void setCurrentTool(te::edit::GeometriesUpdateTool *tool, te::qt::af::MapDisplay *display)
void onCreateLineToolActivated(bool checked)
void triggered(te::qt::af::evt::Event *e)
void onCreateUndoViewActivated(bool checked)
te::edit::GeometriesUpdateTool * m_currentTool
Definition: ToolBar.h:168
URI C++ Library.
void onEditActivated(bool checked)
Configuration flags for the TerraLib Edit plugin.
void onDeletePartToolActivated(bool checked)
void onSubtractAreaToolActivated(bool checked)
QAction * m_featureAttributesAction
Definition: ToolBar.h:158
QAction * m_createPolygonToolAction
Definition: ToolBar.h:151
void enableActionsByGeomType(QList< QAction * > acts, const bool &enable)
void updateLayer(te::map::AbstractLayer *layer, const bool &stashed)
QAction * m_splitPolygonToolAction
Definition: ToolBar.h:159
void layerSelectedObjectsChanged(const te::map::AbstractLayerPtr &layer)
void onFeatureAttributesActivated(bool checked)
void onAggregateAreaToolActivated(bool checked)
te::map::AbstractLayerPtr getLayer(const std::string &id)
void stashed(te::map::AbstractLayer *layer)
void onDeleteGeometryToolActivated(bool checked)
ToolBar(QObject *parent=0)
void onCreatePolygonToolActivated(bool checked)
void createAction(QAction *&action, const QString &tooltip, const QString &icon, bool checkable, bool enabled, const QString &objName, const char *member)
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
void enableCurrentTool(const bool &enable)
void onVertexToolActivated(bool checked)
QAction * m_deleteGeometryToolAction
Definition: ToolBar.h:155
QAction * m_moveGeometryToolAction
Definition: ToolBar.h:153
void onSplitPolygonToolActivated(bool checked)
void onMergeGeometriesToolActivated(bool checked)
QList< QAction * > m_tools
Definition: ToolBar.h:165