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

BUG: MANTIS-1244: Fixed viewport reset when last layer has been deleted.

parent 8ea3fa95
......@@ -187,6 +187,10 @@ public:
*/
virtual void ResizeEvent( QResizeEvent* event ) =0;
/**
*/
virtual void ResetViewport() =0;
//
// Public SLOTS.
public slots:
......
......@@ -365,6 +365,30 @@ ImageViewManipulator
return viewport;
}
/******************************************************************************/
void
ImageViewManipulator
::ResetViewport()
{
assert( !m_ViewSettings.IsNull() );
otb::ViewSettings::SizeType size( m_ViewSettings->GetViewportSize() );
m_ViewSettings->Reset();
m_ViewSettings->SetViewportSize( size );
m_NativeSpacing.Fill( 1.0 );
m_ZoomFactor = 1.0;
emit RoiChanged(
GetOrigin(),
GetViewportSize(),
GetSpacing(),
m_ViewSettings->GetViewportCenter()
);
}
/******************************************************************************/
void
ImageViewManipulator
......
......@@ -166,6 +166,8 @@ public:
virtual const PointType& Transform( PointType&, const QPoint& ) const;
virtual void ResetViewport();
//
// Events.
......
......@@ -826,8 +826,15 @@ ImageViewRenderer
if( stackedLayerModel==NULL || stackedLayerModel->IsEmpty() )
{
m_GlView->ClearActors();
//
// MANTIS-1244: image-view not reset when layer-stack is cleared.
// {
emit ResetViewport();
// }
}
else
{
{
......@@ -838,7 +845,8 @@ ImageViewRenderer
++it )
if( !stackedLayerModel->Contains( *it ) )
{
// qDebug() << QString( "Removing image-actor '%1'..." ).arg( it->c_str() );
// qDebug()
// << QString( "Removing image-actor '%1'..." ).arg( it->c_str() );
m_GlView->RemoveActor( *it );
}
......
......@@ -212,6 +212,7 @@ signals:
void ClearProjectionRequired();
void SetProjectionRequired();
void UpdateProjectionRequired();
void ResetViewport();
/*-[ PROTECTED SECTION ]---------------------------------------------------*/
......
......@@ -632,6 +632,14 @@ ImageViewWidget
this,
SLOT( OnUpdateProjectionRequired() )
);
QObject::connect(
m_Renderer,
SIGNAL( ResetViewport() ),
// to:
this,
SLOT( OnResetViewport() )
);
}
/*******************************************************************************/
......@@ -1695,6 +1703,7 @@ ImageViewWidget
m_Renderer->GetReferenceModel< AbstractImageModel >();
SpacingType nativeSpacing;
// MANTIS-970: Fixed crash when no dataset is selected.
// {
if( imageModel==NULL )
......@@ -2204,6 +2213,18 @@ ImageViewWidget
}
}
/******************************************************************************/
void
ImageViewWidget
::OnResetViewport()
{
qDebug() << this << "::OnResetViewport()";
assert( m_Manipulator!=NULL );
m_Manipulator->ResetViewport();
}
/******************************************************************************/
void
ImageViewWidget
......
......@@ -420,6 +420,9 @@ private slots:
/**
*/
void OnRefreshViewRequested();
/**
*/
void OnResetViewport();
};
}// 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