Skip to content
Snippets Groups Projects
Commit e6977b60 authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

BUG: Mantis-1345: number of overview computed based on the max of the dimensions

parent a9aee5e0
Branches
Tags
No related merge requests found
...@@ -200,7 +200,7 @@ GDALOverviewsBuilder ...@@ -200,7 +200,7 @@ GDALOverviewsBuilder
unsigned int n = unsigned int n =
std::min( std::min(
count, count,
CountResolutions( factor ) CountResolutions( factor , 1)
); );
for( unsigned int i=0; i<n; ++i ) for( unsigned int i=0; i<n; ++i )
......
...@@ -222,14 +222,22 @@ ImportImagesDialog ...@@ -222,14 +222,22 @@ ImportImagesDialog
I18nCoreApplication::SETTINGS_KEY_OVERVIEWS_SIZE I18nCoreApplication::SETTINGS_KEY_OVERVIEWS_SIZE
) )
); );
unsigned int threshold =
count = value.isValid() ? value.toInt() : OVERVIEWS_SIZE_DEFAULT;
builder->CountResolutions(
2, otb::GDALOverviewsBuilder::SizeVector ovrSizes;
value.isValid() builder->SetResolutionFactor(2);
? value.toInt() // Count all resolution with minimum size 1 (the high requested count is
: OVERVIEWS_SIZE_DEFAULT // clamped by the builder)
); builder->ListResolutions(ovrSizes, 2, 9999);
// Count the number of levels with a least 1 size larger than the default size
for (unsigned int k=0 ; k<ovrSizes.size() ; k++)
{
if (std::max(ovrSizes[k][0],ovrSizes[k][1]) >= threshold)
count++;
else
break;
}
} }
if( builder->GetOverviewsCount()>0 ) if( builder->GetOverviewsCount()>0 )
...@@ -247,7 +255,6 @@ ImportImagesDialog ...@@ -247,7 +255,6 @@ ImportImagesDialog
builder->SetBypassEnabled(true); builder->SetBypassEnabled(true);
} }
builder->SetResolutionFactor( 2 );
builder->SetNbResolutions( count ); builder->SetNbResolutions( count );
builder->SetResamplingMethod( otb::GDAL_RESAMPLING_AVERAGE ); builder->SetResamplingMethod( otb::GDAL_RESAMPLING_AVERAGE );
builder->SetCompressionMethod( otb::GDAL_COMPRESSION_NONE ); builder->SetCompressionMethod( otb::GDAL_COMPRESSION_NONE );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment