OTB  6.7.0
Orfeo Toolbox
mvdMainWindow.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 
22 #ifndef mvdMainWindow_h
23 #define mvdMainWindow_h
24 
25 //
26 // Configuration include.
28 #include "ConfigureMonteverdi.h"
29 
30 #define USE_PIXEL_DESCRIPTION 0
31 
32 #define RENDER_IMAGE_VIEW_DISABLED 0
33 #define RENDER_QUICKLOOK_VIEW_DISABLED 0
34 
35 
36 /*****************************************************************************/
37 /* INCLUDE SECTION */
38 
39 
40 #ifndef USE_OTB_APPS
41 # define USE_OTB_APPS 1
42 #endif
43 
44 //
45 // Qt includes (sorted by alphabetic order)
47 #include <QtOpenGL>
48 
49 //
50 // System includes (sorted by alphabetic order)
51 
52 //
53 // ITK includes (sorted by alphabetic order)
54 
55 //
56 // OTB includes (sorted by alphabetic order)
57 
58 //
59 // Monteverdi includes (sorted by alphabetic order)
60 #include "mvdTypes.h"
61 #include "mvdStackedLayerModel.h"
62 //
63 #include "mvdI18nMainWindow.h"
64 
65 #include "OTBMonteverdiExport.h"
66 
67 /*****************************************************************************/
68 /* PRE-DECLARATION SECTION */
69 
70 //
71 // External class pre-declaration.
72 namespace
73 {
74 }
75 
76 namespace mvd
77 {
78 //
79 // Internal class pre-declaration.
80 // Core
81 class AbstractLayerModel;
82 // Gui
83 class FilenameDragAndDropEventFilter;
84 class ImageViewWidget;
85 class KeymapDialog;
86 class LayerStackWidget;
87 class ShaderWidget;
88 class StatusBarWidget;
89 class ProjectionBarWidget;
90 
91 namespace Ui
92 {
93 class MainWindow;
94 }
95 
96 /*****************************************************************************/
97 /* CLASS DEFINITION SECTION */
98 
106 class OTBMonteverdi_EXPORT MainWindow
107  : public I18nMainWindow
108 {
109 
110  /*-[ QOBJECT SECTION ]-----------------------------------------------------*/
111 
112  Q_OBJECT;
113 
114  /*-[ PUBLIC SECTION ]------------------------------------------------------*/
115 
116 //
117 // Public types.
118 public:
119 
120 //
121 // Public methods.
122 public:
124  MainWindow( QWidget* p =0, Qt::WindowFlags flags =0 );
125 
127  ~MainWindow() override;
128 
131  bool CheckGLCapabilities( bool forceNoGLSL = false );
132 
135 #if USE_OTB_APPS
136  void SetupOTBApplications();
137 #endif // USE_OTB_APPS
138 
139  /*-[ PROTECTED SLOTS SECTION ]---------------------------------------------*/
140 
141 //
142 // Public slots.
143 public slots:
144 
147  CountType ImportImage( const QString & filename,
149 
152  void ImportImages( const QStringList & filenames, bool enableOverviews = true );
153 
154  /*-[ SIGNALS SECTION ]-----------------------------------------------------*/
155 
156 //
157 // SIGNALS.
158 signals:
159 
160  void UserCoordinatesEditingFinished(const QString&);
161 
162  void UserScaleEditingFinished(const QString &);
163 
164  void UserZoomIn();
165 
166  void UserZoomOut();
167 
168  void UserZoomExtent();
169 
170  void UserZoomFull();
171 
172  void UserZoomLayer();
173 
174  /*-[ PROTECTED SECTION ]---------------------------------------------------*/
175 
176 //
177 // Protected methods.
178 protected:
179 
181 
182  //
183  // QMainWindow methods.
184 
185  void closeEvent( QCloseEvent* event ) override;
186 
187 //
188 // Protected attributes.
189 protected:
190 
191  /*-[ PROTECTED SLOTS SECTION ]---------------------------------------------*/
192 
193 //
194 // Protected slots.
195 protected slots:
196 
199  void OnAboutToChangeModel( const AbstractModel * ) override;
200 
203  void OnModelChanged( AbstractModel * ) override;
204 
207  // void OnAboutToChangeSelectedDatasetModel( const DatasetModel* );
208 
211  // void OnSelectedDatasetModelChanged( DatasetModel* );
212 
215  void OnAboutToChangeSelectedLayerModel( const StackedLayerModel::KeyType & );
216 
219  void OnSelectedLayerModelChanged( const StackedLayerModel::KeyType & );
220 
223 #if defined( OTB_USE_QT ) && USE_OTB_APPS
224  void OnApplicationToLaunchSelected( const QString & appName );
225 #endif // defined( OTB_USE_QT ) && USE_OTB_APPS
226 
228  void OnOTBApplicationOutputImageChanged( const QString & appName,
229  const QString & outfname);
230 
233  void OnExecutionDone( int status );
234 
235  /*-[ PRIVATE SECTION ]-----------------------------------------------------*/
236 
237 //
238 // Private types.
239 private:
240 
241 
242 //
243 // Private methods.
244 private:
245 
248  ImageViewWidget* CreateImageViewWidget( QGLWidget* sharedGlWidget =NULL );
249 
252  ImageViewWidget* CreateQuicklookViewWidget( QGLWidget* sharedGlWidget =NULL );
253 
256  void InitializeDockWidgets();
257 
260  void InitializeCentralWidget();
261 
264  void InitializeRenderToolBar();
265 
268  void InitializeShaderToolBar();
269 
272  void InitializeProjectionBarWidget();
273 
276  void InitializeStatusBarWidgets();
277 
280  inline
281  const ImageViewWidget* GetQuicklookView() const;
282 
285  inline
286  ImageViewWidget* GetQuicklookView();
287 
290  void ConnectImageViews();
291 
294  void ConnectViewMenu();
295 
298  void ConnectReferenceLayerComboBox( StackedLayerModel * );
299 
302  void DisconnectReferenceLayerComboBox( StackedLayerModel * );
303 
306  void SetupReferenceLayerComboBox( StackedLayerModel * );
307 
310  void ConnectStatusBar();
311 
314  void ConnectProjectionBarWidget();
315 
316 #if USE_PIXEL_DESCRIPTION
317 
320  void ConnectPixelDescriptionWidget( AbstractLayerModel * model);
321 
324  void DisconnectPixelDescriptionWidget( const AbstractLayerModel * model );
325 
326 #endif // USE_PIXEL_DESCRIPTION
327 
330  void SetGLSLEnabled( bool );
331 
332  //
333  // I18nMainWindow methods.
334 
335  void virtual_SetupUI() override;
336 
337  void virtual_ConnectUI() override;
338 
339  void virtual_InitializeUI() override;
340 
341 //
342 // Private attributes.
343 private:
347  Ui::MainWindow* m_UI;
348 
352  QDockWidget* m_ColorDynamicsDock;
353 
357  QDockWidget* m_ColorSetupDock;
358 
362  // QDockWidget* m_DatabaseBrowserDock;
363 
367  // QDockWidget* m_DatasetPropertiesDock;
368 
372  QDockWidget * m_LayerStackDock;
373 
377 #if USE_PIXEL_DESCRIPTION
378  QDockWidget* m_PixelDescriptionDock;
379 #endif // USE_PIXEL_DESCRIPTION
380 
384  QDockWidget* m_HistogramDock;
385 
386 
387 #ifdef OTB_USE_QT
388 
391  QDockWidget* m_OtbApplicationsBrowserDock;
392 #endif
393 
398 
402  QDockWidget* m_QuicklookViewDock;
403 
407 
411 
415 
419 
423 
427 
430  bool m_isGLSLAvailable : 1;
431  bool m_ForceNoGLSL : 1;
432 
433  /*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/
434 
435 //
436 // Private slots.
437 private slots:
438 
441  void on_action_GLSL_triggered( bool );
442 
447  void on_action_Keymap_triggered();
448 
451  void on_action_LoadOTBApplications_triggered();
452 
457  void on_action_OpenImage_triggered();
458 
463  void on_action_Preferences_triggered();
464 
467  void on_action_SaveScreenshot_triggered();
468 
473  void on_action_ZoomIn_triggered();
474 
479  void on_action_ZoomOut_triggered();
480 
485  void on_action_ZoomExtent_triggered();
486 
491  void on_action_ZoomFull_triggered();
492 
497  void on_action_ZoomLayer_triggered();
498 
501  void OnReferenceLayerCurrentIndexChanged( int );
502 
505  void OnReferenceLayerChanged( size_t );
506 
509  void OnSettingsUpdated();
510 
513  void RefreshReferenceLayerComboBox();
514 
517  void OnPixelInfoChanged( const QPoint &, const PointType &, const PixelInfo::Vector & );
518 
519 };
520 
521 } // end namespace 'mvd'
522 
523 /*****************************************************************************/
524 /* INLINE SECTION */
525 
526 //
527 // System includes (sorted by alphabetic order)
528 
529 //
530 // ITK includes (sorted by alphabetic order)
531 
532 //
533 // OTB includes (sorted by alphabetic order)
534 
535 //
536 // Monteverdi includes (sorted by alphabetic order)
537 #include "mvdImageViewWidget.h"
538 
539 //
540 // Some constants.
541 
542 namespace mvd
543 {
544 
545 /*****************************************************************************/
546 inline
547 const ImageViewWidget*
550 {
551  return qobject_cast< const ImageViewWidget* >( m_QuicklookViewDock->widget() );
552 }
553 
554 /*****************************************************************************/
555 inline
559 {
560  return qobject_cast< ImageViewWidget* >( m_QuicklookViewDock->widget() );
561 }
562 
563 } // end namespace 'mvd'
564 
565 #endif // mvdMainWindow_h
ImageViewWidget * m_ImageView
Image-view page.
Widget template skeleton to copy-paste when adding a new widget class.
KeymapDialog * m_KeymapDialog
Widget template skeleton to copy-paste when adding a new widget class.
VectorImageModel * ImportImage(const QString &filename, int width, int height)
ShaderWidget * m_ShaderWidget
StatusBarWidget * m_StatusBarWidget
ProjectionBarWidget widget class.
ProjectionBarWidget * m_ProjectionBarWidget
QDockWidget * m_ColorDynamicsDock
Color dynamicsk-view dock-widget.
unsigned int CountType
Definition: mvdTypes.h:80
QDockWidget * m_LayerStackDock
Database-browser dock-widget.
FilenameDragAndDropEventFilter * m_FilenameDragAndDropEventFilter
LayerModelMap::size_type SizeType
std::vector< PixelInfo > Vector
Definition: mvdTypes.h:206
const ImageViewWidget * GetQuicklookView() const
Main-window widget base for the i18n application.
The application main-widow widget.
Status Bar widget widget class.
Ui::MainWindow * m_UI
uic generated.
QDockWidget * m_ColorSetupDock
Color setup dock-widget.
QDockWidget * m_HistogramDock
Current Pixel Description dock-widget.
LayerModelMap::key_type KeyType
VectorImageType::PointType PointType
Definition: mvdTypes.h:189
QDockWidget * m_QuicklookViewDock
Quicklook-view dock.