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
unsigned int n =
std::min(
count,
CountResolutions( factor )
CountResolutions( factor , 1)
);
for( unsigned int i=0; i<n; ++i )
......
......@@ -222,14 +222,22 @@ ImportImagesDialog
I18nCoreApplication::SETTINGS_KEY_OVERVIEWS_SIZE
)
);
count =
builder->CountResolutions(
2,
value.isValid()
? value.toInt()
: OVERVIEWS_SIZE_DEFAULT
);
unsigned int threshold =
value.isValid() ? value.toInt() : OVERVIEWS_SIZE_DEFAULT;
otb::GDALOverviewsBuilder::SizeVector ovrSizes;
builder->SetResolutionFactor(2);
// Count all resolution with minimum size 1 (the high requested count is
// 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 )
......@@ -247,7 +255,6 @@ ImportImagesDialog
builder->SetBypassEnabled(true);
}
builder->SetResolutionFactor( 2 );
builder->SetNbResolutions( count );
builder->SetResamplingMethod( otb::GDAL_RESAMPLING_AVERAGE );
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