Commit 4613fb7c authored by Stéphane Albert's avatar Stéphane Albert

BUG: MANTIS-1244: Fixed otb::GlView::GetExtent() and added number of effective actors considered.

parent 8a83de07
......@@ -236,7 +236,7 @@ public:
/**
*/
template< typename P >
bool GetExtent( P & origin, P & extent, bool isOverlay =false ) const;
size_t GetExtent( P & origin, P & extent, bool isOverlay =false ) const;
/**
*/
......@@ -416,7 +416,7 @@ GlView
template< typename P >
bool
size_t
GlView
::GetExtent( P & origin, P & extent, bool isOverlay ) const
{
......@@ -425,7 +425,7 @@ GlView
origin.Fill( 0 );
extent.Fill( 0 );
return false;
return 0;
}
......@@ -435,6 +435,8 @@ GlView
extent[ 0 ] = -std::numeric_limits< typename P::ValueType >::infinity();
extent[ 1 ] = -std::numeric_limits< typename P::ValueType >::infinity();
size_t count = 0;
for( ActorMapType::const_iterator it( m_Actors.begin() );
it!=m_Actors.end();
++it )
......@@ -476,10 +478,18 @@ GlView
if( e[ 1 ]>extent[ 1 ] )
extent[ 1 ] = e[ 1 ];
++ count;
}
}
return true;
if( count==0 )
{
origin.Fill( 0 );
extent.Fill( 0 );
}
return count;
}
......@@ -495,7 +505,7 @@ GlView
e.Fill( 0 );
// Get origin and extent of all layers in viewport system.
if( !GetExtent( o, e ) )
if( GetExtent( o, e )==0 )
return false;
// std::cout << "origin: [ " << o[ 0 ] << ", " << o[ 1 ] << " ]" << std::endl;
......@@ -544,9 +554,9 @@ GlView
// std::cout
// << std::hex << this << std::dec
// << "::ZoomToRegion( "
// << "[ " << origin[ 0 ] << ", " << origin[ 1 ] << "], "
// << "[ " << extent[ 0 ] << ", " << extent[ 1 ] << "], "
// << "[ " << native[ 0 ] << ", " << native[ 1 ] << "] )"
// << "[" << origin[ 0 ] << ", " << origin[ 1 ] << "], "
// << "[" << extent[ 0 ] << ", " << extent[ 1 ] << "], "
// << "[" << native[ 0 ] << ", " << native[ 1 ] << "] )"
// << std::endl;
// Compute center point.
......
......@@ -55,7 +55,6 @@ void GlView::Initialize(unsigned int sx, unsigned int sy)
this->ClearActors();
this->Resize(sx,sy);
}
void GlView::Resize(unsigned int sx, unsigned int sy)
......
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