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 
109  {
110  return m_explorer;
111  }
112 
113  protected slots:
114 
115  void onApplicationTriggered(te::qt::af::evt::Event* evt);
116 
117  void onAddDataSetLayerTriggered();
118 
119  void onAddQueryLayerTriggered();
120 
121  void onAddTabularLayerTriggered();
122 
123  void onChartDisplayCreated(te::qt::widgets::ChartDisplayWidget* chartDisplay, te::map::AbstractLayer* layer);
124 
125  void onRemoveLayerTriggered();
126 
127  void onChangeLayerDataSourceTriggered();
128 
129  void onUpdateLayerDataSourceTriggered();
130 
131  void onLayerRemoveItemTriggered();
132 
133  void onRenameLayerTriggered();
134 
135  void onPluginsManagerTriggered();
136 
137  void onRecentProjectsTriggered(QAction* proj);
138 
139  void onNewProjectTriggered();
140 
141  void onOpenProjectTriggered();
142 
143  void onSaveProjectTriggered();
144 
145  void onSaveProjectAsTriggered();
146 
147  void onRestartSystemTriggered();
148 
149  void onToolsCustomizeTriggered();
150 
151  void onToolsDataExchangerTriggered();
152 
153  void onToolsDataExchangerDirectTriggered();
154 
155  void onToolsDataExchangerDirectPopUpTriggered();
156 
157  void onToolsQueryDataSourceTriggered();
158 
159  void onToolsRasterMultiResolutionTriggered();
160 
161  void onToolsFixGeometryTriggered();
162 
163  void onProjectPropertiesTriggered();
164 
165  void onAddFolderLayerTriggered();
166 
167  void onLayerPropertiesTriggered();
168 
169  void onLayerRemoveSelectionTriggered();
170 
171  void onLayerSRSTriggered();
172 
173  void onLayerShowTableTriggered();
174 
175  void onLayerHistogramTriggered();
176 
177  void onLinkTriggered();
178 
179  void onLayerScatterTriggered();
180 
181  void onLayerChartTriggered();
182 
183  void onLayerGroupingTriggered();
184 
185  void onLayerFitOnMapDisplayTriggered();
186 
187  void onLayerFitSelectedOnMapDisplayTriggered();
188 
189  void onLayerPanToSelectedOnMapDisplayTriggered();
190 
191  void onLayerCompositionModeTriggered();
192 
193  void onQueryLayerTriggered();
194 
195  void onMapSRIDTriggered();
196 
197  void onMapSetUnknwonSRIDTriggered();
198 
199  void onDrawTriggered();
200 
201  void onZoomInToggled(bool checked);
202 
203  void onZoomOutToggled(bool checked);
204 
205  void onPreviousExtentTriggered();
206 
207  void onNextExtentTriggered();
208 
209  void onPanToggled(bool checked);
210 
211  void onZoomExtentTriggered();
212 
213  void onInfoToggled(bool checked);
214 
215  void onMapRemoveSelectionTriggered();
216 
217  void onSelectionToggled(bool checked);
218 
219  void onMeasureDistanceToggled(bool checked);
220 
221  void onMeasureAreaToggled(bool checked);
222 
223  void onMeasureAngleToggled(bool checked);
224 
225  void onStopDrawTriggered();
226 
227  void showProgressDockWidget();
228 
229  void onLayerTableClose(te::qt::af::DataSetTableDockWidget* wid);
230 
231  void onFullScreenToggled(bool checked);
232 
233  void onLayerSelectedObjectsChanged(const te::map::AbstractLayerPtr& layer);
234 
235  void onHighlightLayerObjects(const te::map::AbstractLayerPtr& layer, te::da::DataSet* dataset, const QColor& color);
236 
237  void onLayerExplorerVisibilityChanged(bool visible);
238 
239  void onDisplayDataTableChanged(bool visible);
240 
241  void onStyleExplorerVisibilityChanged(bool visible);
242 
243  void onDataSourceExplorerTriggered();
244 
245  void onCreateNewLayer(te::map::AbstractLayerPtr layer);
246 
247  //void onTrajectoryAnimationTriggered(); // Lauro
248 
249  protected:
250 
251  virtual void openProject(const QString& projectFileName);
252 
253  virtual QMessageBox::StandardButton checkProjectSave();
254 
255  virtual void newProject();
256 
257  virtual void makeDialog();
258 
259  virtual void closeEvent(QCloseEvent* e);
260 
261  virtual void initAction(QAction*& act, const QString& icon, const QString& name,
262  const QString& text, const QString& tooltip,
263  bool iconVisibleInMenu, bool isCheckable, bool enabled, QObject* parent);
264 
265  virtual void initActions();
266 
267  virtual void initMenus();
268 
269  virtual void initToolbars();
270 
271  virtual void initStatusBar();
272 
273  virtual void initSlotsConnections();
274 
275  signals:
276  void applicationClose();
277 
278  protected:
279 
280  //! Qt components
282  QAction* m_viewDataTable;
284  //QAction* m_editUndo;
285  //QAction* m_editRedo;
286  //QAction* m_editCut;
287  //QAction* m_editCopy;
288  //QAction* m_editPaste;
289  //QAction* m_editSelectAll;
290  //QAction* m_editClear;
291  //QAction* m_editFind;
292  //QAction* m_editReplace;
294  QAction* m_viewRefresh;
304  QAction* m_helpContents;
305  QAction* m_helpUpdate;
306  QAction* m_viewGrid;
317  QAction* m_layerEdit;
319  QAction* m_layerExport;
321  QAction* m_layerSRS;
323  QAction* m_layerRaise;
324  QAction* m_layerLower;
325  QAction* m_layerToTop;
326  QAction* m_layerToBottom;
329  QAction* m_layerChart;
337  QAction* m_queryLayer;
339  QAction* m_helpAbout;
344  QAction* m_fileExit;
345  QAction* m_filePrint;
348  QAction* m_mapSRID;
350  QAction* m_mapDraw;
351  QAction* m_mapZoomIn;
352  QAction* m_mapZoomOut;
353  QAction* m_mapZoomArea;
354  QAction* m_mapPan;
355  QAction* m_mapZoomExtent;
357  QAction* m_mapNextExtent;
358  QAction* m_mapInfo;
360  QAction* m_mapSelection;
366 
367  QWidget* m_centralwidget;
368 
369  QLineEdit* m_mapSRIDLineEdit;
371 
372  QMenuBar* m_menubar;
373  //QMenu* m_editMenu;
374  QMenu* m_viewMenu;
376  QMenu* m_toolsMenu;
379  QMenu* m_helpMenu;
382  QMenu* m_layerMenu;
383  QMenu* m_fileMenu;
385  QMenu* m_mapMenu;
386 
387  QLabel* m_selected;
388 
389  QStatusBar* m_statusbar;
390  QToolBar* m_fileToolBar;
391  //QToolBar* m_editToolBar;
392  QToolBar* m_mapToolBar;
393 
394  // Well known Widgets
396  LayerExplorer* m_explorer; //!< A dockable tree view for the layers in the application project.
399 
400  std::vector<DataSetTableDockWidget*> m_tableDocks;
401 
402  //non modal intefaces
404 
405  //popup menus
407 
408  // Project
410 
411  QDockWidget* m_progressDockWidget; //!< Dock widget used to show progress information
412  QDockWidget* m_zoomInDisplaysDockWidget; //!< Dock widget used to show zoom in display
413  QDockWidget* m_eyeBirdDisplaysDockWidget; //!< Dock widget used to show eye bird display
414 
416  };
417  } // end namespace af
418  } // end namespace qt
419 } // end namespace te
420 
421 #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.
URI C++ Library.
#define TEQTAFEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:78
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
LayerExplorer * getLayerExplorer() const
std::vector< DataSetTableDockWidget * > m_tableDocks