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 MapDisplay;
71  class LayerExplorer;
72  class StyleExplorer;
73 
74  class TEQTAFEXPORT BaseApplication : public QMainWindow
75  {
76  Q_OBJECT
77 
78  public:
79 
80  BaseApplication(QWidget* parent = 0);
81 
82  virtual ~BaseApplication();
83 
84  virtual void init(const QString& cfgFile);
85 
86  te::qt::widgets::LayerItemView* getLayerExplorer();
87 
88  te::qt::widgets::MapDisplay* getMapDisplay();
89 
90  te::qt::af::DataSetTableDockWidget* getLayerDock(const te::map::AbstractLayer* layer, const std::vector<te::qt::af::DataSetTableDockWidget*>& docs);
91 
92  QDockWidget* getLayerExplorerDock();
93 
94  public slots:
95 
96  virtual void onApplicationTriggered(te::qt::af::evt::Event* e);
97 
98  virtual void onLayerShowTableTriggered();
99 
100  void onDrawTriggered();
101 
102  void onZoomInToggled(bool checked);
103 
104  void onZoomOutToggled(bool checked);
105 
106  void onPreviousExtentTriggered();
107 
108  void onNextExtentTriggered();
109 
110  void onPanToggled(bool checked);
111 
112  void onZoomExtentTriggered();
113 
114  void onInfoToggled(bool checked);
115 
116  void onMapRemoveSelectionTriggered();
117 
118  void onSelectionToggled(bool checked);
119 
120  void onMapSRIDTriggered();
121 
122  void onMapSetUnknwonSRIDTriggered();
123 
124  void onMeasureDistanceToggled(bool checked);
125 
126  void onMeasureAreaToggled(bool checked);
127 
128  void onMeasureAngleToggled(bool checked);
129 
130  void onStopDrawTriggered();
131 
132  void onScaleComboBoxActivated();
133 
134  void onScaleDisplayChanged();
135 
136  void onInternalSettingsTriggered();
137 
138  void onLayerRemoveTriggered();
139 
140  void onLayerRenameTriggered();
141 
142  void onLayerPropertiesTriggered();
143 
144  void onLayerInvertSelectionTriggered();
145 
146  void onLayerRemoveSelectionTriggered();
147 
148  void onLayerSRSTriggered();
149 
150  void onLayerRemoveItemTriggered();
151 
152  void onLayerFitOnMapDisplayTriggered();
153 
154  void onLayerFitSelectedOnMapDisplayTriggered();
155 
156  void onLayerPanToSelectedOnMapDisplayTriggered();
157 
158  void onLayerSaveSelectedObjectsTriggered();
159 
160  void onLayerCharEncodingHovered();
161 
162  void onFullScreenToggled(bool checked);
163 
164  void onLayerExplorerVisibilityChanged(bool visible);
165 
166  void onStyleExplorerVisibilityChanged(bool visible);
167 
168  void onDisplayDataTableChanged(bool visible);
169 
170  void onLayerTableClose(te::qt::af::DataSetTableDockWidget* wid);
171 
172  void onChartDisplayCreated(te::qt::widgets::ChartDisplayWidget* chartDisplay, te::map::AbstractLayer* layer);
173 
174  protected slots:
175 
176  void onLayerSelectionChanged(const te::map::AbstractLayerPtr& layer);
177 
178  void onLayerSelectedObjectsChanged(const te::map::AbstractLayerPtr& layer);
179 
180  signals:
181 
182  void triggered(te::qt::af::evt::Event* e);
183 
184  protected:
185 
186  virtual void makeDialog();
187 
188  virtual void initFramework(const QString& cfgFile);
189 
190  virtual void initStatusBar();
191 
192  virtual void initActions();
193 
194  virtual void initMenus();
195 
196  virtual void initToolbars();
197 
198  virtual void initSlotsConnections();
199 
200  virtual void createDefaultSettings() = 0;
201 
202  virtual void initAction(QAction*& act, const QString& icon, const QString& name,
203  const QString& text, const QString& tooltip,
204  bool iconVisibleInMenu, bool isCheckable, bool enabled, QObject* parent);
205 
206  void setMapSRIDLineEdit(const int srid);
207 
208  QMenuBar* m_menubar;
209 
211 
212  //default actions
213  QAction* m_mapDraw;
214  QAction* m_mapZoomIn;
215  QAction* m_mapZoomOut;
216  QAction* m_mapZoomArea;
217  QAction* m_mapPan;
218  QAction* m_mapZoomExtent;
220  QAction* m_mapNextExtent;
221  QAction* m_mapInfo;
223  QAction* m_mapSelection;
228  QAction* m_layerRemove;
229  QAction* m_layerRename;
234  QAction* m_layerSRS;
240 
241  QAction* m_viewDataTable;
245 
246  //main widgets
251  std::vector<te::qt::af::DataSetTableDockWidget*> m_tables;
253 
254  //status bar widgets
255  QStatusBar* m_statusbar;
256  QLabel* m_selected;
257  QAction* m_mapSRID;
261  QLineEdit* m_mapSRIDLineEdit;
263  QComboBox* m_scaleCmbBox;
264 
265  private:
266  Ui::BaseApplicationForm* m_ui;
267  };
268  }
269  }
270 }
271 
272 #endif // __TERRALIB_QT_AF_INTERNAL_BASEAPPLICATION_H
ApplicationController * m_app
This is the base class for layers.
Definition: AbstractLayer.h:76
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:80
A widget to control the display of a set of layers.
Definition: MapDisplay.h:69
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