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