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 #include "../../maptools/AbstractLayer.h"
33 
34 #include <QComboBox>
35 #include <QLabel>
36 #include <QLineEdit>
37 #include <QMainWindow>
38 #include <QStatusBar>
39 
40 
41 //#include <ui_BaseApplicationForm.h>
42 
43 namespace Ui {
44  class BaseApplicationForm;
45 }
46 
47 namespace te
48 {
49  namespace qt
50  {
51  namespace widgets
52  {
53  class ChartDisplayWidget;
54  class LayerItemView;
55  class MapDisplay;
56  }
57 
58  namespace af
59  {
60  namespace evt
61  {
62  // Forward declaration
63  struct Event;
64  }
65 
66  class ApplicationController;
67  class DataSetTableDockWidget;
68  class MapDisplay;
69  class LayerExplorer;
70  class StyleExplorer;
71 
72  class TEQTAFEXPORT BaseApplication : public QMainWindow
73  {
74  Q_OBJECT
75 
76  public:
77 
78  BaseApplication(QWidget* parent = 0);
79 
80  virtual ~BaseApplication();
81 
82  virtual void init(const QString& cfgFile);
83 
84  te::qt::widgets::LayerItemView* getLayerExplorer();
85 
86  te::qt::widgets::MapDisplay* getMapDisplay();
87 
88  te::qt::af::DataSetTableDockWidget* getLayerDock(const te::map::AbstractLayer* layer, const std::vector<te::qt::af::DataSetTableDockWidget*>& docs);
89 
90  QDockWidget* getLayerExplorerDock();
91 
92  public slots:
93 
94  virtual void onApplicationTriggered(te::qt::af::evt::Event* e);
95 
96  void onDrawTriggered();
97 
98  void onZoomInToggled(bool checked);
99 
100  void onZoomOutToggled(bool checked);
101 
102  void onPreviousExtentTriggered();
103 
104  void onNextExtentTriggered();
105 
106  void onPanToggled(bool checked);
107 
108  void onZoomExtentTriggered();
109 
110  void onInfoToggled(bool checked);
111 
112  void onMapRemoveSelectionTriggered();
113 
114  void onSelectionToggled(bool checked);
115 
116  void onMapSRIDTriggered();
117 
118  void onMapSetUnknwonSRIDTriggered();
119 
120  void onStopDrawTriggered();
121 
122  void onScaleComboBoxActivated();
123 
124  void onScaleDisplayChanged();
125 
126  void onLayerRemoveTriggered();
127 
128  void onLayerRenameTriggered();
129 
130  void onLayerPropertiesTriggered();
131 
132  void onLayerRemoveSelectionTriggered();
133 
134  void onLayerSRSTriggered();
135 
136  void onLayerRemoveItemTriggered();
137 
138  void onLayerFitOnMapDisplayTriggered();
139 
140  void onLayerFitSelectedOnMapDisplayTriggered();
141 
142  void onLayerPanToSelectedOnMapDisplayTriggered();
143 
144  void onLayerSaveSelectedObjectsTriggered();
145 
146  void onFullScreenToggled(bool checked);
147 
148  void onLayerExplorerVisibilityChanged(bool visible);
149 
150  void onStyleExplorerVisibilityChanged(bool visible);
151 
152  void onDisplayDataTableChanged(bool visible);
153 
154  void onLayerShowTableTriggered();
155 
156  void onLayerTableClose(te::qt::af::DataSetTableDockWidget* wid);
157 
158  void onChartDisplayCreated(te::qt::widgets::ChartDisplayWidget* chartDisplay, te::map::AbstractLayer* layer);
159 
160  protected slots:
161 
162  void onLayerSelectionChanged(const te::map::AbstractLayerPtr& layer);
163 
164  void onLayerSelectedObjectsChanged(const te::map::AbstractLayerPtr& layer);
165 
166  signals:
167 
168  void triggered(te::qt::af::evt::Event* e);
169 
170  protected:
171 
172  virtual void makeDialog();
173 
174  virtual void initFramework(const QString& cfgFile);
175 
176  virtual void initStatusBar();
177 
178  virtual void initActions();
179 
180  virtual void initMenus();
181 
182  virtual void initSlotsConnections();
183 
184  virtual void initAction(QAction*& act, const QString& icon, const QString& name,
185  const QString& text, const QString& tooltip,
186  bool iconVisibleInMenu, bool isCheckable, bool enabled, QObject* parent);
187 
188  QMenuBar* m_menubar;
189 
191 
192  //default actions
193  QAction* m_mapDraw;
194  QAction* m_mapZoomIn;
195  QAction* m_mapZoomOut;
196  QAction* m_mapZoomArea;
197  QAction* m_mapPan;
198  QAction* m_mapZoomExtent;
200  QAction* m_mapNextExtent;
201  QAction* m_mapInfo;
203  QAction* m_mapSelection;
204 
206  QAction* m_layerRemove;
207  QAction* m_layerRename;
211  QAction* m_layerSRS;
216 
217  QAction* m_viewDataTable;
221 
222  //main widgets
227  std::vector<te::qt::af::DataSetTableDockWidget*> m_tables;
228 
229  //status bar widgets
230  QStatusBar* m_statusbar;
231  QLabel* m_selected;
232  QAction* m_mapSRID;
235  QLineEdit* m_mapSRIDLineEdit;
237  QComboBox* m_scaleCmbBox;
238 
239  private:
240  Ui::BaseApplicationForm* m_ui;
241  };
242  }
243  }
244 }
245 
246 #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
A connector for the te::qt::widgets::StyleDockWidget class to the Application Framework.
Definition: StyleExplorer.h:61
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:79
A widget to control the display of a set of layers.
Definition: MapDisplay.h:66
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:71
Ui::BaseApplicationForm * m_ui
#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