Commit 92ba553e authored by Julien Michel's avatar Julien Michel

BUG: Prevent UpdateResolution to read back geometry at each call (fix 1287)

parent 237a8cc1
......@@ -139,7 +139,8 @@ void GlImageActor::Initialize(const std::string & filename)
m_FileReader = ReaderType::New();
m_FileReader->SetFileName(m_FileName);
m_FileReader->UpdateOutputInformation();
m_FileReader->GetOutput()->UpdateOutputInformation();
std::cout<<"GlImageActor::Initialize"<<std::endl;
m_LargestRegion = m_FileReader->GetOutput()->GetLargestPossibleRegion();
......@@ -983,7 +984,7 @@ void GlImageActor::UpdateResolution()
// Arbitrary higher than any distance we will compute here
double minDist = 50000.;
m_CurrentResolution = 0;
unsigned int newResolution = 0;
// OTB always include full resolution level in available resolutions.
assert( !m_AvailableResolutions.empty() );
......@@ -1015,9 +1016,9 @@ void GlImageActor::UpdateResolution()
isFound = true;
minDist = vcl_abs(diff);
m_CurrentResolution = std::distance(m_AvailableResolutions.begin(),it);
newResolution = std::distance(m_AvailableResolutions.begin(),it);
// std::cout << "found: " << m_CurrentResolution << std::endl;
// std::cout << "found: " << newResolution << std::endl;
}
}
......@@ -1026,23 +1027,29 @@ void GlImageActor::UpdateResolution()
{
assert( m_AvailableResolutions.size() > 0 );
m_CurrentResolution = m_AvailableResolutions.size() - 1;
newResolution = m_AvailableResolutions.size() - 1;
// std::cout << "not found: " << m_CurrentResolution << std::endl;
}
}
std::ostringstream extFilename;
extFilename<<m_FileName<<"?&resol="<<m_CurrentResolution;
// ReaderType::New() is forced because of warning message
// 'Duplicated option detected: <option>. Using value <value>.'
// output by otb::ExtendedFilenameHelper.
m_FileReader = ReaderType::New();
m_FileReader->SetFileName(extFilename.str());
m_FileReader->UpdateOutputInformation();
// std::cout << "Switched to resolution: " << m_CurrentResolution << std::endl;
if(newResolution != m_CurrentResolution)
{
m_CurrentResolution = newResolution;
std::ostringstream extFilename;
extFilename<<m_FileName<<"?&resol="<<m_CurrentResolution;
// ReaderType::New() is forced because of warning message
// 'Duplicated option detected: <option>. Using value <value>.'
// output by otb::ExtendedFilenameHelper.
m_FileReader = ReaderType::New();
m_FileReader->SetFileName(extFilename.str());
m_FileReader->GetOutput()->UpdateOutputInformation();
std::cout<<"GlImageActor::UpdateResolution"<<std::endl;
// std::cout << "Switched to resolution: " << m_CurrentResolution <<
// std::endl;
}
}
void GlImageActor::UpdateTransforms()
......
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