diff --git a/Data/Baseline/OTB/Images/owTvOReadImageInfoDoc.html b/Data/Baseline/OTB/Images/owTvOReadImageInfoDoc.html deleted file mode 100644 index c8919b74bff7fe7d0eccee6733302df5619aa97d..0000000000000000000000000000000000000000 --- a/Data/Baseline/OTB/Images/owTvOReadImageInfoDoc.html +++ /dev/null @@ -1 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//ENhttp://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"></style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"><p align="center" style=" margin-top:16px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:x-large; font-weight:600;"><span style=" font-size:x-large;">Read image information</span></p><p style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:large; font-weight:600;"><span style=" font-size:large;">Brief Description</span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Get information about the image</p><p style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:large; font-weight:600;"><span style=" font-size:large;">Tags</span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Image Manipulation, Utilities, Image MetaData</p><p style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:large; font-weight:600;"><span style=" font-size:large;">Long Description</span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Display information about the input image like: image size, origin, spacing, metadata, projections...</p><p style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:large; font-weight:600;"><span style=" font-size:large;">Parameters</span></p><ul><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Input Image: </span>Input image to analyse</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Display the OSSIM keywordlist: </span>Output the OSSIM keyword list. It contains metadata information (sensor model, geometry ). Information is stored in keyword list (pairs of key/value)</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Write the OSSIM keywordlist to a geom file: </span>This option allows extracting the OSSIM keywordlist of the image into a geom file.</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Start index X: </span>X start index</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Start index Y: </span>Y start index</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Size X: </span>X size (in pixels)</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Size Y: </span>Y size (in pixels)</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Pixel Size X: </span>Pixel size along X (in physical units)</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Pixel Size Y: </span>Pixel size along Y (in physical units)</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Image Origin X: </span>Origin along X</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Image Origin Y: </span>Origin along Y</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Estimated ground spacing X: </span>Estimated ground spacing along X (in meters).</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Estimated ground spacing Y: </span>Estimated ground spacing along Y (in meters).</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Number Of Bands: </span>Number of bands</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Data type: </span>Data type</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Sensor id: </span>Sensor identifier</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Image id: </span>Image identifier</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Acquisition time: </span>Acquisition time.</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Upper left latitude: </span>Latitude of the upper left corner.</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Upper left longitude: </span>Longitude of the upper left corner.</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Upper right latitude: </span>Latitude of the upper right corner.</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Upper right longitude: </span>Longitude of the upper right corner.</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Lower right latitude: </span>Latitude of the lower right corner.</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Lower right longitude: </span>Longitude of the lower right corner.</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Lower left latitude: </span>Latitude of the lower left corner.</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Lower left longitude: </span>Longitude of the lower left corner.</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Nearest town: </span>Main town near center of image</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Country: </span>Country of the image</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Default RGB Display: </span>This group of parameters provide information about the default rgb composition.</p><ul><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Red Band: </span>Red band Number</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Green Band: </span>Green band Number</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Blue Band: </span>Blue band Number</p></li></ul></li><br /><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Projection: </span>Projection Coordinate System</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Keywordlist: </span>Image keyword list</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Ground Control Points information: </span>This group of parameters provide information about all GCPs.</p><ul><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >GCPs Number: </span>Number of GCPs</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >GCP Projection: </span>Projection Coordinate System for GCPs</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >GCPs Id: </span>GCPs identifier</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >GCPs Info: </span>GCPs Information</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >GCPs Image Coordinates: </span>GCPs Image coordinates</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >GCPs Geographic Coordinates: </span>GCPs Geographic Coordinates</p></li></ul></li><br /><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Load parameters from XML: </span>Load application parameters from an XML file.</p></li><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New, courier'; font-weight:600;"; >Save parameters to XML: </span>Save application parameters to an XML file.</p></li></ul><p style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:large; font-weight:600;"><span style=" font-size:large;">Limitations</span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">None</p><p style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:large; font-weight:600;"><span style=" font-size:large;">Authors</span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">OTB-Team</p><p style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:large; font-weight:600;"><span style=" font-size:large;">See also</span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> </p><p style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:large; font-weight:600;"><span style=" font-size:large;">Example of use</span></p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><ul><li><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">in: QB_Toulouse_Ortho_XS.tif</p></li></ul></p></body></html> \ No newline at end of file diff --git a/Modules/Visualization/Mapla/src/mvdMaplaMainWindow.ui b/Modules/Visualization/Mapla/src/mvdMaplaMainWindow.ui index d238ae4d274babfb82a52af855631335673552e5..c1be0f661f40b80ee0ad9f1352b4e3ea6a938c7b 100644 --- a/Modules/Visualization/Mapla/src/mvdMaplaMainWindow.ui +++ b/Modules/Visualization/Mapla/src/mvdMaplaMainWindow.ui @@ -23,7 +23,7 @@ <x>0</x> <y>0</y> <width>400</width> - <height>27</height> + <height>22</height> </rect> </property> <widget class="QMenu" name="menu_File"> @@ -38,6 +38,7 @@ <string>&Help</string> </property> <addaction name="action_About"/> + <addaction name="action_Documentation"/> </widget> <widget class="QMenu" name="menu_Edit"> <property name="title"> @@ -100,6 +101,14 @@ <string>Prefere&nces</string> </property> </action> + <action name="action_Documentation"> + <property name="text"> + <string>Documentation</string> + </property> + <property name="shortcut"> + <string>F1</string> + </property> + </action> </widget> <resources> <include location="mvdMaplaMainWindow.qrc"/> diff --git a/Modules/Visualization/Monteverdi/include/mvdMainWindow.h b/Modules/Visualization/Monteverdi/include/mvdMainWindow.h index 0b30657bc3d23bd5134cbb3cf51447cf515aea9f..e3341bf12f61862b9a76cba5a8b68ecb3d881fa5 100644 --- a/Modules/Visualization/Monteverdi/include/mvdMainWindow.h +++ b/Modules/Visualization/Monteverdi/include/mvdMainWindow.h @@ -27,7 +27,6 @@ //// Included at first position before any other ones. #include "ConfigureMonteverdi.h" -#define USE_TABBED_VIEW 0 #define USE_PIXEL_DESCRIPTION 0 #define RENDER_IMAGE_VIEW_DISABLED 0 @@ -225,18 +224,6 @@ protected slots: void OnApplicationToLaunchSelected( const QString & appName, const QString & docName ); #endif // defined( OTB_USE_QT ) && USE_OTB_APPS - /** - */ -#if USE_TABBED_VIEW - void OnTabCloseRequested( int index ); -#endif - - /** - */ -#if USE_TABBED_VIEW - void OnTabCloseRequested(); -#endif - /** */ void OnOTBApplicationOutputImageChanged( const QString & appName, const QString & outfname); @@ -413,12 +400,6 @@ private: */ QDockWidget* m_QuicklookViewDock; - /** - */ -#if USE_TABBED_VIEW - QTabWidget* m_CentralTabWidget; -#endif // USE_TABBED_VIEW - /** */ StatusBarWidget* m_StatusBarWidget; diff --git a/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx b/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx index 7efda55e19601532253988b4097d8ff16e222449..da9126705f6481af0835b02991b0d80ec2fcdedf 100644 --- a/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx +++ b/Modules/Visualization/Monteverdi/src/mvdMainWindow.cxx @@ -137,9 +137,6 @@ MainWindow #endif m_ImageView( NULL ), m_QuicklookViewDock( NULL ), -#if USE_TABBED_VIEW - m_CentralTabWidget( NULL ), -#endif // USE_TABBED_VIEW m_StatusBarWidget( NULL ), m_ShaderWidget( NULL ), m_FilenameDragAndDropEventFilter( NULL ), @@ -399,17 +396,6 @@ MainWindow SLOT( OnHistogramRefreshed() ) ); - // - // close tabs handling -#if USE_TABBED_VIEW - QObject::connect( - m_CentralTabWidget, - SIGNAL( tabCloseRequested( int ) ), - this, - SLOT( OnTabCloseRequested( int ) ) - ); -#endif // USE_TABBED_VIEW - // // Other connections. @@ -981,40 +967,11 @@ void MainWindow ::InitializeCentralWidget() { -#if USE_TABBED_VIEW - // Create central tab-widget for multi-view support. - assert( m_CentralTabWidget==NULL ); - m_CentralTabWidget = new QTabWidget( this ); - - // Customize it. - m_CentralTabWidget->setTabsClosable( true ); - - // Set-it up as central widget. - setCentralWidget( m_CentralTabWidget ); - - // - // access to the quicklook tabBar to remove the close button - QTabBar* tabBar = m_CentralTabWidget->findChild< QTabBar* >(); -#endif // USE_TABBED_VIEW - // Initialize image-view. assert( m_ImageView==NULL ); m_ImageView = CreateImageViewWidget(); -#if USE_TABBED_VIEW - // Add first tab: image-view. - int index = m_CentralTabWidget->addTab( - m_ImageView, - tr( "Image view" ) - ); - - tabBar->setTabButton( index, QTabBar::RightSide, 0); - tabBar->setTabButton( index, QTabBar::LeftSide, 0); - -#else // USE_TABBED_VIEW setCentralWidget( m_ImageView ); - -#endif // USE_TABBED_VIEW } /*****************************************************************************/ @@ -2225,40 +2182,6 @@ MainWindow Application::ConstInstance()->GetOTBApplicationsModel()->GetLauncher()!=NULL ); -#if USE_TABBED_VIEW - Wrapper::QtWidgetView * appWidget = - Application::ConstInstance() - ->GetOTBApplicationsModel() - ->GetLauncher() - ->NewOtbApplicationWidget( - appName, - true - ); - - assert( appWidget!=NULL ); - - // - // add the application in a tab - // TODO : check if this application is already opened ??? - int tabIndex = m_CentralTabWidget->addTab( - appWidget, QIcon( ":/icons/process" ), docName ); - - // no checking needed here, if index is not available nothing is - // done. Focus on the newly added tab - m_CentralTabWidget->setCurrentIndex( tabIndex ); - - // - // on quit widget signal, close its tab - QObject::connect( - appWidget, - SIGNAL( QuitSignal() ), - // to: - this, - SLOT( OnTabCloseRequested() ) - ); - -#else // USE_TABBED_VIEW - QWidget * appWidget = Application::ConstInstance() ->GetOTBApplicationsModel() @@ -2273,8 +2196,6 @@ MainWindow appWidget->show(); -#endif // USE_TABBED_VIEW - // // connections. not using m_CentralTabWidget->currentWidget() leads // to a wrong connection!!!! @@ -2299,62 +2220,6 @@ MainWindow #endif // defined( OTB_USE_QT ) && USE_OTB_APPS -/*****************************************************************************/ -#if USE_TABBED_VIEW - -void -MainWindow -::OnTabCloseRequested() -{ - // get current tab index - int currentIndex = m_CentralTabWidget->currentIndex(); - - // close tab and delete its widget - OnTabCloseRequested( currentIndex ); -} - -#endif // USE_TABBED_VIEW - -/*****************************************************************************/ -#if USE_TABBED_VIEW - -void -MainWindow -::OnTabCloseRequested( int index ) -{ - assert( index >= 1 ); - - QWidget* appWidget = m_CentralTabWidget->widget( index ); - assert( appWidget!=NULL ); - -#if defined( OTB_USE_QT ) && USE_OTB_APPS - - assert( appWidget==qobject_cast< Wrapper::QtWidgetView* >( appWidget ) ); - Wrapper::QtWidgetView* appWidgetView = - qobject_cast< Wrapper::QtWidgetView* >( appWidget ); - assert( appWidgetView!=NULL ); - - if( !appWidgetView->IsClosable() ) - { - QMessageBox::warning( - this, - tr( "Warning!" ), - tr( "Tab cannot be closed while OTB application is running." ) - ); - - return; - } - -#endif - - m_CentralTabWidget->removeTab( index ); - - delete appWidget; - appWidget = NULL; -} - -#endif // USE_TABBED_VIEW - /*****************************************************************************/ void MainWindow diff --git a/Modules/Visualization/Monteverdi/src/mvdMainWindow.ui b/Modules/Visualization/Monteverdi/src/mvdMainWindow.ui index 98628a1a63a5e01fb08c46e638946a6439d10644..f2675f8fb9aec24eed6a136306aea3be211da4f4 100644 --- a/Modules/Visualization/Monteverdi/src/mvdMainWindow.ui +++ b/Modules/Visualization/Monteverdi/src/mvdMainWindow.ui @@ -23,7 +23,7 @@ <x>0</x> <y>0</y> <width>800</width> - <height>27</height> + <height>22</height> </rect> </property> <widget class="QMenu" name="menu_File"> @@ -39,6 +39,7 @@ <string>&Help</string> </property> <addaction name="action_About"/> + <addaction name="action_Documentation"/> <addaction name="action_Keymap"/> </widget> <widget class="QMenu" name="menu_View"> @@ -296,6 +297,14 @@ <string>Use OpenGL Shading Language (GLSL)</string> </property> </action> + <action name="action_Documentation"> + <property name="text"> + <string>Documentation</string> + </property> + <property name="shortcut"> + <string>F1</string> + </property> + </action> </widget> <resources> <include location="mvdMainWindow.qrc"/> diff --git a/Modules/Visualization/MonteverdiGui/include/mvdApplicationLauncher.h b/Modules/Visualization/MonteverdiGui/include/mvdApplicationLauncher.h index dbfaa9215bc7def4f7b3b106b314e3e139efaa8b..a4f52b8c0e08c5f871bc3df632910bb65c30c738 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdApplicationLauncher.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdApplicationLauncher.h @@ -27,47 +27,12 @@ #include "ConfigureMonteverdi.h" -/*****************************************************************************/ -/* INCLUDE SECTION */ - -// -// Qt includes (sorted by alphabetic order) -//// Must be included before system/custom includes. #include <QtWidgets> - -// -// System includes (sorted by alphabetic order) - -// -// ITK includes (sorted by alphabetic order) - -// -// OTB includes (sorted by alphabetic order) #include "OTBMonteverdiGUIExport.h" -// -// Monteverdi includes (sorted by alphabetic order) - - -/*****************************************************************************/ -/* PRE-DECLARATION SECTION */ - -// -// External classes pre-declaration. -namespace -{ -} +#include "otbWrapperApplication.h" namespace mvd { -// -// Internal classes pre-declaration. -namespace Wrapper -{ -class QtWidgetView; -} - -/*****************************************************************************/ -/* CLASS DEFINITION SECTION */ /** * \class ApplicationLauncher @@ -76,106 +41,22 @@ class QtWidgetView; * * \brief WIP. */ -class OTBMonteverdiGUI_EXPORT ApplicationLauncher : - public QObject +class OTBMonteverdiGUI_EXPORT ApplicationLauncher : public QObject { - - /*-[ QOBJECT SECTION ]-----------------------------------------------------*/ - Q_OBJECT; - /*-[ PUBLIC SECTION ]------------------------------------------------------*/ - -// -// Public methods. public: - /** \brief Constructor. */ - ApplicationLauncher( QObject* p =NULL ); + ApplicationLauncher(QObject* p = nullptr); /** \brief Destructor. */ ~ApplicationLauncher() override; - /** - * \return A new instance of the automatically-generated widget of - * the given OTB application. - */ - Wrapper::QtWidgetView * - NewOtbApplicationWidget( const QString & appName, - bool isStandalone =false, - QWidget * p =NULL, - Qt::WindowFlags =0 ) const; - - /** - */ - QWidget * NewOtbApplicationWindow( const QString & appName, - bool isStandalone =false, - QWidget * p =NULL, - Qt::WindowFlags =0 ) const; - - /*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/ - -// -// Public SLOTS. -public slots: - - /*-[ SIGNALS SECTION ]-----------------------------------------------------*/ - -// -// Signals. -signals: - - /*-[ PROTECTED SECTION ]---------------------------------------------------*/ - -// -// Protected methods. -protected: - -// -// Protected attributes. -protected: - - /*-[ PRIVATE SECTION ]-----------------------------------------------------*/ + otb::Wrapper::Application::Pointer PrepareApplication(const QString& appName, bool isStandalone = false) const; -// -// Private methods. -private: - - -// -// Private attributes. -private: - - /*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/ - -// -// Slots. -private slots: + QWidget* NewOtbApplicationWindow(const QString& appName, bool isStandalone = false, QWidget* p = nullptr, Qt::WindowFlags = 0) const; }; -} // end namespace 'mvd'. - -/*****************************************************************************/ -/* INLINE SECTION */ - -// -// Qt includes (sorted by alphabetic order) -//// Must be included before system/custom includes. - -// -// System includes (sorted by alphabetic order) - -// -// ITK includes (sorted by alphabetic order) - -// -// OTB includes (sorted by alphabetic order) - -// -// Monteverdi includes (sorted by alphabetic order) - -namespace mvd -{ -} // end namespace 'mvd' +} // namespace mvd #endif // mvdApplicationLauncher_h diff --git a/Modules/Visualization/MonteverdiGui/include/mvdI18nMainWindow.h b/Modules/Visualization/MonteverdiGui/include/mvdI18nMainWindow.h index 7677069b0c8d4fd92944f570d9f3739caddbede9..bdccca7a759b9c1f813f6e17d99f8acd75066f14 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdI18nMainWindow.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdI18nMainWindow.h @@ -265,6 +265,8 @@ private slots: */ virtual void on_action_About_triggered(); + virtual void on_action_Documentation_triggered(); + }; } // end namespace 'mvd' diff --git a/Modules/Visualization/MonteverdiGui/include/mvdQtWidgetView.h b/Modules/Visualization/MonteverdiGui/include/mvdQtWidgetView.h index 9cf93a5913cb5147af6b6150a771793005754f8e..be4bda47048703af28ac5209944b6beadb6f5020 100644 --- a/Modules/Visualization/MonteverdiGui/include/mvdQtWidgetView.h +++ b/Modules/Visualization/MonteverdiGui/include/mvdQtWidgetView.h @@ -80,7 +80,7 @@ public: /** \brief Constructor. */ QtWidgetView( const otb::Wrapper::Application::Pointer & otbApp, - QWidget* p =0, + QWidget* p = nullptr, Qt::WindowFlags flags =0 ); /** \brief Destructor. */ diff --git a/Modules/Visualization/MonteverdiGui/src/mvdApplicationLauncher.cxx b/Modules/Visualization/MonteverdiGui/src/mvdApplicationLauncher.cxx index d24ba650e3ab37f6038e2160b69642c10ab4da8c..29c44ccd23c829f1ccd7ffc4b04dff3de990457c 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdApplicationLauncher.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdApplicationLauncher.cxx @@ -20,30 +20,11 @@ #include "mvdApplicationLauncher.h" - -/*****************************************************************************/ -/* INCLUDE SECTION */ - -// -// Qt includes (sorted by alphabetic order) -//// Must be included before system/custom includes. - -// -// System includes (sorted by alphabetic order) - -// -// ITK includes (sorted by alphabetic order) - -// -// OTB includes (sorted by alphabetic order) #include "otbWrapperApplicationRegistry.h" -#include "otbWrapperApplication.h" - -// -// Monteverdi includes (sorted by alphabetic order) +#include "otbWrapperQtWidgetMainWindow.h" + #include "mvdAlgorithm.h" #include "mvdI18nCoreApplication.h" -//#include "mvdTextStream.h" #include "mvdQtWidgetView.h" namespace mvd @@ -82,12 +63,9 @@ ApplicationLauncher } /*******************************************************************************/ -Wrapper::QtWidgetView * +otb::Wrapper::Application::Pointer ApplicationLauncher -::NewOtbApplicationWidget( const QString & appName, - bool isStandalone, - QWidget * p, - Qt::WindowFlags flags ) const +::PrepareApplication(const QString& appName, bool isStandalone) const { // Create module otb::Wrapper::Application::Pointer otbApp( @@ -196,83 +174,29 @@ ApplicationLauncher } } - // Create GUI based on module - Wrapper::QtWidgetView * gui = - new Wrapper::QtWidgetView( otbApp, p, flags ); - - gui->CreateGui(); + return otbApp; - return gui; } -/*******************************************************************************/ -QWidget * + + +QWidget* ApplicationLauncher ::NewOtbApplicationWindow( const QString & appName, bool isStandalone, - QWidget * p, - Qt::WindowFlags flags ) const + QWidget* parent, + Qt::WindowFlags flags ) const { -#if 0 - Wrapper::QtWidgetView * appWidget = - ApplicationLauncher::NewOtbApplicationWidget( appName, isStandalone ); + // Setup the otb application + auto otbApp = PrepareApplication(appName, isStandalone); - assert( appWidget!=NULL ); - assert( appWidget->GetModel()->GetApplication() ); - - QMainWindow * mainWindow = new QMainWindow( p, flags ); - - mainWindow->setWindowTitle( - QString( "%1 (OTB-" OTB_VERSION_STRING ")" ) - .arg( appWidget->GetModel()->GetApplication()->GetDocName() ) - ); - - mainWindow->setWindowIcon( QIcon( ":/otb_small.png" ) ); - - mainWindow->setCentralWidget( appWidget ); - - // Connect OTB-app widget quit signal, to the mainWindow close slot. - QObject::connect( - appWidget, - SIGNAL( QuitSignal() ), - // to: - mainWindow, - SLOT( close() ) - ); - - return mainWindow; - -#else - Wrapper::QtWidgetView * appWidget = - ApplicationLauncher::NewOtbApplicationWidget( - appName, - isStandalone, - p, - flags | Qt::Window - ); - - assert( appWidget!=NULL ); - assert( appWidget->GetModel()->GetApplication() ); + // Create main application widget + auto gui = new ::mvd::Wrapper::QtWidgetView(otbApp); + gui->CreateGui(); - appWidget->setWindowTitle( - QString( "%1 (OTB-" OTB_VERSION_STRING ")" ) - .arg( appWidget->GetModel()->GetApplication()->GetDocName() ) - ); + // Make the application window + auto window = new ::otb::Wrapper::QtMainWindow(otbApp, gui, parent, flags | Qt::Window); - appWidget->setWindowIcon( QIcon( ":/icons/process" ) ); - - QObject::connect( - appWidget, - SIGNAL( QuitSignal() ), - // to: - appWidget, - SLOT( close() ) - ); - - return appWidget; -#endif + return window; } -/*******************************************************************************/ -/* SLOTS */ - } // end namespace 'mvd' diff --git a/Modules/Visualization/MonteverdiGui/src/mvdI18nMainWindow.cxx b/Modules/Visualization/MonteverdiGui/src/mvdI18nMainWindow.cxx index 77329596bacef17cf1e7b54f20998458d2f933b2..cf4b85bf57dd4814d215297c52d48f4f70d6e9fe 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdI18nMainWindow.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdI18nMainWindow.cxx @@ -358,6 +358,15 @@ I18nMainWindow aboutDialog.exec(); } +void +I18nMainWindow +::on_action_Documentation_triggered() +{ + QDesktopServices::openUrl(QUrl("https://www.orfeo-toolbox.org/CookBook/")); +} + + + /*****************************************************************************/ } // end namespace 'mvd' diff --git a/Modules/Visualization/MonteverdiGui/src/mvdQtWidgetView.cxx b/Modules/Visualization/MonteverdiGui/src/mvdQtWidgetView.cxx index 0a916db966f54fcee75ccf3cea0a24a0ecdd69ed..4b32915f6bc77b610d515611f87c741ede99fe91 100644 --- a/Modules/Visualization/MonteverdiGui/src/mvdQtWidgetView.cxx +++ b/Modules/Visualization/MonteverdiGui/src/mvdQtWidgetView.cxx @@ -29,7 +29,6 @@ // // OTB includes (sorted by alphabetic order) -#include "otbWrapperApplicationHtmlDocGenerator.h" #include "otbWrapperOutputFilenameParameter.h" #include "otbWrapperOutputVectorDataParameter.h" #include "otbWrapperQtWidgetSimpleProgressReport.h" diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationHtmlDocGenerator.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationHtmlDocGenerator.h deleted file mode 100644 index 94176ae10cb2688fe83460dd956db1dc1fc33295..0000000000000000000000000000000000000000 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationHtmlDocGenerator.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbWrapperApplicationHtmlDocGenerator_h -#define otbWrapperApplicationHtmlDocGenerator_h - -#include "otbWrapperApplication.h" - -namespace otb -{ -namespace Wrapper -{ -/** \class ApplicationHtmlDocGenerator - * \brief This class genertaes the documentation of a class usung the - * class doc attributes. - * - * \ingroup OTBApplicationEngine - */ - -class OTBApplicationEngine_EXPORT ApplicationHtmlDocGenerator -{ -public: - /** Standard class typedef */ - typedef ApplicationHtmlDocGenerator Self; - - /** Constructor */ - ApplicationHtmlDocGenerator(); - - /** Destructor */ - virtual ~ApplicationHtmlDocGenerator(); - - /** Generate ans dave the documentation. */ - /** Add the key is the description of the parameter if showKey is - * set at true. */ - static void GenerateDoc( const Application::Pointer app, const std::string & filename, const bool showKey = false ); - /** Generate the documentation as a string. */ - /** Add the key is the description of the parameter if showKey is - * set at true. */ - static void GenerateDoc( const Application::Pointer app, std::string & val, const bool showKey = false); - -protected: - - /** Get the parameter description of one parameter. */ - /** Add the key is the description of the parameter if showKey is - * set at true. */ - static void GetDocParameters( const Application::Pointer app, std::string & val, const bool showKey = false ); - - /** generate the documentation associated to a group.*/ - /** Add the key is the description of the parameter if showKey is - * set at true. */ - static void GetDocParameterGroup( const Application::Pointer app, std::string & val, const std::string & key, const bool showKey = false ); - - /** generate the documentation associated to a choice.*/ - /** Add the key is the description of the parameter if showKey is - * set at true. */ - static void GetDocParameterChoice( const Application::Pointer app, std::string & val, const std::string & key, const bool showKey = false ); - - -private: - ApplicationHtmlDocGenerator(const ApplicationHtmlDocGenerator &) = delete; - void operator =(const ApplicationHtmlDocGenerator&) = delete; - -}; // End class InputImage Parameter - -} // End namespace Wrapper -} // End namespace otb - -#endif diff --git a/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt b/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt index a25d98d3fff3028ad2f5973330860be736d31168..e6a62d4f078425b5ae8cedffc890bbffd68647f2 100644 --- a/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt +++ b/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt @@ -19,7 +19,6 @@ # set( OTBApplicationEngine_SRC - otbWrapperApplicationHtmlDocGenerator.cxx otbWrapperComplexOutputImageParameter.cxx otbWrapperInputVectorDataListParameter.cxx otbWrapperListViewParameter.cxx diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationHtmlDocGenerator.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationHtmlDocGenerator.cxx deleted file mode 100644 index fb52f060127560d6c4c31e67d1b40a58ef8698dc..0000000000000000000000000000000000000000 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationHtmlDocGenerator.cxx +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "otbWrapperApplicationHtmlDocGenerator.h" - -#include <stdio.h> -#include "otbWrapperChoiceParameter.h" -#include "otbStringToHTML.h" - -namespace otb -{ -namespace Wrapper -{ - -#define otbDocHtmlTitleMacro( value ) \ - oss << "</style></head><body style=\" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;\"><p align=\"center\" style=\" margin-top:16px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:x-large; font-weight:600;\"><span style=\" font-size:x-large;\">"; \ - oss << value; \ - oss << "</span></p>"; - -#define otbDocHtmlTitle1Macro( value ) \ - oss << "<p style=\" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:large; font-weight:600;\"><span style=\" font-size:large;\">"; \ - oss << value; \ - oss << "</span></p>"; - -#define otbDocHtmlTitle2Macro( value ) \ - oss << "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:medium; font-weight:600;\"><span style=\" font-size:medium;\">"; \ - oss << value; \ - oss << "</span></p>"; - -#define otbDocHtmlBodyMacro( value ) \ - oss << "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"; \ - oss << value; \ - oss << "</p>"; - -#define otbDocHtmlBodyCodeMacro( value ) \ - oss << "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New, courier';\">"; \ - oss << value; \ - oss << "</p>"; - -#define otbDocHtmlParamMacro( type, param, fullKey, showKey ) \ - oss << "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:'Courier New, courier'; font-weight:600;\"; >"; \ - oss << otb::StringToHTML(param->GetName()); \ - if( showKey == true && param->GetKey()[0] != '\0' ) \ - { \ -if (!fullKey.empty()) \ - { \ - oss << " ("<< fullKey<< "." << param->GetKey() << ")"; \ - } \ -else \ - { \ - oss << " ("<< param->GetKey()<<")"; \ - } \ -} \ - oss << ": </span>"; \ -if( param->GetDescription()[0] != '\0' ) \ - { \ - oss << otb::StringToHTML(param->GetDescription()); \ - } \ -oss << "</p>"; - - -ApplicationHtmlDocGenerator::ApplicationHtmlDocGenerator() -{ -} - -ApplicationHtmlDocGenerator::~ApplicationHtmlDocGenerator() -{ -} - -void -ApplicationHtmlDocGenerator::GenerateDoc( const Application::Pointer app, std::string & val, const bool showKey ) -{ - std::ostringstream oss; - - oss << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd\">"; - oss << "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">"; - oss << "p, li { white-space: pre-wrap; }"; - oss << "</style></head><body style=\" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;\">"; - - otbDocHtmlTitleMacro( otb::StringToHTML(app->GetDocName()) ); - - otbDocHtmlTitle1Macro( "Brief Description" ); - otbDocHtmlBodyMacro( otb::StringToHTML(app->GetDescription()) ); - - otbDocHtmlTitle1Macro( "Tags" ); - std::string tagList; - if ( app->GetDocTags().size() > 0 ) - { - for (unsigned int i = 0; i < app->GetDocTags().size() - 1; i++) - { - tagList.append( app->GetDocTags()[i] ).append(", "); - } - tagList.append( app->GetDocTags()[app->GetDocTags().size() - 1]); - otbDocHtmlBodyMacro( otb::StringToHTML(tagList) ); - } - else - { - otbDocHtmlBodyMacro( "None" ); - } - - otbDocHtmlTitle1Macro("Long Description"); - otbDocHtmlBodyMacro( otb::StringToHTML(app->GetDocLongDescription()) ); - - otbDocHtmlTitle1Macro("Parameters"); - oss << "<ul>"; - std::string paramDocs(""); - ApplicationHtmlDocGenerator::GetDocParameters( app, paramDocs, showKey ); - oss<<paramDocs; - oss<<"</ul>"; - - otbDocHtmlTitle1Macro( "Limitations"); - otbDocHtmlBodyMacro( otb::StringToHTML(app->GetDocLimitations()) ); - - otbDocHtmlTitle1Macro( "Authors" ); - otbDocHtmlBodyMacro( otb::StringToHTML(app->GetDocAuthors()) ); - - otbDocHtmlTitle1Macro( "See also" ); - otbDocHtmlBodyMacro( otb::StringToHTML(app->GetDocSeeAlso()) ); - - otbDocHtmlTitle1Macro( "Example of use" ); - if( showKey == true ) - { - oss << "<ul>"; - otbDocHtmlBodyMacro( "<li>Values for GUIs:</li>" ); - } - otbDocHtmlBodyMacro( app->GetHtmlExample() ); - if( showKey == true ) - { - otbDocHtmlBodyMacro( "<li>Command line to execute:</li>" ); - otbDocHtmlBodyCodeMacro( otb::StringToHTML(app->GetCLExample()) ); - - oss << "</ul>"; - } - oss << "</body></html>"; - - val = oss.str(); - - // Replace ":\n\n" string with ":\n" (the extra LF is needed because of rst syntax - itksys::SystemTools::ReplaceString( val, ":<br/><br/>", ":<br/>"); -} - -void -ApplicationHtmlDocGenerator::GenerateDoc(const Application::Pointer app, const std::string& filename, const bool showKey) -{ - std::string doc; - - ApplicationHtmlDocGenerator::GenerateDoc( app, doc, showKey ); - - std::ofstream ofs(filename); - if (!ofs.is_open()) - { - fprintf(stderr, "Error, can't open file"); - itkGenericExceptionMacro( << "Error, can't open file "<<filename<<"."); - } - ofs << doc; - ofs.close(); -} - -void ApplicationHtmlDocGenerator::GetDocParameters( const Application::Pointer app, std::string & val, const bool showKey) -{ - std::ostringstream oss; - const std::string emptyString; - const std::vector<std::string> appKeyList = app->GetParametersKeys( false ); - const unsigned int nbOfParam = appKeyList.size(); - - std::string paramDocs(""); - if( nbOfParam == 0) - { - val = "None"; - } - else - { - for( unsigned int i=0; i<nbOfParam; i++ ) - { - const std::string key(appKeyList[i]); - Parameter::Pointer param = app->GetParameterByKey(key, false); - if( app->GetParameterType(key) == ParameterType_Group) - { - oss << "<li>"; - otbDocHtmlParamMacro( "group", param, emptyString, showKey ); - std::string grDoc; - ApplicationHtmlDocGenerator::GetDocParameterGroup( app, grDoc, key, showKey ); - oss<<grDoc; - oss<<"</li><br />"; - } - else if( app->GetParameterType(key) == ParameterType_Choice ) - { - oss << "<li>"; - otbDocHtmlParamMacro( "choice", param, emptyString, showKey ); - std::string grDoc; - ApplicationHtmlDocGenerator::GetDocParameterChoice(app, grDoc, key, showKey); - oss<<grDoc; - oss<<"</li><br />"; - } - else - { - oss << "<li>"; - otbDocHtmlParamMacro("param", param, emptyString, showKey ); - oss << "</li>"; - } - } - } - - val = oss.str(); -} - -void ApplicationHtmlDocGenerator::GetDocParameterGroup( const Application::Pointer app, std::string & val, const std::string & key, const bool showKey ) -{ - Parameter * paramGr = app->GetParameterByKey( key ); - if( !dynamic_cast<ParameterGroup *>(paramGr)) - { - itkGenericExceptionMacro("Invalid parameter type for key "<<key<<", wait for ParameterGroup..."); - } - - ParameterGroup * group = dynamic_cast<ParameterGroup *>(paramGr); - const std::vector<std::string> appKeyList = group->GetParametersKeys( false ); - unsigned int nbOfParam = appKeyList.size(); - const std::string emptyString; - std::ostringstream oss; - oss<<"<ul>"; - - for( unsigned int i=0; i<nbOfParam; i++ ) - { - const std::string fullKey(std::string(key).append(".").append(appKeyList[i])); - Parameter::Pointer param = app->GetParameterByKey( fullKey, false); - if( app->GetParameterType(fullKey) == ParameterType_Group) - { - oss<<"<li>"; - otbDocHtmlParamMacro( "group", param, emptyString, showKey ); - std::string grDoc; - ApplicationHtmlDocGenerator::GetDocParameterGroup( app, grDoc, fullKey, showKey ); - oss<<grDoc; - oss<<"</li>"; - } - else if( app->GetParameterType(fullKey) == ParameterType_Choice ) - { - oss<<"<li>"; - otbDocHtmlParamMacro( "choice", param, key, showKey ); - std::string grDoc; - ApplicationHtmlDocGenerator::GetDocParameterChoice(app, grDoc, fullKey, showKey ); - oss<<grDoc; - oss<<"</li>"; - } - else - { - oss << "<li>"; - otbDocHtmlParamMacro( "param", param, key, showKey ); - oss <<"</li>"; - } - } - oss<<"</ul>"; - val.append(oss.str()); -} - - -void ApplicationHtmlDocGenerator::GetDocParameterChoice( const Application::Pointer app, std::string & val, const std::string & key, const bool showKey ) -{ - Parameter * paramCh = app->GetParameterByKey( key ); - if( !dynamic_cast<ChoiceParameter *>(paramCh)) - { - itkGenericExceptionMacro("Invalid parameter type for key "<<key<<", wait for ChoiceParameter..."); - } - ChoiceParameter * choice = dynamic_cast<ChoiceParameter *>(paramCh); - const std::vector<std::string> appKeyList = choice->GetChoiceKeys(); - unsigned int nbOfParam = choice->GetNbChoices(); - const std::string emptyString; - std::ostringstream oss; - oss<<"<ul>"; - - for( unsigned int i=0; i<nbOfParam; i++ ) - { - const std::string fullKey(std::string(key).append(".").append(appKeyList[i])); - ParameterGroup * group = choice->GetChoiceParameterGroupByIndex(i); - std::string grDoc; - - oss << "<li>"; - otbDocHtmlParamMacro( "group", group, emptyString, showKey ); - ApplicationHtmlDocGenerator::GetDocParameterGroup( app, grDoc, fullKey, showKey ); - oss<<grDoc; - oss<<"</li>"; - } - oss<<"</ul>"; - val.append(oss.str()); -} - -} - } - diff --git a/Modules/Wrappers/ApplicationEngine/test/CMakeLists.txt b/Modules/Wrappers/ApplicationEngine/test/CMakeLists.txt index edc52346f234e7a6d6b5b0307d67fdad0e63740f..eed6679ac13a41e2079619dc9f664ea4fd470023 100644 --- a/Modules/Wrappers/ApplicationEngine/test/CMakeLists.txt +++ b/Modules/Wrappers/ApplicationEngine/test/CMakeLists.txt @@ -34,7 +34,6 @@ otbWrapperParameterListTest.cxx otbWrapperInputImageListParameterTest.cxx otbWrapperInputVectorDataListParameterTest.cxx otbWrapperApplicationDocTests.cxx -otbWrapperApplicationHtmlDocGeneratorTest.cxx otbWrapperOutputImageParameterTest.cxx otbApplicationMemoryConnectTest.cxx otbWrapperImageInterface.cxx @@ -105,18 +104,6 @@ otb_add_test(NAME owTvInputVectorDataListParameter COMMAND otbApplicationEngineT "my description" ) -otb_add_test(NAME owTvApplicationHtmlDocGeneratorTest - COMMAND otbApplicationEngineTestDriver - --compare-ascii ${NOTOL} - ${BASELINE}/owTvOReadImageInfoDoc.html - ${TEMP}/owTvOReadImageInfoDoc.html - otbWrapperApplicationHtmlDocGeneratorTest1 - ReadImageInfo - $<TARGET_FILE_DIR:otbapp_ReadImageInfo> - ${TEMP}/owTvOReadImageInfoDoc.html - 0 # don't show key in the parameterdescription - ) - otb_add_test(NAME owTvOutputImageParameter COMMAND otbApplicationEngineTestDriver otbWrapperOutputImageParameterTest1 ${INPUTDATA}/poupees.tif diff --git a/Modules/Wrappers/ApplicationEngine/test/otbApplicationEngineTestDriver.cxx b/Modules/Wrappers/ApplicationEngine/test/otbApplicationEngineTestDriver.cxx index 3b38170923ce50a613b05dc10de0a343c64d0cb4..3bf9d7e2cabeeae8895bbb03b83d79e1958cd4ea 100644 --- a/Modules/Wrappers/ApplicationEngine/test/otbApplicationEngineTestDriver.cxx +++ b/Modules/Wrappers/ApplicationEngine/test/otbApplicationEngineTestDriver.cxx @@ -36,7 +36,6 @@ void RegisterTests() REGISTER_TEST(otbWrapperInputImageListParameterTest1); REGISTER_TEST(otbWrapperInputVectorDataListParameterTest1); REGISTER_TEST(otbWrapperApplicationDocTest); - REGISTER_TEST(otbWrapperApplicationHtmlDocGeneratorTest1); REGISTER_TEST(otbWrapperOutputImageParameterTest1); //~ REGISTER_TEST(otbWrapperOutputImageParameterConversionTest); REGISTER_TEST(otbApplicationMemoryConnectTest); diff --git a/Modules/Wrappers/ApplicationEngine/test/otbWrapperApplicationHtmlDocGeneratorTest.cxx b/Modules/Wrappers/ApplicationEngine/test/otbWrapperApplicationHtmlDocGeneratorTest.cxx deleted file mode 100644 index 9a50c30ba05014a85df20622e67c3b39590bdf5d..0000000000000000000000000000000000000000 --- a/Modules/Wrappers/ApplicationEngine/test/otbWrapperApplicationHtmlDocGeneratorTest.cxx +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#if defined(_MSC_VER) -#pragma warning ( disable : 4786 ) -#endif - -#include "otbWrapperApplicationHtmlDocGenerator.h" -#include "otbWrapperApplicationRegistry.h" - - -int otbWrapperApplicationHtmlDocGeneratorTest1(int argc, char * argv[]) -{ - if (argc != 5) - { - std::cerr << "Usage : " << argv[0] << " module_name module_path outputfilename show_parameter_key" << std::endl; - return EXIT_FAILURE; - } - - typedef otb::Wrapper::ApplicationHtmlDocGenerator DocGeneratorType; - - // Add module path list - otb::Wrapper::ApplicationRegistry::AddApplicationPath( argv[2] ); - - // Create module - otb::Wrapper::Application::Pointer app = otb::Wrapper::ApplicationRegistry::CreateApplication(argv[1]); - - if (app.IsNull()) - { - std::cout << "Could not find application " << argv[1] << std::endl; - return EXIT_FAILURE; - } - - app->Init(); - // Create the documentation output file - DocGeneratorType::GenerateDoc( app, std::string(argv[3]), static_cast<bool>(atoi(argv[4])) ); - - return EXIT_SUCCESS; -} diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetMainWindow.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetMainWindow.h new file mode 100644 index 0000000000000000000000000000000000000000..6075898bff669381a7602d4a700cb2282091ffe7 --- /dev/null +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetMainWindow.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef otbWrapperQtWidgetMainWindow_h +#define otbWrapperQtWidgetMainWindow_h + +#include <QMainWindow> +#include "OTBQtWidgetExport.h" + +#include "otbWrapperApplication.h" + +class QAction; +class QMenu; + +namespace otb +{ +namespace Wrapper +{ + +class QtWidgetView; + +class OTBQtWidget_EXPORT QtMainWindow : public QMainWindow +{ + Q_OBJECT + +public: + QtMainWindow(Application::Pointer app, QtWidgetView* gui, QWidget* parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags()); + +public slots: + void UnhandledException(QString message); + +private: + QMenu* helpMenu; + QAction* helpAction; + + QtWidgetView* gui; +}; + +} // namespace Wrapper +} // namespace otb + +#endif diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetView.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetView.h index cd10086e0421fef54b733a37d78589e38915134f..9d12cf42938fbfedac2ba29b62c6a24868b961b3 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetView.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetView.h @@ -54,7 +54,7 @@ public: /** \brief Constructor. */ QtWidgetView( const otb::Wrapper::Application::Pointer & otbApp, - QWidget* parent, + QWidget* parent=nullptr, Qt::WindowFlags flags =0 ); /** \brief Destructor. */ @@ -68,8 +68,6 @@ public: bool IsClosable() const; -public slots: - void UnhandledException(QString message); signals: @@ -108,8 +106,6 @@ private: QWidget* CreateFooter(); - QWidget* CreateDoc(); - // Private attributes. private: diff --git a/Modules/Wrappers/QtWidget/src/CMakeLists.txt b/Modules/Wrappers/QtWidget/src/CMakeLists.txt index 961f34dffc197d63d92b2293d9cc735ad4c4dc89..727f90cdf56b89b6949c55b8128ffbe58e122750 100644 --- a/Modules/Wrappers/QtWidget/src/CMakeLists.txt +++ b/Modules/Wrappers/QtWidget/src/CMakeLists.txt @@ -23,6 +23,7 @@ set(OTBQtWidget_SRC otbWrapperQtWidgetModel.cxx otbWrapperQtWidgetParameterLabel.cxx otbWrapperQtWidgetView.cxx + otbWrapperQtWidgetMainWindow.cxx otbWrapperQtWidgetInputProcessXMLParameter.cxx otbWrapperQtWidgetIntParameter.cxx otbWrapperQtWidgetInputVectorDataListParameter.cxx @@ -81,6 +82,7 @@ set(OTBQtWidget_MOC_HDR ../include/otbWrapperQtWidgetParameterBase.h ../include/otbWrapperQtWidgetModel.h ../include/otbWrapperQtWidgetView.h + ../include/otbWrapperQtWidgetMainWindow.h ../include/otbWrapperQtWidgetProgressReport.h ../include/otbWrapperQtWidgetListViewParameter.h ../include/otbQtFileSelectionWidget.h diff --git a/Modules/Wrappers/QtWidget/src/otbApplicationLauncherQt.cxx b/Modules/Wrappers/QtWidget/src/otbApplicationLauncherQt.cxx index f28b9e32a46ac734eff5908b926dc7f8006fc801..2ee6bed4fbc9b5e62ec4107bd3e3e8f7755bce33 100644 --- a/Modules/Wrappers/QtWidget/src/otbApplicationLauncherQt.cxx +++ b/Modules/Wrappers/QtWidget/src/otbApplicationLauncherQt.cxx @@ -19,19 +19,23 @@ */ #include <QtWidgets> +#include <QTranslator> +#include <QDesktopServices> + #include "otbConfigurationManager.h" #include "otbWrapperApplicationRegistry.h" -#include "otbWrapperQtWidgetView.h" #include "otbWrapperQtWidgetSimpleProgressReport.h" #include "otbQtApplication.h" +#include "otbWrapperQtWidgetMainWindow.h" +#include "otbWrapperQtWidgetView.h" #include "itksys/SystemTools.hxx" using otb::Wrapper::Application; using otb::Wrapper::ApplicationRegistry; -using otb::Wrapper::QtWidgetView; -//using otb::Wrapper::QtWidgetProgressReport; -using otb::Wrapper::QtWidgetSimpleProgressReport; using otb::Wrapper::QtApplication; +using otb::Wrapper::QtMainWindow; +using otb::Wrapper::QtWidgetSimpleProgressReport; +using otb::Wrapper::QtWidgetView; int main(int argc, char* argv[]) { @@ -47,65 +51,52 @@ int main(int argc, char* argv[]) otb::ConfigurationManager::InitOpenMPThreads(); if (argc < 2) - { + { std::cerr << "Usage : " << argv[0] << " module_name [module_path]" << std::endl; return EXIT_FAILURE; - } + } std::string moduleName = argv[1]; // Get the module path list std::list<std::string> modulePathList; if (argc > 2) - { + { std::copy(argv + 2, argv + argc, std::back_inserter(modulePathList)); // Load the path in the environment std::list<std::string>::const_iterator it = modulePathList.begin(); - while( it != modulePathList.end() ) - { - ApplicationRegistry::AddApplicationPath( *(it) ); + while (it != modulePathList.end()) + { + ApplicationRegistry::AddApplicationPath(*(it)); ++it; - } } + } // Create module Application::Pointer app = ApplicationRegistry::CreateApplication(moduleName); if (app.IsNull()) - - { + { std::cerr << "Could not find application " << moduleName << std::endl; - std::string modulePath = ApplicationRegistry::GetApplicationPath(); - std::cout << "Module search path : " << modulePath << std::endl; + std::cout << "Module search path: " << ApplicationRegistry::GetApplicationPath() << std::endl; std::vector<std::string> list = ApplicationRegistry::GetAvailableApplications(); std::cout << "Available applications : " << (list.empty() ? "None" : "") << std::endl; for (std::vector<std::string>::const_iterator it = list.begin(); it != list.end(); ++it) - { + { std::cout << " " << *it << std::endl; - } - return EXIT_FAILURE; } + return EXIT_FAILURE; + } - // MainWidget : that contains the view and any other widget - // (progress, logs...) - QMainWindow* mainWindow = new QMainWindow(); - mainWindow->setWindowIcon(QIcon( ":/otb_small.png" )); - mainWindow->setWindowTitle(QString(app->GetDocName()).append(" - ").append(OTB_VERSION_STRING)); - - // Create GUI based on module - QtWidgetView* gui = new QtWidgetView(app, mainWindow); + // Create main application widget + auto gui = new ::otb::Wrapper::QtWidgetView(app); gui->CreateGui(); - // Connect the View "Quit" signal, to the mainWindow close slot - QObject::connect(gui, &QtWidgetView::QuitSignal, mainWindow, &QMainWindow::close); - - QObject::connect(&qtApp, &QtApplication::UnhandledException, gui, &QtWidgetView::UnhandledException); - + // Make the application window + auto mainWindow = new ::otb::Wrapper::QtMainWindow(app, gui); - // build the main window, central widget is the plugin view, other - // are docked widget (progress, logs...) - mainWindow->setCentralWidget(gui); + QObject::connect(&qtApp, &QtApplication::UnhandledException, mainWindow, &QtMainWindow::UnhandledException); // Show the main window mainWindow->show(); diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetMainWindow.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetMainWindow.cxx new file mode 100644 index 0000000000000000000000000000000000000000..cd6acedf700d3a9621581de5f9e43a754e922725 --- /dev/null +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetMainWindow.cxx @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "otbWrapperQtWidgetMainWindow.h" + +#include <QtWidgets> +#include "otbWrapperQtWidgetView.h" + +namespace otb +{ +namespace Wrapper +{ + +QtMainWindow::QtMainWindow(Application::Pointer app, QtWidgetView* gui, QWidget* parent, Qt::WindowFlags flags) : + QMainWindow(parent, flags), + gui(gui) +{ + this->setWindowIcon(QIcon(":/otb_small.png")); + this->setWindowTitle(QString(app->GetDocName()).append(" - ").append(OTB_VERSION_STRING)); + + // Set the given application view widget + gui->setParent(this); + this->setCentralWidget(gui); + + // Connect the View "Quit" signal, to the mainWindow close slot + connect(gui, &QtWidgetView::QuitSignal, this, &QMainWindow::close); + + // Setup the help menu + QMenu* helpMenu = this->menuBar()->addMenu(tr("&Help")); + helpAction = new QAction(tr("&Documentation"), this); + helpAction->setShortcuts(QKeySequence::HelpContents); + helpMenu->addAction(helpAction); + const std::string url = std::string("https://www.orfeo-toolbox.org/CookBook/Applications/app_") + app->GetName() + std::string(".html"); + QObject::connect(helpAction, &QAction::triggered, this, [=] { QDesktopServices::openUrl(QUrl(QString::fromStdString(url))); }); +} + +void QtMainWindow::UnhandledException(QString message) +{ + gui->UnhandledException(message); +} + +} // namespace Wrapper +} // namespace otb diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetView.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetView.cxx index e3fdb9aeb43a9f272914cce602934ba18de7df85..6b84fa510c85722a183a0a1ed7ab71f0236cea69 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetView.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetView.cxx @@ -24,7 +24,6 @@ #include "otbWrapperQtWidgetParameterGroup.h" #include "otbWrapperQtWidgetParameterFactory.h" -#include "otbWrapperApplicationHtmlDocGenerator.h" #include "otbWrapperOutputFilenameParameter.h" #include "otbWrapperOutputVectorDataParameter.h" #include "otbWrapperQtWidgetSimpleProgressReport.h" @@ -103,7 +102,6 @@ void QtWidgetView::CreateGui() m_LogText = new QTextEdit(this); connect( m_Model->GetLogOutput(), &QtLogOutput::NewContentLog, m_LogText, &QTextEdit::append ); m_TabWidget->addTab(m_LogText, tr("Logs")); - m_TabWidget->addTab(CreateDoc(), tr("Documentation")); mainLayout->addWidget(m_TabWidget); m_Message = new QLabel("<center><font color=\"#FF0000\">"+tr("Select parameters")+"</font></center>", this); @@ -115,7 +113,7 @@ void QtWidgetView::CreateGui() progressReport->SetApplication(m_Model->GetApplication()); QWidget* footer = CreateFooter(); - + QHBoxLayout *footLayout = new QHBoxLayout; footLayout->addWidget(progressReport); footLayout->addWidget(footer); @@ -181,10 +179,6 @@ QWidget* QtWidgetView::CreateFooter() // an HLayout with two buttons : Execute and Quit QGroupBox *footerGroup = new QGroupBox(this); QHBoxLayout *footerLayout = new QHBoxLayout; - - footerGroup->setFixedHeight(40); - footerGroup->setContentsMargins(0, 0, 0, 0); - footerLayout->setContentsMargins(5, 5, 5, 5); m_ExecButton = new QPushButton(footerGroup); m_ExecButton->setDefault(true); @@ -212,23 +206,6 @@ QWidget* QtWidgetView::CreateFooter() return footerGroup; } -QWidget* QtWidgetView::CreateDoc() -{ - QTextEdit *text = new QTextEdit(this); - text->setReadOnly(true); - - QTextDocument * doc = new QTextDocument(this); - - std::string docContain; - otb::Wrapper::ApplicationHtmlDocGenerator::GenerateDoc( GetModel()->GetApplication(), docContain); - - doc->setHtml(docContain.c_str()); - - text->setDocument(doc); - - return text; -} - void QtWidgetView::closeEvent( QCloseEvent * e ) { assert( e!=NULL );