Commit 036cb508 authored by Ludovic Hussonnois's avatar Ludovic Hussonnois

BUG: Mantis-1289 : Clear and update DEM loading data to update pixels parameters.

Put DEM clear and loading in DoUpdate().
This change correct a side effect that was present in DoExecute() function.
parent 4093e51e
......@@ -235,6 +235,11 @@ private:
{
if (HasValue("io.in"))
{
// Clear and reset the DEM Handler
otb::DEMHandler::Instance()->ClearDEMs();
otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev");
// input image
FloatVectorImageType::Pointer inImage = GetParameterImage("io.in");
......@@ -645,9 +650,6 @@ private:
break;
}
// Setup the DEM Handler
otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev");
// If activated, generate RPC model
if(IsParameterEnabled("opt.rpc"))
{
......
......@@ -107,10 +107,20 @@ void ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(const Ap
// Set DEM directory if available
if(IsDEMUsed(app,key))
{
oss.str("");
oss<<"Elevation management: using DEM directory ("<<GetDEMDirectory(app,key)<<")"<<std::endl;
otb::DEMHandler::Instance()->OpenDEMDirectory(GetDEMDirectory(app,key));
app->GetLogger()->Info(oss.str());
std::string demDirectory = GetDEMDirectory(app,key);
if(otb::DEMHandler::Instance()->IsValidDEMDirectory(demDirectory.c_str()))
{
oss.str( "" );
oss << "Elevation management: using DEM directory (" << demDirectory << ")" << std::endl;
otb::DEMHandler::Instance()->OpenDEMDirectory( demDirectory );
app->GetLogger()->Info( oss.str() );
}
else
{
oss.str( "" );
oss << "DEM directory : " << demDirectory << " is not a valid DEM directory";
app->GetLogger()->Warning( oss.str() );
}
}
}
......@@ -161,10 +171,10 @@ ElevationParametersHandler::IsGeoidUsed(const Application::Pointer app, const st
bool
ElevationParametersHandler::IsDEMUsed(const Application::Pointer app, const std::string& key)
{
std::ostringstream geoidKey;
geoidKey<< key<<".dem";
std::ostringstream demKey;
demKey<< key<<".dem";
return app->IsParameterEnabled(geoidKey.str()) && app->HasValue(geoidKey.str());
return app->IsParameterEnabled(demKey.str()) && app->HasValue(demKey.str());
}
......
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