Commit b9ed3e3d authored by Stéphane Albert's avatar Stéphane Albert

ENH: Added OTB-Ice image-view and quicklook-view.

parent c3bcc24f
......@@ -61,13 +61,27 @@
#include "Gui/mvdDatasetPropertiesController.h"
#include "Gui/mvdDatasetPropertiesWidget.h"
#include "Gui/mvdFilenameDragAndDropEventFilter.h"
#if USE_OLD_IMAGE_VIEW
#include "Gui/mvdGLImageWidget1.h"
#endif // USE_OLD_IMAGE_VIEW
#include "Gui/mvdHistogramController.h"
#include "Gui/mvdHistogramWidget.h"
#if USE_OLD_IMAGE_VIEW
#include "Gui/mvdImageModelRenderer1.h"
#include "Gui/mvdImageViewManipulator1.h"
#endif // USE_OLD_IMAGE_VIEW
#if USE_ICE_IMAGE_VIEW
#include "Gui/mvdImageViewManipulator.h"
#include "Gui/mvdImageViewRenderer.h"
#include "Gui/mvdImageViewWidget.h"
#endif
#include "Gui/mvdPixelDescriptionWidget.h"
#if USE_ICE_IMAGE_VIEW
#include "Gui/mvdQuicklookViewManipulator.h"
#endif // USE_OLD_IMAGE_VIEW
#if USE_OLD_IMAGE_VIEW
#include "Gui/mvdQuicklookViewManipulator1.h"
#endif // USE_OLD_IMAGE_VIEW
#include "Gui/mvdStatusBarWidget.h"
//
#include "mvdApplication.h"
......@@ -112,10 +126,12 @@ MainWindow
#endif
#if USE_OLD_IMAGE_VIEW
m_ImageView1( NULL ),
#endif
#if USE_OLD_IMAGE_VIEW
m_QuicklookViewDock1( NULL ),
#endif
#endif // USE_OLD_IMAGE_VIEW
#if USE_ICE_IMAGE_VIEW
m_ImageView( NULL ),
m_QuicklookViewDock( NULL ),
#endif // USE_ICE_IMAGE_VIEW
m_CentralTabWidget( NULL ),
m_FilenameDragAndDropEventFilter( NULL )
{
......@@ -745,7 +761,19 @@ MainWindow
m_QuicklookViewDock1 = AddWidgetToDock(
CreateQuicklookWidget1( m_ImageView1 ),
"QUICKLOOK_VIEW",
tr( "Quicklook view" ),
tr( "Quicklook view (OpenGL)" ),
Qt::RightDockWidgetArea
);
#endif // USE_OLD_IMAGE_VIEW
// Quicklook-view dock-widget
#if USE_ICE_IMAGE_VIEW
assert( m_QuicklookViewDock==NULL );
assert( m_ImageView!=NULL );
m_QuicklookViewDock = AddWidgetToDock(
CreateQuicklookViewWidget( m_ImageView ),
"QUICKLOOK_VIEW",
tr( "Quicklook view (OTB-Ice)" ),
Qt::RightDockWidgetArea
);
#endif // USE_OLD_IMAGE_VIEW
......@@ -812,24 +840,40 @@ MainWindow
// 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* >();
#if USE_OLD_IMAGE_VIEW
// Initialize image-view.
assert( m_ImageView1==NULL );
m_ImageView1 = CreateImageWidget1();
// Add first tab: image-view.
m_CentralTabWidget->addTab(
int index1 = m_CentralTabWidget->addTab(
m_ImageView1,
tr( "Image view" )
tr( "Image view (OpenGL)" )
);
tabBar->setTabButton(index1, QTabBar::RightSide, 0);
tabBar->setTabButton(index1, QTabBar::LeftSide, 0);
#endif // USE_OLD_IMAGE_VIEW
//
// access to the quicklook tabBar to remove the close button
QTabBar* tabBar = m_CentralTabWidget->findChild< QTabBar* >();
#if USE_ICE_IMAGE_VIEW
// Initialize image-view.
assert( m_ImageView==NULL );
m_ImageView = CreateImageViewWidget();
tabBar->setTabButton(0, QTabBar::RightSide, 0);
tabBar->setTabButton(0, QTabBar::LeftSide, 0);
// Add first tab: image-view.
int index = m_CentralTabWidget->addTab(
m_ImageView,
tr( "Image view (OTB-Ice)" )
);
tabBar->setTabButton( index, QTabBar::RightSide, 0);
tabBar->setTabButton( index, QTabBar::LeftSide, 0);
#endif // USE_OLD_IMAGE_VIEW
}
/*****************************************************************************/
......@@ -902,6 +946,61 @@ MainWindow
#endif // USE_OLD_IMAGE_VIEW
/*****************************************************************************/
#if USE_ICE_IMAGE_VIEW
ImageViewWidget*
MainWindow
::CreateImageViewWidget( QGLWidget* sharedGlWidget )
{
ImageViewManipulator* manipulator =
new ImageViewManipulator( this );
ImageViewRenderer* renderer =
new ImageViewRenderer( this );
ImageViewWidget* imageView = new ImageViewWidget(
manipulator, // (will be reparented.)
renderer, // (will be reparented.)
this,
sharedGlWidget
);
imageView->setMinimumWidth( 256 );
return imageView;
}
#endif // USE_ICE_IMAGE_VIEW
/*****************************************************************************/
#if USE_ICE_IMAGE_VIEW
ImageViewWidget*
MainWindow
::CreateQuicklookViewWidget( QGLWidget* sharedGlWidget )
{
QuicklookViewManipulator* manipulator =
new QuicklookViewManipulator( this );
ImageViewRenderer* renderer =
new ImageViewRenderer( this );
ImageViewWidget* quicklookView = new ImageViewWidget(
manipulator, // (will be reparented.)
renderer, // (will be reparented.)
this,
sharedGlWidget
);
quicklookView->setMinimumSize( 64, 64 );
quicklookView->setMaximumSize( 512, 512 );
quicklookView->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum );
return quicklookView;
}
#endif // USE_ICE_IMAGE_VIEW
/*****************************************************************************/
void
......
......@@ -25,8 +25,9 @@
//// Included at first position before any other ones.
#include "ConfigureMonteverdi2.h"
#define USE_OLD_IMAGE_VIEW 1
#define USE_ICE_IMAGE_VIEW 1
// #if (defined( _DEBUG ) && FORCE_DISABLE) || FORCE_ENABLE
#define USE_ICE_IMAGE_VIEW (defined( _DEBUG ) && 1) || 0
#define USE_OLD_IMAGE_VIEW (!USE_ICE_IMAGE_VIEW && 1) || 0
/*****************************************************************************/
/* INCLUDE SECTION */
......@@ -69,7 +70,12 @@ namespace mvd
class DatasetModel;
// Gui
class FilenameDragAndDropEventFilter;
#if USE_OLD_IMAGE_VIEW
class GLImageWidget1;
#endif // USE_OLD_IMAGE_VIEW
#if USE_ICE_IMAGE_VIEW
class ImageViewWidget;
#endif // USE_ICE_IMAGE_VIEW
class StatusBarWidget;
namespace Ui
......@@ -209,6 +215,16 @@ private:
GLImageWidget1* CreateQuicklookWidget1( QGLWidget* sharedGlWidget =NULL );
#endif // USE_OLD_IMAGE_VIEW
#if USE_ICE_IMAGE_VIEW
/**
*/
ImageViewWidget* CreateImageViewWidget( QGLWidget* sharedGlWidget =NULL );
/**
*/
ImageViewWidget* CreateQuicklookViewWidget( QGLWidget* sharedGlWidget =NULL );
#endif // USE_ICE_IMAGE_VIEW
/**
*/
void InitializeDockWidgets();
......@@ -309,12 +325,25 @@ private:
* \brief Image-view dock-widget.
*/
GLImageWidget1* m_ImageView1;
#endif // USE_OLD_IMAGE_VIEW
/**
* \brief Quicklook-view dock-widget.
*/
QDockWidget* m_QuicklookViewDock1;
#endif // USE_OLD_IMAGE_VIEW
#if USE_ICE_IMAGE_VIEW
/**
* \brief Image-view page.
*/
ImageViewWidget* m_ImageView;
/**
* \brief Quicklook-view dock.
*/
QDockWidget* m_QuicklookViewDock;
#endif
/**
*/
......
......@@ -204,7 +204,7 @@ DatabaseConnection
}
// Conditionaly create demonstration groups.
// #if (!defined( _DEBUG ) && FORCE_DISABLE) || FORCE_ENABLE
// #if (defined( _DEBUG ) && FORCE_DISABLE) || FORCE_ENABLE
#if (defined( _DEBUG ) && 1) || 1
SqlId datasetNodeId(
GetNodeFields( dbc.FindDatasetNode() )
......@@ -218,7 +218,7 @@ DatabaseConnection
#endif
// Conditionaly create debug groups.
// #if (!defined( _DEBUG ) && FORCE_DISABLE) || FORCE_ENABLE
// #if (defined( _DEBUG ) && FORCE_DISABLE) || FORCE_ENABLE
#if (defined( _DEBUG ) && 0) || 0
SqlId rootNodeId(
GetRootNodeFields( dbc.FindRootNode() )
......
......@@ -43,6 +43,7 @@ set( Common_Gui_SOURCES
mvdMouseEventFilter.cxx
mvdMyWidget.cxx
mvdPixelDescriptionWidget.cxx
mvdQuicklookViewManipulator.cxx
mvdQuicklookViewManipulator1.cxx
mvdSearchableTreeWidget.cxx
mvdStatusBarWidget.cxx
......@@ -97,6 +98,7 @@ set( Common_Gui_HEADERS_MOC
mvdMouseEventFilter.h
mvdMyWidget.h
mvdPixelDescriptionWidget.h
mvdQuicklookViewManipulator.h
mvdQuicklookViewManipulator1.h
mvdSearchableTreeWidget.h
mvdStatusBarWidget.h
......
......@@ -45,8 +45,7 @@
//
// Monteverdi includes (sorted by alphabetic order)
#include "Core/mvdTypes.h"
#include "Gui/mvdAbstractViewManipulator.h"
#include "Gui/mvdAbstractImageViewManipulator.h"
/*****************************************************************************/
......@@ -70,17 +69,10 @@ namespace mvd
/**
* \class QuicklookViewManipulator
*
* \brief This class handles the event related to a QGLWidget. It also
* handles :
* - NavigationContext : to store the region of the image to be
* rendered.
* - MouseContext : to remember the user action as a mouse press,
* mouse drag
*
* WIP
* \brief TODO.
*/
class Monteverdi2_EXPORT QuicklookViewManipulator :
public AbstractViewManipulator
public AbstractImageViewManipulator
{
/*-[ QOBJECT SECTION ]-----------------------------------------------------*/
......@@ -99,51 +91,42 @@ public:
/** \brief Destructor. */
virtual ~QuicklookViewManipulator();
/** */
void mouseMoveEvent ( QMouseEvent * event );
/** */
void mousePressEvent ( QMouseEvent * event );
/** */
void mouseReleaseEvent ( QMouseEvent * event );
/** */
void wheelEvent ( QWheelEvent* event);
/** */
void resizeEvent ( QResizeEvent * event );
/** */
void keyPressEvent( QKeyEvent * event );
/** */
bool HasZoomChanged() const;
/**
*/
virtual void mouseMoveEvent( QMouseEvent * event );
/**
*/
virtual void mousePressEvent( QMouseEvent * event );
/**
*/
virtual void mouseReleaseEvent( QMouseEvent * event );
/**
*/
virtual void wheelEvent( QWheelEvent* event);
/**
*/
virtual void resizeEvent( QResizeEvent * event );
/**
*/
virtual void keyPressEvent( QKeyEvent * event );
/*-[ PUBLIC SLOTS SECTION ]-----------------------------------------------**/
//
// Public SLOTS.
public slots:
void OnModelImageRegionChanged(const ImageRegionType & largestRegion,
const SpacingType & spacing,
const PointType& origin);
/*-[ SIGNALS SECTION ]-----------------------------------------------------*/
//
// Signals.
signals:
void ViewportRegionChanged(double Xpc, double Ypc);
/*-[ PROTECTED SECTION ]---------------------------------------------------*/
//
// Protected methods.
protected:
/** */
void ConstrainRegion( ImageRegionType& region, const ImageRegionType& largest);
/** */
void CenterRegion(double scale);
/** */
void ResizeRegion(unsigned int w, unsigned int h);
//
// Protected attributes.
......@@ -159,17 +142,9 @@ private:
// Private methods.
private:
/** */
void Zoom(const double scale);
/** */
void moveRegion(double dx, double dy);
//
// Private attributes.
private:
// TODO: No zoom for quicklook. Remove when implementation is cleaned.
double m_PreviousIsotropicZoom;
/*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment