Commit 3507ce17 authored by Stéphane Albert's avatar Stéphane Albert

ENH: Implemented mouse-click and -move in Quicklook-view.

parent 25af7ab3
......@@ -474,6 +474,14 @@ MainWindow
//
// Connect image-views for ROI-changed events.
assert( m_ImageView!=NULL );
const AbstractImageViewManipulator* imageViewManipulator =
m_ImageView->GetManipulator();
assert( imageViewManipulator!=NULL );
ImageViewWidget* quicklookView = GetQuicklookView();
assert( quicklookView!=NULL );
......@@ -482,7 +490,6 @@ MainWindow
assert( quicklookManipulator!=NULL );
assert( m_ImageView!=NULL );
QObject::connect(
m_ImageView,
......@@ -495,6 +502,22 @@ MainWindow
OnRoiChanged( const PointType&, const SizeType&, const SpacingType& )
)
);
QObject::connect(
quicklookView,
SIGNAL( CenterRoiRequested( const PointType& ) ),
// to:
imageViewManipulator,
SLOT( CenterOn( const PointType& ) )
);
QObject::connect(
quicklookManipulator,
SIGNAL( RefreshViewRequested() ),
// to:
m_ImageView,
SLOT( updateGL() )
);
}
#endif // USE_ICE_IMAGE_VIEW
......
......@@ -121,9 +121,6 @@ public:
SetupRenderingContext(
AbstractImageViewRenderer::RenderingContext * const ) const =0;
/**
*/
virtual void CenterOn( const PointType& point ) =0;
/**
*/
virtual void ZoomIn() =0;
......@@ -160,6 +157,9 @@ public:
//
// Public SLOTS.
public slots:
/**
*/
virtual void CenterOn( const PointType& point ) =0;
/*-[ SIGNALS SECTION ]-----------------------------------------------------*/
......@@ -169,15 +169,20 @@ signals:
/**
*/
void RefreshViewRequested();
/**
*/
void RoiChanged( PointType origin, SizeType size, SpacingType spacing );
/**
*/
void ZoomToExtentRequested();
/**
*/
void ZoomToFullResolutionRequested();
/**
*/
void CenterRoiRequested( const PointType& center );
/**
*/
void RoiChanged( const PointType& origin,
const SizeType& size,
const SpacingType& spacing );
/*-[ PROTECTED SECTION ]---------------------------------------------------*/
......
......@@ -186,6 +186,9 @@ protected:
/**
*/
QPoint m_MousePressPosition;
/**
*/
otb::ViewSettings::Pointer m_ViewSettings;
/*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/
......@@ -213,9 +216,6 @@ private:
//
// Private attributes.
private:
/**
*/
otb::ViewSettings::Pointer m_ViewSettings;
/**
*/
otb::ViewSettings::PointType m_MousePressOrigin;
......
......@@ -188,9 +188,19 @@ ImageViewWidget
);
QObject::connect(
m_Manipulator, SIGNAL( RoiChanged( PointType, SizeType, SpacingType ) ),
m_Manipulator,
SIGNAL( CenterRoiRequested( const PointType& ) ),
// to:
this, SIGNAL( RoiChanged( PointType, SizeType, SpacingType ) )
this,
SIGNAL( CenterRoiRequested( const PointType& ) )
);
QObject::connect(
m_Manipulator,
SIGNAL( RoiChanged( const PointType&, const SizeType&, const SpacingType& ) ),
// to:
this,
SIGNAL( RoiChanged( const PointType&, const SizeType&, const SpacingType& ) )
);
QObject::connect(
......
......@@ -162,7 +162,12 @@ public slots:
signals:
/**
*/
void RoiChanged( PointType origin, SizeType size, SpacingType spacing );
void CenterRoiRequested( const PointType& center );
/**
*/
void RoiChanged( const PointType& origin,
const SizeType& size,
const SpacingType& spacing );
/*-[ PROTECTED SECTION ]---------------------------------------------------*/
......
......@@ -138,7 +138,25 @@ QuicklookViewManipulator
// qDebug() << this << ":" << event;
Qt::MouseButtons buttons = event->buttons();
Qt::KeyboardModifiers modifiers = event->modifiers();
if( buttons==Qt::LeftButton && modifiers==Qt::NoModifier )
{
assert( !m_ViewSettings.IsNull() );
PointType center;
m_ViewSettings->ScreenToViewPortTransform(
static_cast< double >( m_MousePressPosition.x() ),
static_cast< double >( m_MousePressPosition.y() ),
center[ 0 ],
center[ 1 ]
);
emit CenterRoiRequested( center );
}
}
/******************************************************************************/
......@@ -155,21 +173,20 @@ QuicklookViewManipulator
if( buttons==Qt::LeftButton && modifiers==Qt::NoModifier )
{
// Cursor moves from press position to current position;
// Image moves the same direction, so apply the negative translation.
m_RoiOrigin =
ImageViewManipulator::Translate(
event->pos() - m_MousePressPosition,
m_RoiOrigin,
m_RoiSpacing
);
assert( !m_ViewSettings.IsNull() );
m_MousePressPosition = event->pos();
PointType center;
m_ViewSettings->ScreenToViewPortTransform(
static_cast< double >( m_MousePressPosition.x() ),
static_cast< double >( m_MousePressPosition.y() ),
center[ 0 ],
center[ 1 ]
);
emit RefreshViewRequested();
m_MousePressPosition = event->pos();
emit RoiChanged( m_RoiOrigin, m_RoiSize, m_RoiSpacing );
emit CenterRoiRequested( center );
}
}
......@@ -228,7 +245,9 @@ QuicklookViewManipulator
/*****************************************************************************/
void
QuicklookViewManipulator
::OnRoiChanged( PointType origin, SizeType size, SpacingType spacing )
::OnRoiChanged( const PointType& origin,
const SizeType& size,
const SpacingType& spacing )
{
qDebug() << this << ":OnRoiChanged()";
qDebug() << "origin :" << origin[ 0 ] << "," << origin[ 1 ];
......
......@@ -173,7 +173,9 @@ private:
private slots:
/**
*/
void OnRoiChanged( PointType origin, SizeType size, SpacingType spacing );
void OnRoiChanged( const PointType& origin,
const SizeType& size,
const SpacingType& spacing );
};
} // end namespace 'mvd'
......
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