BaseApplication.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/af/BaseApplication.h
22 
23  \brief A QMainWindow to be used as the basis for TerraLib applications.
24 */
25 
26 #ifndef __TERRALIB_QT_AF_INTERNAL_BASEAPPLICATION_H
27 #define __TERRALIB_QT_AF_INTERNAL_BASEAPPLICATION_H
28 
29 #include "Config.h"
30 
31 // TerraLib
32 #ifndef Q_MOC_RUN
33 #include "../../maptools/AbstractLayer.h"
34 #endif
35 #include <QComboBox>
36 #include <QLabel>
37 #include <QLineEdit>
38 #include <QMainWindow>
39 #include <QStatusBar>
40 
41 
42 //#include <ui_BaseApplicationForm.h>
43 
44 namespace Ui {
45  class BaseApplicationForm;
46 }
47 
48 namespace te
49 {
50  namespace qt
51  {
52  namespace widgets
53  {
54  class ChartDisplayWidget;
55  class CharEncodingMenuWidget;
56  class LayerItemView;
57  class MapDisplay;
58  }
59 
60  namespace af
61  {
62  namespace evt
63  {
64  // Forward declaration
65  struct Event;
66  }
67 
68  class ApplicationController;
69  class DataSetTableDockWidget;
70  class InternalSettingsDialog;
71  class MapDisplay;
72  class LayerExplorer;
73  class StyleExplorer;
74 
75  class TEQTAFEXPORT BaseApplication : public QMainWindow
76  {
77  Q_OBJECT
78 
79  public:
80 
81  BaseApplication(QWidget* parent = 0);
82 
83  virtual ~BaseApplication();
84 
85  virtual void init(const QString& cfgFile);
86 
87  te::qt::widgets::LayerItemView* getLayerExplorer();
88 
89  te::qt::widgets::MapDisplay* getMapDisplay();
90 
91  te::qt::af::DataSetTableDockWidget* getLayerDock(const te::map::AbstractLayer* layer, const std::vector<te::qt::af::DataSetTableDockWidget*>& docs);
92 
93  QDockWidget* getLayerExplorerDock();
94 
95  public slots:
96 
97  virtual void onApplicationTriggered(te::qt::af::evt::Event* e);
98 
99  virtual void onLayerShowTableTriggered();
100 
101  void onDrawTriggered();
102 
103  void onZoomInToggled(bool checked);
104 
105  void onZoomOutToggled(bool checked);
106 
107  void onPreviousExtentTriggered();
108 
109  void onNextExtentTriggered();
110 
111  void onPanToggled(bool checked);
112 
113  void onZoomExtentTriggered();
114 
115  void onInfoToggled(bool checked);
116 
117  void onMapRemoveSelectionTriggered();
118 
119  void onSelectionToggled(bool checked);
120 
121  void onMapSRIDTriggered();
122 
123  void onMapSetUnknwonSRIDTriggered();
124 
125  void onMapShowGeographicGridToggled(bool check);
126 
127  void onMeasureDistanceToggled(bool checked);
128 
129  void onMeasureAreaToggled(bool checked);
130 
131  void onMeasureAngleToggled(bool checked);
132 
133  void onStopDrawTriggered();
134 
135  void onScaleComboBoxActivated();
136 
137  void onScaleDisplayChanged();
138 
139  virtual void onInternalSettingsTriggered();
140 
141  void onInternalSettingsDestroyed();
142 
143  void onLayerRemoveTriggered();
144 
145  void onLayerRenameTriggered();
146 
147  void onCheckSelectedLayerTriggered();
148 
149  void onClearSelectedLayerTriggered();
150 
151  void onLayerPropertiesTriggered();
152 
153  void onLayerInvertSelectionTriggered();
154 
155  void onLayerRemoveSelectionTriggered();
156 
157  void onLayerSRSTriggered();
158 
159  void onLayerRemoveItemTriggered();
160 
161  void onLayerFitOnMapDisplayTriggered();
162 
163  void onLayerFitSelectedOnMapDisplayTriggered();
164 
165  void onLayerPanToSelectedOnMapDisplayTriggered();
166 
167  void onLayerSaveSelectedObjectsTriggered();
168 
169  void onLayerCharEncodingHovered();
170 
171  void onFullScreenToggled(bool checked);
172 
173  void onLayerExplorerVisibilityChanged(bool visible);
174 
175  void onStyleExplorerVisibilityChanged(bool visible);
176 
177  void onDisplayDataTableChanged(bool visible);
178 
179  void onLayerTableClose(te::qt::af::DataSetTableDockWidget* wid);
180 
181  void onChartDisplayCreated(te::qt::widgets::ChartDisplayWidget* chartDisplay, te::map::AbstractLayer* layer);
182 
183  void onShowGraphicScaleTriggered(bool checked);
184 
185  void onEditGraphicScaleTriggered();
186 
187  void onEditGridTriggered();
188 
189  protected slots:
190 
191  void onLayerSelectionChanged(const te::map::AbstractLayerPtr& layer);
192 
193  void onLayerSelectedObjectsChanged(const te::map::AbstractLayerPtr& layer);
194 
195  signals:
196 
197  void triggered(te::qt::af::evt::Event* e);
198 
199  protected:
200 
201  virtual void makeDialog();
202 
203  virtual void initFramework(const QString& cfgFile);
204 
205  virtual void initStatusBar();
206 
207  virtual void initActions();
208 
209  virtual void initMenus();
210 
211  virtual void initToolbars();
212 
213  virtual void initSlotsConnections();
214 
215  virtual void createDefaultSettings() = 0;
216 
217  virtual void initAction(QAction*& act, const QString& icon, const QString& name,
218  const QString& text, const QString& tooltip,
219  bool iconVisibleInMenu, bool isCheckable, bool enabled, QObject* parent);
220 
221  void setMapSRIDLineEdit(const int srid);
222 
223  QMenuBar* m_menubar;
224 
226 
227  //default actions
228  QAction* m_mapDraw;
229  QAction* m_mapZoomIn;
230  QAction* m_mapZoomOut;
231  QAction* m_mapZoomArea;
232  QAction* m_mapPan;
233  QAction* m_mapZoomExtent;
235  QAction* m_mapNextExtent;
236  QAction* m_mapInfo;
238  QAction* m_mapSelection;
241  QAction* m_mapEditGrid;
247  QAction* m_layerRemove;
248  QAction* m_layerRename;
253  QAction* m_layerSRS;
261 
262  QAction* m_viewDataTable;
266 
267  //main widgets
273  std::vector<te::qt::af::DataSetTableDockWidget*> m_tables;
275 
276 
277  //status bar widgets
278  QStatusBar* m_statusbar;
279  QLabel* m_selected;
280  QAction* m_mapSRID;
284  QLineEdit* m_mapSRIDLineEdit;
286  QComboBox* m_scaleCmbBox;
287 
288  private:
289  Ui::BaseApplicationForm* m_ui;
290  };
291  }
292  }
293 }
294 
295 #endif // __TERRALIB_QT_AF_INTERNAL_BASEAPPLICATION_H
ApplicationController * m_app
#define slots
This is the base class for layers.
Definition: AbstractLayer.h:77
A base class for application events.
Definition: Event.h:59
This class is widget that provides a menu for char encoding selection.
A connector for the te::qt::widgets::StyleDockWidget class to the Application Framework.
Definition: StyleExplorer.h:63
A connector for the te::qt::widgets::LayerExplorer class to the Application Framework.
Definition: LayerExplorer.h:70
The base API for TerraLib applications.
A connector of the te::qt::widgets::MapDisplay class to the Application Framework.
Definition: MapDisplay.h:83
A widget to control the display of a set of layers.
Definition: MapDisplay.h:71
Configuration flags for the TerraLib Application Framework.
A dock widget for DataSetTableView objects.
URI C++ Library.
A specialization of QTreeView for manipulate layers.
Definition: LayerItemView.h:73
Ui::BaseApplicationForm * m_ui
te::qt::widgets::CharEncodingMenuWidget * m_encodingMenu
#define TEQTAFEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:71
A wdiget used to display a chart.
std::vector< te::qt::af::DataSetTableDockWidget * > m_tables
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
InternalSettingsDialog * m_internalSettingsDlg