Commit 7e6c7488 authored by Julien Osman's avatar Julien Osman Committed by Cédric Traizet

BUG: don't try to parse geom RPCs if they are not available

parent d639393e
......@@ -205,7 +205,7 @@ private:
std::vector<std::string> inputs = this->GetParameterStringList("il");
unsigned int nbInputs = inputs.size();
XMLReaderType::Pointer statReader = XMLReaderType::New();
for (unsigned int i = 0; i < nbInputs; i++)
for (unsigned int i = 0; i < nbInputs; ++i)
{
m_CalculatorList->PushBack(otb::SamplingRateCalculator::New());
statReader->SetFileName(inputs[i]);
......
......@@ -67,7 +67,7 @@ public:
*
* @param imd The ImageMetadata to fill
*/
const boost::any& FetchRPC(ImageMetadata & imd);
bool FetchRPC(ImageMetadata & imd);
/**
* @brief Writes the content of the Geom file into a string
......
......@@ -72,8 +72,13 @@ int GeomMetadataSupplier::GetNbBands() const
return ret_vect.size();
}
const boost::any& GeomMetadataSupplier::FetchRPC(ImageMetadata & imd)
bool GeomMetadataSupplier::FetchRPC(ImageMetadata & imd)
{
bool hasValue;
GetMetadataValue("polynomial_format", hasValue);
if (!hasValue)
return false;
Projection::RPCParam rpcStruct;
rpcStruct.LineOffset = this->GetAs<double>("line_off");
rpcStruct.SampleOffset = this->GetAs<double>("samp_off");
......@@ -118,8 +123,10 @@ const boost::any& GeomMetadataSupplier::FetchRPC(ImageMetadata & imd)
coeff = this->GetAs<double>(path.str());
}
imd.Add(MDGeom::RPC, rpcStruct);
return imd[MDGeom::RPC];
boost::any any_rpcStruct = rpcStruct;
imd.Add(MDGeom::RPC, std::move(any_rpcStruct));
auto toto = imd[MDGeom::RPC];
return true;
}
std::string GeomMetadataSupplier::PrintSelf() const
......
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