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

MRG: Merged bugfix-1231

parents 4bcb1c69 be320e35
......@@ -221,6 +221,9 @@ public:
/**
*/
inline bool IsGLSLEnabled() const;
/**
*/
virtual bool IsEffectsEnabled() const = 0;
/**
*/
inline bool ZoomToRegion( const PointType & origin,
......
......@@ -357,7 +357,6 @@ ImageViewRenderer
assert( !m_GlView.IsNull() );
// qDebug() << this << "::PaintGL(" << c << ")";
// qDebug() << "{";
// qDebug() << m_GlView.GetPointer();
......@@ -411,8 +410,6 @@ ImageViewRenderer
// qDebug() << m_GlView.GetPointer() << "::AfterRendering()";
#endif // USE_REMOTE_DESKTOP_DISABLED_RENDERING
// qDebug() << "}\n";
}
/*****************************************************************************/
......@@ -1093,6 +1090,14 @@ ImageViewRenderer
m_GlView->SaveScreenshot( QFile::encodeName( filename ).constData() );
}
/*****************************************************************************/
bool
ImageViewRenderer
::IsEffectsEnabled() const
{
return m_EffectsEnabled;
}
/*****************************************************************************/
/* SLOTS */
/*****************************************************************************/
......@@ -1109,6 +1114,9 @@ ImageViewRenderer
assert( !m_GlView.IsNull() );
if( !m_EffectsEnabled )
return;
for( PixelInfo::Vector::const_iterator it( pixels.begin() );
it != pixels.end();
++ it )
......@@ -1174,6 +1182,11 @@ ImageViewRenderer
p_screen[ 1 ] =
m_GlView->GetSettings()->GetViewportSize()[ 1 ] - screen.y();
// qDebug()
// << "otb::StandardShader::SetCenter("
// << p_screen[ 0 ] << "," << p_screen[ 1 ]
// << ")";
shader->SetCenter( p_screen );
if( shader->GetShaderType()==otb::SHADER_ALPHA_SLIDER )
......
......@@ -194,6 +194,8 @@ public:
const PointType & vcenter,
const SpacingType & vspacing ) const;
virtual bool IsEffectsEnabled() const;
/*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/
// public slots
......
......@@ -727,19 +727,94 @@ ImageViewWidget
{
assert( event!=NULL );
// qDebug() << this << "::mouseMove(" << event << ")";
// Superclass default behaviour.
QGLWidget::mouseMoveEvent( event );
// Delegate behaviour.
m_Manipulator->MouseMoveEvent( event );
//
// Get layer-stack.
StackedLayerModel * stackedLayerModel = GetLayerStack();
// assert( stackedLayerModel!=NULL );
if( stackedLayerModel==NULL )
return;
assert( stackedLayerModel!=NULL );
//
// Update view depending on shader status special behaviour.
//
bool isAnyEffectActive = false;
if( m_Renderer->IsEffectsEnabled() )
{
for( StackedLayerModel::ConstIterator it( stackedLayerModel->Begin() );
it!=stackedLayerModel->End();
++ it )
{
assert( it->second!=NULL );
if( it->second->inherits( AbstractImageModel::staticMetaObject.className() ) )
{
VectorImageModel * imageModel = qobject_cast< VectorImageModel * >( it->second );
assert( imageModel!=NULL );
if( imageModel->GetSettings().GetEffect()!=EFFECT_NONE &&
imageModel->GetSettings().GetEffect()!=EFFECT_NORMAL )
{
#if USE_XP_REGION_OPTIM
PointType origin;
PointType extent;
m_Renderer->GetLayerExtent( it->first, origin, extent );
if( ( origin[ 0 ]<=ptView[ 0 ] && ptView[ 0 ]<=extent[ 0 ] &&
origin[ 1 ]<=ptView[ 1 ] && ptView[ 1 ]<=extent[ 1 ] ) ||
( origin[ 0 ]<=m_Position[ 0 ] && m_Position[ 0 ]<=extent[ 0 ] &&
origin[ 1 ]<=m_Position[ 1 ] && m_Position[ 1 ]<=extent[ 1 ] ) )
{
qDebug() << FromStdString( it->first );
// qDebug()
// << "x:" << origin[ 0 ] << ptView[ 0 ] << m_Position[ 0 ] << extent[ 0 ];
// qDebug()
// << "y:" << origin[ 1 ] << ptView[ 1 ] << m_Position[ 1 ] << extent[ 1 ];
// qDebug()
// << "x:" << ptView[ 0 ] << m_Position[ 0 ];
// qDebug()
// << "y:" << ptView[ 1 ] << m_Position[ 1 ];
#endif // USE_XP_REGION_OPTIM
// qDebug() << "updateGL(" << in[ 0 ] << "," << in[ 1 ] << ")";
isAnyEffectActive = true;
break;
}
#if USE_XP_REGION_OPTIM
}
#endif // USE_XP_REGION_OPTIM
}
}
#if USE_XP_REGION_OPTIM
m_Position = ptView;
#endif // USE_XP_REGION_OPTION
}
// Delegate behaviour.
if( isAnyEffectActive )
{
bool bypass = m_Renderer->SetBypassRenderingEnabled( true );
m_Manipulator->MouseMoveEvent( event );
m_Renderer->SetBypassRenderingEnabled( bypass );
}
else
m_Manipulator->MouseMoveEvent( event );
//
// Pixel-picking special behaviour.
......@@ -786,60 +861,27 @@ ImageViewWidget
DefaultImageType::PixelType()
);
}
//
// Update view depending on shader status special behaviour.
//
{
for( StackedLayerModel::ConstIterator it( stackedLayerModel->Begin() );
it!=stackedLayerModel->End();
++ it )
else if( isAnyEffectActive )
{
assert( it->second!=NULL );
if( it->second->inherits( AbstractImageModel::staticMetaObject.className() ) )
{
VectorImageModel * imageModel = qobject_cast< VectorImageModel * >( it->second );
assert( imageModel!=NULL );
if( imageModel->GetSettings().GetEffect()!=EFFECT_NONE &&
imageModel->GetSettings().GetEffect()!=EFFECT_NORMAL )
{
#if USE_XP_REGION_OPTIM
PointType origin;
PointType extent;
m_Renderer->GetLayerExtent( it->first, origin, extent );
if( ( origin[ 0 ]<=in[ 0 ] && in[ 0 ]<=extent[ 0 ] &&
origin[ 1 ]<=in[ 1 ] && in[ 1 ]<=extent[ 1 ] ) |
( origin[ 0 ]<=m_Position[ 0 ] && m_Position[ 0 ]<=extent[ 0 ] &&
origin[ 1 ]<=m_Position[ 1 ] && m_Position[ 1 ]<=extent[ 1 ] ) )
{
qDebug() << FromStdString( it->first );
// Transform coordinates from widget space to viewport space.
assert( m_Manipulator!=NULL );
qDebug()
<< "o:" << origin[ 0 ] << "," << origin[ 1 ] << ";"
<< "e:" << extent[ 0 ] << "," << extent[ 1 ];
#endif // USE_XP_REGION_OPTIM
PointType ptView;
// qDebug() << "updateGL(" << in[ 0 ] << "," << in[ 1 ] << ")";
m_Manipulator->Transform( ptView, event->pos() );
updateGL();
//
// Pick pixel of point in viewport space and return point in image
// space.
assert( m_Renderer!=NULL );
break;
const PixelInfo::Vector & pixels = stackedLayerModel->PixelInfos();
}
#if USE_XP_REGION_OPTIM
}
#endif // USE_XP_REGION_OPTIM
}
m_Renderer->UpdatePixelInfo( event->pos(), ptView, pixels );
}
}
#if USE_XP_REGION_OPTIM
m_Position = in;
#endif // USE_XP_REGION_OPTION
if( isAnyEffectActive )
updateGL();
}
/*******************************************************************************/
......
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