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  static void prepareQtEnvironment(const QString& cfgFile, const QString& splashImg);
96 
97  public slots:
98 
99  virtual void onApplicationTriggered(te::qt::af::evt::Event* e);
100 
101  virtual void onLayerShowTableTriggered();
102 
103  void onDrawTriggered();
104 
105  void onZoomInToggled(bool checked);
106 
107  void onZoomOutToggled(bool checked);
108 
109  void onPreviousExtentTriggered();
110 
111  void onNextExtentTriggered();
112 
113  void onPanToggled(bool checked);
114 
115  void onZoomExtentTriggered();
116 
117  void onInfoToggled(bool checked);
118 
119  void onMapRemoveSelectionTriggered();
120 
121  void onSelectionToggled(bool checked);
122 
123  void onMapSRIDTriggered();
124 
125  void onMapSetUnknwonSRIDTriggered();
126 
127  void onMapShowGeographicGridToggled(bool check);
128 
129  void onMeasureDistanceToggled(bool checked);
130 
131  void onMeasureAreaToggled(bool checked);
132 
133  void onMeasureAngleToggled(bool checked);
134 
135  void onStopDrawTriggered();
136 
137  void onScaleComboBoxActivated();
138 
139  void onScaleDisplayChanged();
140 
141  virtual void onInternalSettingsTriggered();
142 
143  void onInternalSettingsDestroyed();
144 
145  void onLayerRemoveTriggered();
146 
147  void onLayerRenameTriggered();
148 
149  void onCheckSelectedLayerTriggered();
150 
151  void onClearSelectedLayerTriggered();
152 
153  void onLayerPropertiesTriggered();
154 
155  void onLayerInvertSelectionTriggered();
156 
157  void onLayerRemoveSelectionTriggered();
158 
159  void onLayerSRSTriggered();
160 
161  void onLayerRemoveItemTriggered();
162 
163  void onLayerFitOnMapDisplayTriggered();
164 
165  void onLayerFitSelectedOnMapDisplayTriggered();
166 
167  void onLayerPanToSelectedOnMapDisplayTriggered();
168 
169  void onLayerSaveSelectedObjectsTriggered();
170 
171  void onLayerCharEncodingHovered();
172 
173  void onFullScreenToggled(bool checked);
174 
175  void onLayerExplorerVisibilityChanged(bool visible);
176 
177  void onStyleExplorerVisibilityChanged(bool visible);
178 
179  void onDisplayDataTableChanged(bool visible);
180 
181  void onLayerTableClose(te::qt::af::DataSetTableDockWidget* wid);
182 
183  void onChartDisplayCreated(te::qt::widgets::ChartDisplayWidget* chartDisplay, te::map::AbstractLayer* layer);
184 
185  void onShowGraphicScaleTriggered(bool checked);
186 
187  void onEditGraphicScaleTriggered();
188 
189  void onEditGridTriggered();
190 
191  protected slots:
192 
193  void onLayerSelectionChanged(const te::map::AbstractLayerPtr& layer);
194 
195  void onLayerSelectedObjectsChanged(const te::map::AbstractLayerPtr& layer);
196 
197  signals:
198 
199  void triggered(te::qt::af::evt::Event* e);
200 
201  protected:
202 
203  virtual void makeDialog();
204 
205  virtual void initFramework(const QString& cfgFile);
206 
207  virtual void initStatusBar();
208 
209  virtual void initActions();
210 
211  virtual void initMenus();
212 
213  virtual void initToolbars();
214 
215  virtual void initSlotsConnections();
216 
217  virtual void createDefaultSettings() = 0;
218 
219  virtual void initAction(QAction*& act, const QString& icon, const QString& name,
220  const QString& text, const QString& tooltip,
221  bool iconVisibleInMenu, bool isCheckable, bool enabled, QObject* parent);
222 
223  void setMapSRIDLineEdit(const int srid);
224 
225  QMenuBar* m_menubar;
226 
228 
229  //default actions
230  QAction* m_mapDraw;
231  QAction* m_mapZoomIn;
232  QAction* m_mapZoomOut;
233  QAction* m_mapZoomArea;
234  QAction* m_mapPan;
235  QAction* m_mapZoomExtent;
237  QAction* m_mapNextExtent;
238  QAction* m_mapInfo;
240  QAction* m_mapSelection;
243  QAction* m_mapEditGrid;
249  QAction* m_layerRemove;
250  QAction* m_layerRename;
255  QAction* m_layerSRS;
263 
264  QAction* m_viewDataTable;
268 
269  //main widgets
275  std::vector<te::qt::af::DataSetTableDockWidget*> m_tables;
277 
278 
279  //status bar widgets
280  QStatusBar* m_statusbar;
281  QLabel* m_selected;
282  QAction* m_mapSRID;
286  QLineEdit* m_mapSRIDLineEdit;
288  QComboBox* m_scaleCmbBox;
289 
290  private:
291  Ui::BaseApplicationForm* m_ui;
292  };
293  }
294  }
295 }
296 
297 #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