Skip to content
Snippets Groups Projects
Commit 036cb508 authored by Ludovic Hussonnois's avatar Ludovic Hussonnois
Browse files

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
No related branches found
No related tags found
No related merge requests found
...@@ -235,6 +235,11 @@ private: ...@@ -235,6 +235,11 @@ private:
{ {
if (HasValue("io.in")) if (HasValue("io.in"))
{ {
// Clear and reset the DEM Handler
otb::DEMHandler::Instance()->ClearDEMs();
otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev");
// input image // input image
FloatVectorImageType::Pointer inImage = GetParameterImage("io.in"); FloatVectorImageType::Pointer inImage = GetParameterImage("io.in");
...@@ -645,9 +650,6 @@ private: ...@@ -645,9 +650,6 @@ private:
break; break;
} }
// Setup the DEM Handler
otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev");
// If activated, generate RPC model // If activated, generate RPC model
if(IsParameterEnabled("opt.rpc")) if(IsParameterEnabled("opt.rpc"))
{ {
......
...@@ -107,10 +107,20 @@ void ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(const Ap ...@@ -107,10 +107,20 @@ void ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(const Ap
// Set DEM directory if available // Set DEM directory if available
if(IsDEMUsed(app,key)) if(IsDEMUsed(app,key))
{ {
oss.str(""); std::string demDirectory = GetDEMDirectory(app,key);
oss<<"Elevation management: using DEM directory ("<<GetDEMDirectory(app,key)<<")"<<std::endl; if(otb::DEMHandler::Instance()->IsValidDEMDirectory(demDirectory.c_str()))
otb::DEMHandler::Instance()->OpenDEMDirectory(GetDEMDirectory(app,key)); {
app->GetLogger()->Info(oss.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 ...@@ -161,10 +171,10 @@ ElevationParametersHandler::IsGeoidUsed(const Application::Pointer app, const st
bool bool
ElevationParametersHandler::IsDEMUsed(const Application::Pointer app, const std::string& key) ElevationParametersHandler::IsDEMUsed(const Application::Pointer app, const std::string& key)
{ {
std::ostringstream geoidKey; std::ostringstream demKey;
geoidKey<< key<<".dem"; demKey<< key<<".dem";
return app->IsParameterEnabled(geoidKey.str()) && app->HasValue(geoidKey.str()); return app->IsParameterEnabled(demKey.str()) && app->HasValue(demKey.str());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment