All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
BaseApplication.h
Go to the documentation of this file.
1 /* Copyright (C) 2008-2013 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 // TerraLib
30 #include "../../maptools/AbstractLayer.h"
31 #include "Config.h"
32 
33 // STL
34 #include <map>
35 
36 // Boost
37 #include <boost/noncopyable.hpp>
38 
39 // Qt
40 #include <QColor>
41 #include <QLineEdit>
42 #include <QMainWindow>
43 #include <QMessageBox>
44 
45 class QLabel;
46 
47 namespace te
48 {
49 // Forward declaration
50  namespace da
51  {
52  class DataSet;
53  }
54 
55  namespace qt
56  {
57  namespace widgets
58  {
59  class QueryDialog;
60  class ChartDisplayWidget;
61  }
62 
63  namespace af
64  {
65 // Forward declarations
66  class InterfaceController;
67  class LayerExplorer;
68  class MapDisplay;
69  class Project;
70  class DataSetTableDockWidget;
71  class StyleExplorer;
72 
73  namespace evt
74  {
75  struct Event;
76  }
77 
78  /*!
79  \class BaseApplication
80 
81  \brief A QMainWindow to be used as the basis for TerraLib applications.
82 
83  \ingroup af
84  */
85  class TEQTAFEXPORT BaseApplication : public QMainWindow, public boost::noncopyable
86  {
87  Q_OBJECT
88 
89  public:
90 
91  BaseApplication(QWidget* parent = 0);
92 
93  virtual ~BaseApplication();
94 
95  virtual void init();
96 
97  virtual void init(const std::string& configFile);
98 
99  MapDisplay* getDisplay();
100 
101  virtual void resetState();
102 
103  void resetTerraLib(const bool& status);
104 
105  protected slots:
106 
107  void onApplicationTriggered(te::qt::af::evt::Event* evt);
108 
109  void onAddDataSetLayerTriggered();
110 
111  void onAddQueryLayerTriggered();
112 
113  void onAddTabularLayerTriggered();
114 
115  void onChartDisplayCreated(te::qt::widgets::ChartDisplayWidget* chartDisplay, te::map::AbstractLayer* layer);
116 
117  void onRemoveLayerTriggered();
118 
119  void onChangeLayerDataSourceTriggered();
120 
121  void onLayerRemoveItemTriggered();
122 
123  void onRenameLayerTriggered();
124 
125  void onPluginsManagerTriggered();
126 
127  void onRecentProjectsTriggered(QAction* proj);
128 
129  void onNewProjectTriggered();
130 
131  void onOpenProjectTriggered();
132 
133  void onSaveProjectTriggered();
134 
135  void onSaveProjectAsTriggered();
136 
137  void onRestartSystemTriggered();
138 
139  void onToolsCustomizeTriggered();
140 
141  void onToolsDataExchangerTriggered();
142 
143  void onToolsDataExchangerDirectTriggered();
144 
145  void onToolsDataExchangerDirectPopUpTriggered();
146 
147  void onToolsQueryDataSourceTriggered();
148 
149  void onProjectPropertiesTriggered();
150 
151  void onAddFolderLayerTriggered();
152 
153  void onLayerPropertiesTriggered();
154 
155  void onLayerRemoveSelectionTriggered();
156 
157  void onLayerSRSTriggered();
158 
159  void onLayerShowTableTriggered();
160 
161  void onLayerHistogramTriggered();
162 
163  void onLayerScatterTriggered();
164 
165  void onLayerChartTriggered();
166 
167  void onLayerGroupingTriggered();
168 
169  void onLayerFitOnMapDisplayTriggered();
170 
171  void onLayerFitSelectedOnMapDisplayTriggered();
172 
173  void onLayerPanToSelectedOnMapDisplayTriggered();
174 
175  void onQueryLayerTriggered();
176 
177  void onMapSRIDTriggered();
178 
179  void onMapSetUnknwonSRIDTriggered();
180 
181  void onDrawTriggered();
182 
183  void onZoomInToggled(bool checked);
184 
185  void onZoomOutToggled(bool checked);
186 
187  void onPreviousExtentTriggered();
188 
189  void onNextExtentTriggered();
190 
191  void onPanToggled(bool checked);
192 
193  void onZoomExtentTriggered();
194 
195  void onInfoToggled(bool checked);
196 
197  void onMapRemoveSelectionTriggered();
198 
199  void onSelectionToggled(bool checked);
200 
201  void onMeasureDistanceToggled(bool checked);
202 
203  void onMeasureAreaToggled(bool checked);
204 
205  void onMeasureAngleToggled(bool checked);
206 
207  void onStopDrawTriggered();
208 
209  void showProgressDockWidget();
210 
211  void onLayerTableClose(te::qt::af::DataSetTableDockWidget* wid);
212 
213  void onFullScreenToggled(bool checked);
214 
215  void onLayerSelectedObjectsChanged(const te::map::AbstractLayerPtr& layer);
216 
217  void onHighlightLayerObjects(const te::map::AbstractLayerPtr& layer, te::da::DataSet* dataset, const QColor& color);
218 
219  void onLayerExplorerVisibilityChanged(bool visible);
220 
221  void onDisplayVisibilityChanged(bool visible);
222 
223  void onDisplayDataTableChanged(bool visible);
224 
225  void onStyleExplorerVisibilityChanged(bool visible);
226 
227  void onDataSourceExplorerTriggered();
228 
229  //void onTrajectoryAnimationTriggered(); // Lauro
230 
231  protected:
232 
233  virtual void openProject(const QString& projectFileName);
234 
235  virtual QMessageBox::StandardButton checkProjectSave();
236 
237  virtual void newProject();
238 
239  virtual void makeDialog();
240 
241  virtual void closeEvent(QCloseEvent* e);
242 
243  virtual void initAction(QAction*& act, const QString& icon, const QString& name,
244  const QString& text, const QString& tooltip,
245  bool iconVisibleInMenu, bool isCheckable, bool enabled, QObject* parent);
246 
247  virtual void initActions();
248 
249  virtual void initMenus();
250 
251  virtual void initToolbars();
252 
253  virtual void initStatusBar();
254 
255  virtual void initSlotsConnections();
256 
257  signals:
258  void applicationClose();
259 
260  protected:
261 
262  //! Qt components
265  QAction* m_viewDataTable;
267  //QAction* m_editUndo;
268  //QAction* m_editRedo;
269  //QAction* m_editCut;
270  //QAction* m_editCopy;
271  //QAction* m_editPaste;
272  //QAction* m_editSelectAll;
273  //QAction* m_editClear;
274  //QAction* m_editFind;
275  //QAction* m_editReplace;
277  QAction* m_viewRefresh;
285  QAction* m_helpContents;
286  QAction* m_helpUpdate;
287  QAction* m_viewGrid;
297  QAction* m_layerEdit;
299  QAction* m_layerExport;
301  QAction* m_layerSRS;
303  QAction* m_layerRaise;
304  QAction* m_layerLower;
305  QAction* m_layerToTop;
306  QAction* m_layerToBottom;
309  QAction* m_layerChart;
315  QAction* m_queryLayer;
317  QAction* m_helpAbout;
322  QAction* m_fileExit;
323  QAction* m_filePrint;
326  QAction* m_mapSRID;
328  QAction* m_mapDraw;
329  QAction* m_mapZoomIn;
330  QAction* m_mapZoomOut;
331  QAction* m_mapZoomArea;
332  QAction* m_mapPan;
333  QAction* m_mapZoomExtent;
335  QAction* m_mapNextExtent;
336  QAction* m_mapInfo;
338  QAction* m_mapSelection;
344 
345  QWidget* m_centralwidget;
346 
347  QLineEdit* m_mapSRIDLineEdit;
349 
350  QMenuBar* m_menubar;
351  //QMenu* m_editMenu;
352  QMenu* m_viewMenu;
354  QMenu* m_toolsMenu;
357  QMenu* m_helpMenu;
360  QMenu* m_layerMenu;
361  QMenu* m_fileMenu;
363  QMenu* m_mapMenu;
364 
365  QLabel* m_selected;
366 
367  QStatusBar* m_statusbar;
368  QToolBar* m_fileToolBar;
369  //QToolBar* m_editToolBar;
370  QToolBar* m_mapToolBar;
371 
372  // Well known Widgets
374  LayerExplorer* m_explorer; //!< A dockable tree view for the layers in the application project.
377 
378  std::vector<DataSetTableDockWidget*> m_tableDocks;
379 
380  //non modal intefaces
382 
383  // Project
385 
386  QDockWidget* m_progressDockWidget; //!< Dock widget used to show progress information
387  QDockWidget* m_zoomInDisplaysDockWidget; //!< Dock widget used to show zoom in display
388  QDockWidget* m_eyeBirdDisplaysDockWidget; //!< Dock widget used to show eye bird display
389 
391  };
392  } // end namespace af
393  } // end namespace qt
394 } // end namespace te
395 
396 #endif // __TERRALIB_QT_AF_INTERNAL_BASEAPPLICATION_H
QDockWidget * m_zoomInDisplaysDockWidget
Dock widget used to show zoom in display.
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
A connector of the te::qt::widgets::MapDisplay class to the Application Framework.
Definition: MapDisplay.h:77
A QMainWindow to be used as the basis for TerraLib applications.
Configuration flags for the TerraLib Application Framework.
QDockWidget * m_progressDockWidget
Dock widget used to show progress information.
A dock widget for DataSetTableView objects.
InterfaceController * m_iController
LayerExplorer * m_explorer
A dockable tree view for the layers in the application project.
te::qt::widgets::QueryDialog * m_queryDlg
QDockWidget * m_eyeBirdDisplaysDockWidget
Dock widget used to show eye bird display.
#define TEQTAFEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:81
This file defines a class for a Query Dialog Dialog.
Definition: QueryDialog.h:64
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
A wdiget used to display a chart.
This class models the concept of a project for the TerraLib Application Framework.
Definition: Project.h:50
A connector to controll all non modal interfaces.
QAction * m_viewLayerExplorer
Qt components.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
std::vector< DataSetTableDockWidget * > m_tableDocks