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 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 ChartDisplayWidget;
60  class CompositionModeMenuWidget;
61  class QueryDialog;
62  }
63 
64  namespace af
65  {
66 // Forward declarations
67  class InterfaceController;
68  class LayerExplorer;
69  class MapDisplay;
70  class Project;
71  class DataSetTableDockWidget;
72  class StyleExplorer;
73 
74  namespace evt
75  {
76  struct Event;
77  }
78 
79  /*!
80  \class BaseApplication
81 
82  \brief A QMainWindow to be used as the basis for TerraLib applications.
83 
84  \ingroup af
85  */
86  class TEQTAFEXPORT BaseApplication : public QMainWindow, public boost::noncopyable
87  {
88  Q_OBJECT
89 
90  public:
91 
92  BaseApplication(QWidget* parent = 0);
93 
94  virtual ~BaseApplication();
95 
96  virtual void init();
97 
98  virtual void init(const std::string& configFile);
99 
100  MapDisplay* getDisplay();
101 
102  InterfaceController* getInterfaceController();
103 
104  virtual void resetState();
105 
106  void resetTerraLib(const bool& status);
107 
108  protected slots:
109 
110  void onApplicationTriggered(te::qt::af::evt::Event* evt);
111 
112  void onAddDataSetLayerTriggered();
113 
114  void onAddQueryLayerTriggered();
115 
116  void onAddTabularLayerTriggered();
117 
118  void onChartDisplayCreated(te::qt::widgets::ChartDisplayWidget* chartDisplay, te::map::AbstractLayer* layer);
119 
120  void onRemoveLayerTriggered();
121 
122  void onChangeLayerDataSourceTriggered();
123 
124  void onUpdateLayerDataSourceTriggered();
125 
126  void onLayerRemoveItemTriggered();
127 
128  void onRenameLayerTriggered();
129 
130  void onPluginsManagerTriggered();
131 
132  void onRecentProjectsTriggered(QAction* proj);
133 
134  void onNewProjectTriggered();
135 
136  void onOpenProjectTriggered();
137 
138  void onSaveProjectTriggered();
139 
140  void onSaveProjectAsTriggered();
141 
142  void onRestartSystemTriggered();
143 
144  void onToolsCustomizeTriggered();
145 
146  void onToolsDataExchangerTriggered();
147 
148  void onToolsDataExchangerDirectTriggered();
149 
150  void onToolsDataExchangerDirectPopUpTriggered();
151 
152  void onToolsQueryDataSourceTriggered();
153 
154  void onToolsRasterMultiResolutionTriggered();
155 
156  void onToolsFixGeometryTriggered();
157 
158  void onProjectPropertiesTriggered();
159 
160  void onAddFolderLayerTriggered();
161 
162  void onLayerPropertiesTriggered();
163 
164  void onLayerRemoveSelectionTriggered();
165 
166  void onLayerSRSTriggered();
167 
168  void onLayerShowTableTriggered();
169 
170  void onLayerHistogramTriggered();
171 
172  void onLinkTriggered();
173 
174  void onLayerScatterTriggered();
175 
176  void onLayerChartTriggered();
177 
178  void onLayerGroupingTriggered();
179 
180  void onLayerFitOnMapDisplayTriggered();
181 
182  void onLayerFitSelectedOnMapDisplayTriggered();
183 
184  void onLayerPanToSelectedOnMapDisplayTriggered();
185 
186  void onLayerCompositionModeTriggered();
187 
188  void onQueryLayerTriggered();
189 
190  void onMapSRIDTriggered();
191 
192  void onMapSetUnknwonSRIDTriggered();
193 
194  void onDrawTriggered();
195 
196  void onZoomInToggled(bool checked);
197 
198  void onZoomOutToggled(bool checked);
199 
200  void onPreviousExtentTriggered();
201 
202  void onNextExtentTriggered();
203 
204  void onPanToggled(bool checked);
205 
206  void onZoomExtentTriggered();
207 
208  void onInfoToggled(bool checked);
209 
210  void onMapRemoveSelectionTriggered();
211 
212  void onSelectionToggled(bool checked);
213 
214  void onMeasureDistanceToggled(bool checked);
215 
216  void onMeasureAreaToggled(bool checked);
217 
218  void onMeasureAngleToggled(bool checked);
219 
220  void onStopDrawTriggered();
221 
222  void showProgressDockWidget();
223 
224  void onLayerTableClose(te::qt::af::DataSetTableDockWidget* wid);
225 
226  void onFullScreenToggled(bool checked);
227 
228  void onLayerSelectedObjectsChanged(const te::map::AbstractLayerPtr& layer);
229 
230  void onHighlightLayerObjects(const te::map::AbstractLayerPtr& layer, te::da::DataSet* dataset, const QColor& color);
231 
232  void onLayerExplorerVisibilityChanged(bool visible);
233 
234  void onDisplayDataTableChanged(bool visible);
235 
236  void onStyleExplorerVisibilityChanged(bool visible);
237 
238  void onDataSourceExplorerTriggered();
239 
240  void onCreateNewLayer(te::map::AbstractLayerPtr layer);
241 
242  //void onTrajectoryAnimationTriggered(); // Lauro
243 
244  protected:
245 
246  virtual void openProject(const QString& projectFileName);
247 
248  virtual QMessageBox::StandardButton checkProjectSave();
249 
250  virtual void newProject();
251 
252  virtual void makeDialog();
253 
254  virtual void closeEvent(QCloseEvent* e);
255 
256  virtual void initAction(QAction*& act, const QString& icon, const QString& name,
257  const QString& text, const QString& tooltip,
258  bool iconVisibleInMenu, bool isCheckable, bool enabled, QObject* parent);
259 
260  virtual void initActions();
261 
262  virtual void initMenus();
263 
264  virtual void initToolbars();
265 
266  virtual void initStatusBar();
267 
268  virtual void initSlotsConnections();
269 
270  signals:
271  void applicationClose();
272 
273  protected:
274 
275  //! Qt components
277  QAction* m_viewDataTable;
279  //QAction* m_editUndo;
280  //QAction* m_editRedo;
281  //QAction* m_editCut;
282  //QAction* m_editCopy;
283  //QAction* m_editPaste;
284  //QAction* m_editSelectAll;
285  //QAction* m_editClear;
286  //QAction* m_editFind;
287  //QAction* m_editReplace;
289  QAction* m_viewRefresh;
299  QAction* m_helpContents;
300  QAction* m_helpUpdate;
301  QAction* m_viewGrid;
312  QAction* m_layerEdit;
314  QAction* m_layerExport;
316  QAction* m_layerSRS;
318  QAction* m_layerRaise;
319  QAction* m_layerLower;
320  QAction* m_layerToTop;
321  QAction* m_layerToBottom;
324  QAction* m_layerChart;
332  QAction* m_queryLayer;
334  QAction* m_helpAbout;
339  QAction* m_fileExit;
340  QAction* m_filePrint;
343  QAction* m_mapSRID;
345  QAction* m_mapDraw;
346  QAction* m_mapZoomIn;
347  QAction* m_mapZoomOut;
348  QAction* m_mapZoomArea;
349  QAction* m_mapPan;
350  QAction* m_mapZoomExtent;
352  QAction* m_mapNextExtent;
353  QAction* m_mapInfo;
355  QAction* m_mapSelection;
361 
362  QWidget* m_centralwidget;
363 
364  QLineEdit* m_mapSRIDLineEdit;
366 
367  QMenuBar* m_menubar;
368  //QMenu* m_editMenu;
369  QMenu* m_viewMenu;
371  QMenu* m_toolsMenu;
374  QMenu* m_helpMenu;
377  QMenu* m_layerMenu;
378  QMenu* m_fileMenu;
380  QMenu* m_mapMenu;
381 
382  QLabel* m_selected;
383 
384  QStatusBar* m_statusbar;
385  QToolBar* m_fileToolBar;
386  //QToolBar* m_editToolBar;
387  QToolBar* m_mapToolBar;
388 
389  // Well known Widgets
391  LayerExplorer* m_explorer; //!< A dockable tree view for the layers in the application project.
394 
395  std::vector<DataSetTableDockWidget*> m_tableDocks;
396 
397  //non modal intefaces
399 
400  //popup menus
402 
403  // Project
405 
406  QDockWidget* m_progressDockWidget; //!< Dock widget used to show progress information
407  QDockWidget* m_zoomInDisplaysDockWidget; //!< Dock widget used to show zoom in display
408  QDockWidget* m_eyeBirdDisplaysDockWidget; //!< Dock widget used to show eye bird display
409 
411  };
412  } // end namespace af
413  } // end namespace qt
414 } // end namespace te
415 
416 #endif // __TERRALIB_QT_AF_INTERNAL_BASEAPPLICATION_H
QDockWidget * m_zoomInDisplaysDockWidget
Dock widget used to show zoom in display.
te::qt::widgets::CompositionModeMenuWidget * m_compModeMenu
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.
This class is widget that provides a menu for composition mode selection.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
std::vector< DataSetTableDockWidget * > m_tableDocks